@gigabuddy/agent 0.1.0
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/LICENSE +21 -0
- package/README.md +37 -0
- package/agent-cli.js +295 -0
- package/package.json +22 -0
package/agent-cli.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var gC=Object.create;var jf=Object.defineProperty;var yC=Object.getOwnPropertyDescriptor;var vC=Object.getOwnPropertyNames;var bC=Object.getPrototypeOf,_C=Object.prototype.hasOwnProperty;var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xr=(t,e)=>{for(var r in e)jf(t,r,{get:e[r],enumerable:!0})},wC=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of vC(e))!_C.call(t,n)&&n!==r&&jf(t,n,{get:()=>e[n],enumerable:!(i=yC(e,n))||i.enumerable});return t};var zc=(t,e,r)=>(r=t!=null?gC(bC(t)):{},wC(e||!t||!t.__esModule?jf(r,"default",{value:t,enumerable:!0}):r,t));var qf=D((hF,_w)=>{"use strict";var Zf="\x1B",De=`${Zf}[`,NC="\x07",Ff={to(t,e){return e?`${De}${e+1};${t+1}H`:`${De}${t+1}G`},move(t,e){let r="";return t<0?r+=`${De}${-t}D`:t>0&&(r+=`${De}${t}C`),e<0?r+=`${De}${-e}A`:e>0&&(r+=`${De}${e}B`),r},up:(t=1)=>`${De}${t}A`,down:(t=1)=>`${De}${t}B`,forward:(t=1)=>`${De}${t}C`,backward:(t=1)=>`${De}${t}D`,nextLine:(t=1)=>`${De}E`.repeat(t),prevLine:(t=1)=>`${De}F`.repeat(t),left:`${De}G`,hide:`${De}?25l`,show:`${De}?25h`,save:`${Zf}7`,restore:`${Zf}8`},MC={up:(t=1)=>`${De}S`.repeat(t),down:(t=1)=>`${De}T`.repeat(t)},jC={screen:`${De}2J`,up:(t=1)=>`${De}1J`.repeat(t),down:(t=1)=>`${De}J`.repeat(t),line:`${De}2K`,lineEnd:`${De}K`,lineStart:`${De}1K`,lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?Ff.up():"");return t&&(e+=Ff.left),e}};_w.exports={cursor:Ff,scroll:MC,erase:jC,beep:NC}});var xa=D(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.regexpCode=ye.getEsmExportName=ye.getProperty=ye.safeStringify=ye.stringify=ye.strConcat=ye.addCodeArg=ye.str=ye._=ye.nil=ye._Code=ye.Name=ye.IDENTIFIER=ye._CodeOrName=void 0;var $a=class{};ye._CodeOrName=$a;ye.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Vn=class extends $a{constructor(e){if(super(),!ye.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ye.Name=Vn;var qt=class extends $a{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((r,i)=>`${r}${i}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,i)=>(i instanceof Vn&&(r[i.str]=(r[i.str]||0)+1),r),{})}};ye._Code=qt;ye.nil=new qt("");function qS(t,...e){let r=[t[0]],i=0;for(;i<e.length;)rv(r,e[i]),r.push(t[++i]);return new qt(r)}ye._=qS;var tv=new qt("+");function VS(t,...e){let r=[ka(t[0])],i=0;for(;i<e.length;)r.push(tv),rv(r,e[i]),r.push(tv,ka(t[++i]));return zO(r),new qt(r)}ye.str=VS;function rv(t,e){e instanceof qt?t.push(...e._items):e instanceof Vn?t.push(e):t.push(EO(e))}ye.addCodeArg=rv;function zO(t){let e=1;for(;e<t.length-1;){if(t[e]===tv){let r=CO(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function CO(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Vn||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Vn))return`"${t}${e.slice(1)}`}function RO(t,e){return e.emptyStr()?t:t.emptyStr()?e:VS`${t}${e}`}ye.strConcat=RO;function EO(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:ka(Array.isArray(t)?t.join(","):t)}function AO(t){return new qt(ka(t))}ye.stringify=AO;function ka(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ye.safeStringify=ka;function OO(t){return typeof t=="string"&&ye.IDENTIFIER.test(t)?new qt(`.${t}`):qS`[${t}]`}ye.getProperty=OO;function NO(t){if(typeof t=="string"&&ye.IDENTIFIER.test(t))return new qt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ye.getEsmExportName=NO;function MO(t){return new qt(t.toString())}ye.regexpCode=MO});var ov=D(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.ValueScope=Pt.ValueScopeName=Pt.Scope=Pt.varKinds=Pt.UsedValueState=void 0;var Tt=xa(),nv=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Kd;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Kd||(Pt.UsedValueState=Kd={}));Pt.varKinds={const:new Tt.Name("const"),let:new Tt.Name("let"),var:new Tt.Name("var")};var Xd=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Tt.Name?e:this.name(e)}name(e){return new Tt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Pt.Scope=Xd;var Yd=class extends Tt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:i}){this.value=e,this.scopePath=(0,Tt._)`.${new Tt.Name(r)}[${i}]`}};Pt.ValueScopeName=Yd;var jO=(0,Tt._)`\n`,iv=class extends Xd{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?jO:Tt.nil}}get(){return this._scope}name(e){return new Yd(e,this._newName(e))}value(e,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,n);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(e,r){let i=this._values[e];if(i)return i.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Tt._)`${e}${i.scopePath}`})}scopeCode(e=this._values,r,i){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(e,r,i={},n){let o=Tt.nil;for(let s in e){let a=e[s];if(!a)continue;let c=i[s]=i[s]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Kd.Started);let u=r(l);if(u){let d=this.opts.es5?Pt.varKinds.var:Pt.varKinds.const;o=(0,Tt._)`${o}${d} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))o=(0,Tt._)`${o}${u}${this.opts._n}`;else throw new nv(l);c.set(l,Kd.Completed)})}return o}};Pt.ValueScope=iv});var te=D(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.or=ne.and=ne.not=ne.CodeGen=ne.operators=ne.varKinds=ne.ValueScopeName=ne.ValueScope=ne.Scope=ne.Name=ne.regexpCode=ne.stringify=ne.getProperty=ne.nil=ne.strConcat=ne.str=ne._=void 0;var me=xa(),tr=ov(),mn=xa();Object.defineProperty(ne,"_",{enumerable:!0,get:function(){return mn._}});Object.defineProperty(ne,"str",{enumerable:!0,get:function(){return mn.str}});Object.defineProperty(ne,"strConcat",{enumerable:!0,get:function(){return mn.strConcat}});Object.defineProperty(ne,"nil",{enumerable:!0,get:function(){return mn.nil}});Object.defineProperty(ne,"getProperty",{enumerable:!0,get:function(){return mn.getProperty}});Object.defineProperty(ne,"stringify",{enumerable:!0,get:function(){return mn.stringify}});Object.defineProperty(ne,"regexpCode",{enumerable:!0,get:function(){return mn.regexpCode}});Object.defineProperty(ne,"Name",{enumerable:!0,get:function(){return mn.Name}});var rp=ov();Object.defineProperty(ne,"Scope",{enumerable:!0,get:function(){return rp.Scope}});Object.defineProperty(ne,"ValueScope",{enumerable:!0,get:function(){return rp.ValueScope}});Object.defineProperty(ne,"ValueScopeName",{enumerable:!0,get:function(){return rp.ValueScopeName}});Object.defineProperty(ne,"varKinds",{enumerable:!0,get:function(){return rp.varKinds}});ne.operators={GT:new me._Code(">"),GTE:new me._Code(">="),LT:new me._Code("<"),LTE:new me._Code("<="),EQ:new me._Code("==="),NEQ:new me._Code("!=="),NOT:new me._Code("!"),OR:new me._Code("||"),AND:new me._Code("&&"),ADD:new me._Code("+")};var Ar=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},sv=class extends Ar{constructor(e,r,i){super(),this.varKind=e,this.name=r,this.rhs=i}render({es5:e,_n:r}){let i=e?tr.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ko(this.rhs,e,r)),this}get names(){return this.rhs instanceof me._CodeOrName?this.rhs.names:{}}},Qd=class extends Ar{constructor(e,r,i){super(),this.lhs=e,this.rhs=r,this.sideEffects=i}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof me.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ko(this.rhs,e,r),this}get names(){let e=this.lhs instanceof me.Name?{}:{...this.lhs.names};return tp(e,this.rhs)}},av=class extends Qd{constructor(e,r,i,n){super(e,i,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},cv=class extends Ar{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},lv=class extends Ar{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},uv=class extends Ar{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},dv=class extends Ar{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ko(this.code,e,r),this}get names(){return this.code instanceof me._CodeOrName?this.code.names:{}}},Sa=class extends Ar{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,i)=>r+i.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let i=e[r].optimizeNodes();Array.isArray(i)?e.splice(r,1,...i):i?e[r]=i:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(e,r)||(DO(e,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Bn(e,r.names),{})}},Or=class extends Sa{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},pv=class extends Sa{},$o=class extends Or{};$o.kind="else";var Hn=class t extends Or{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new $o(i):i}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(HS(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ko(this.condition,e,r),this}get names(){let e=super.names;return tp(e,this.condition),this.else&&Bn(e,this.else.names),e}};Hn.kind="if";var Wn=class extends Or{};Wn.kind="for";var fv=class extends Wn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ko(this.iteration,e,r),this}get names(){return Bn(super.names,this.iteration.names)}},mv=class extends Wn{constructor(e,r,i,n){super(),this.varKind=e,this.name=r,this.from=i,this.to=n}render(e){let r=e.es5?tr.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(e)}get names(){let e=tp(super.names,this.from);return tp(e,this.to)}},ep=class extends Wn{constructor(e,r,i,n){super(),this.loop=e,this.varKind=r,this.name=i,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ko(this.iterable,e,r),this}get names(){return Bn(super.names,this.iterable.names)}},Ia=class extends Or{constructor(e,r,i){super(),this.name=e,this.args=r,this.async=i}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ia.kind="func";var Ta=class extends Sa{render(e){return"return "+super.render(e)}};Ta.kind="return";var hv=class extends Or{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var i,n;return super.optimizeNames(e,r),(i=this.catch)===null||i===void 0||i.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Bn(e,this.catch.names),this.finally&&Bn(e,this.finally.names),e}},Pa=class extends Or{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Pa.kind="catch";var za=class extends Or{render(e){return"finally"+super.render(e)}};za.kind="finally";var gv=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new tr.Scope({parent:e}),this._nodes=[new pv]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let i=this._extScope.value(e,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new sv(e,o,i)),o}const(e,r,i){return this._def(tr.varKinds.const,e,r,i)}let(e,r,i){return this._def(tr.varKinds.let,e,r,i)}var(e,r,i){return this._def(tr.varKinds.var,e,r,i)}assign(e,r,i){return this._leafNode(new Qd(e,r,i))}add(e,r){return this._leafNode(new av(e,ne.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==me.nil&&this._leafNode(new dv(e)),this}object(...e){let r=["{"];for(let[i,n]of e)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,me.addCodeArg)(r,n));return r.push("}"),new me._Code(r)}if(e,r,i){if(this._blockNode(new Hn(e)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Hn(e))}else(){return this._elseNode(new $o)}endIf(){return this._endBlockNode(Hn,$o)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new fv(e),r)}forRange(e,r,i,n,o=this.opts.es5?tr.varKinds.var:tr.varKinds.let){let s=this._scope.toName(e);return this._for(new mv(o,s,r,i),()=>n(s))}forOf(e,r,i,n=tr.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof me.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,me._)`${s}.length`,a=>{this.var(o,(0,me._)`${s}[${a}]`),i(o)})}return this._for(new ep("of",n,o,r),()=>i(o))}forIn(e,r,i,n=this.opts.es5?tr.varKinds.var:tr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,me._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new ep("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(Wn)}label(e){return this._leafNode(new cv(e))}break(e){return this._leafNode(new lv(e))}return(e){let r=new Ta;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ta)}try(e,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new hv;if(this._blockNode(n),this.code(e),r){let o=this.name("e");this._currNode=n.catch=new Pa(o),r(o)}return i&&(this._currNode=n.finally=new za,this.code(i)),this._endBlockNode(Pa,za)}throw(e){return this._leafNode(new uv(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||e!==void 0&&i!==e)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=me.nil,i,n){return this._blockNode(new Ia(e,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Ia)}optimize(e=1){for(;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,r){let i=this._currNode;if(i instanceof e||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Hn))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};ne.CodeGen=gv;function Bn(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function tp(t,e){return e instanceof me._CodeOrName?Bn(t,e.names):t}function ko(t,e,r){if(t instanceof me.Name)return i(t);if(!n(t))return t;return new me._Code(t._items.reduce((o,s)=>(s instanceof me.Name&&(s=i(s)),s instanceof me._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function n(o){return o instanceof me._Code&&o._items.some(s=>s instanceof me.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function DO(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function HS(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,me._)`!${yv(t)}`}ne.not=HS;var UO=WS(ne.operators.AND);function LO(...t){return t.reduce(UO)}ne.and=LO;var ZO=WS(ne.operators.OR);function FO(...t){return t.reduce(ZO)}ne.or=FO;function WS(t){return(e,r)=>e===me.nil?r:r===me.nil?e:(0,me._)`${yv(e)} ${t} ${yv(r)}`}function yv(t){return t instanceof me.Name?t:(0,me._)`(${t})`}});var he=D(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;var Re=te(),qO=xa();function VO(t){let e={};for(let r of t)e[r]=!0;return e}oe.toHash=VO;function HO(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(GS(t,e),!KS(e,t.self.RULES.all))}oe.alwaysValidSchema=HO;function GS(t,e=t.schema){let{opts:r,self:i}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=i.RULES.keywords;for(let o in e)n[o]||QS(t,`unknown keyword: "${o}"`)}oe.checkUnknownRules=GS;function KS(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}oe.schemaHasRules=KS;function WO(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}oe.schemaHasRulesButRef=WO;function BO({topSchemaRef:t,schemaPath:e},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Re._)`${r}`}return(0,Re._)`${t}${e}${(0,Re.getProperty)(i)}`}oe.schemaRefOrVal=BO;function JO(t){return XS(decodeURIComponent(t))}oe.unescapeFragment=JO;function GO(t){return encodeURIComponent(bv(t))}oe.escapeFragment=GO;function bv(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=bv;function XS(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=XS;function KO(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}oe.eachItem=KO;function BS({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let c=s===void 0?o:s instanceof Re.Name?(o instanceof Re.Name?t(n,o,s):e(n,o,s),s):o instanceof Re.Name?(e(n,s,o),o):r(o,s);return a===Re.Name&&!(c instanceof Re.Name)?i(n,c):c}}oe.mergeEvaluated={props:BS({mergeNames:(t,e,r)=>t.if((0,Re._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Re._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Re._)`${r} || {}`).code((0,Re._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Re._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Re._)`${r} || {}`),_v(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:YS}),items:BS({mergeNames:(t,e,r)=>t.if((0,Re._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Re._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Re._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Re._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function YS(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Re._)`{}`);return e!==void 0&&_v(t,r,e),r}oe.evaluatedPropsToName=YS;function _v(t,e,r){Object.keys(r).forEach(i=>t.assign((0,Re._)`${e}${(0,Re.getProperty)(i)}`,!0))}oe.setEvaluated=_v;var JS={};function XO(t,e){return t.scopeValue("func",{ref:e,code:JS[e.code]||(JS[e.code]=new qO._Code(e.code))})}oe.useFunc=XO;var vv;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(vv||(oe.Type=vv={}));function YO(t,e,r){if(t instanceof Re.Name){let i=e===vv.Num;return r?i?(0,Re._)`"[" + ${t} + "]"`:(0,Re._)`"['" + ${t} + "']"`:i?(0,Re._)`"/" + ${t}`:(0,Re._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Re.getProperty)(t).toString():"/"+bv(t)}oe.getErrorPath=YO;function QS(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}oe.checkStrictMode=QS});var Nr=D(wv=>{"use strict";Object.defineProperty(wv,"__esModule",{value:!0});var ct=te(),QO={data:new ct.Name("data"),valCxt:new ct.Name("valCxt"),instancePath:new ct.Name("instancePath"),parentData:new ct.Name("parentData"),parentDataProperty:new ct.Name("parentDataProperty"),rootData:new ct.Name("rootData"),dynamicAnchors:new ct.Name("dynamicAnchors"),vErrors:new ct.Name("vErrors"),errors:new ct.Name("errors"),this:new ct.Name("this"),self:new ct.Name("self"),scope:new ct.Name("scope"),json:new ct.Name("json"),jsonPos:new ct.Name("jsonPos"),jsonLen:new ct.Name("jsonLen"),jsonPart:new ct.Name("jsonPart")};wv.default=QO});var Ca=D(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.extendErrors=lt.resetErrorsCount=lt.reportExtraError=lt.reportError=lt.keyword$DataError=lt.keywordError=void 0;var ge=te(),np=he(),vt=Nr();lt.keywordError={message:({keyword:t})=>(0,ge.str)`must pass "${t}" keyword validation`};lt.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ge.str)`"${t}" keyword must be ${e} ($data)`:(0,ge.str)`"${t}" keyword is invalid ($data)`};function eN(t,e=lt.keywordError,r,i){let{it:n}=t,{gen:o,compositeRule:s,allErrors:a}=n,c=r0(t,e,r);i??(s||a)?e0(o,c):t0(n,(0,ge._)`[${c}]`)}lt.reportError=eN;function tN(t,e=lt.keywordError,r){let{it:i}=t,{gen:n,compositeRule:o,allErrors:s}=i,a=r0(t,e,r);e0(n,a),o||s||t0(i,vt.default.vErrors)}lt.reportExtraError=tN;function rN(t,e){t.assign(vt.default.errors,e),t.if((0,ge._)`${vt.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ge._)`${vt.default.vErrors}.length`,e),()=>t.assign(vt.default.vErrors,null)))}lt.resetErrorsCount=rN;function nN({gen:t,keyword:e,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",n,vt.default.errors,a=>{t.const(s,(0,ge._)`${vt.default.vErrors}[${a}]`),t.if((0,ge._)`${s}.instancePath === undefined`,()=>t.assign((0,ge._)`${s}.instancePath`,(0,ge.strConcat)(vt.default.instancePath,o.errorPath))),t.assign((0,ge._)`${s}.schemaPath`,(0,ge.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ge._)`${s}.schema`,r),t.assign((0,ge._)`${s}.data`,i))})}lt.extendErrors=nN;function e0(t,e){let r=t.const("err",e);t.if((0,ge._)`${vt.default.vErrors} === null`,()=>t.assign(vt.default.vErrors,(0,ge._)`[${r}]`),(0,ge._)`${vt.default.vErrors}.push(${r})`),t.code((0,ge._)`${vt.default.errors}++`)}function t0(t,e){let{gen:r,validateName:i,schemaEnv:n}=t;n.$async?r.throw((0,ge._)`new ${t.ValidationError}(${e})`):(r.assign((0,ge._)`${i}.errors`,e),r.return(!1))}var Jn={keyword:new ge.Name("keyword"),schemaPath:new ge.Name("schemaPath"),params:new ge.Name("params"),propertyName:new ge.Name("propertyName"),message:new ge.Name("message"),schema:new ge.Name("schema"),parentSchema:new ge.Name("parentSchema")};function r0(t,e,r){let{createErrors:i}=t.it;return i===!1?(0,ge._)`{}`:iN(t,e,r)}function iN(t,e,r={}){let{gen:i,it:n}=t,o=[oN(n,r),sN(t,r)];return aN(t,e,o),i.object(...o)}function oN({errorPath:t},{instancePath:e}){let r=e?(0,ge.str)`${t}${(0,np.getErrorPath)(e,np.Type.Str)}`:t;return[vt.default.instancePath,(0,ge.strConcat)(vt.default.instancePath,r)]}function sN({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:i}){let n=i?e:(0,ge.str)`${e}/${t}`;return r&&(n=(0,ge.str)`${n}${(0,np.getErrorPath)(r,np.Type.Str)}`),[Jn.schemaPath,n]}function aN(t,{params:e,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;i.push([Jn.keyword,n],[Jn.params,typeof e=="function"?e(t):e||(0,ge._)`{}`]),c.messages&&i.push([Jn.message,typeof r=="function"?r(t):r]),c.verbose&&i.push([Jn.schema,s],[Jn.parentSchema,(0,ge._)`${u}${d}`],[vt.default.data,o]),l&&i.push([Jn.propertyName,l])}});var i0=D(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.boolOrEmptySchema=xo.topBoolOrEmptySchema=void 0;var cN=Ca(),lN=te(),uN=Nr(),dN={message:"boolean schema is false"};function pN(t){let{gen:e,schema:r,validateName:i}=t;r===!1?n0(t,!1):typeof r=="object"&&r.$async===!0?e.return(uN.default.data):(e.assign((0,lN._)`${i}.errors`,null),e.return(!0))}xo.topBoolOrEmptySchema=pN;function fN(t,e){let{gen:r,schema:i}=t;i===!1?(r.var(e,!1),n0(t)):r.var(e,!0)}xo.boolOrEmptySchema=fN;function n0(t,e){let{gen:r,data:i}=t,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,cN.reportError)(n,dN,void 0,e)}});var $v=D(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.getRules=So.isJSONType=void 0;var mN=["string","number","integer","boolean","null","object","array"],hN=new Set(mN);function gN(t){return typeof t=="string"&&hN.has(t)}So.isJSONType=gN;function yN(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}So.getRules=yN});var kv=D(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.shouldUseRule=hn.shouldUseGroup=hn.schemaHasRulesForType=void 0;function vN({schema:t,self:e},r){let i=e.RULES.types[r];return i&&i!==!0&&o0(t,i)}hn.schemaHasRulesForType=vN;function o0(t,e){return e.rules.some(r=>s0(t,r))}hn.shouldUseGroup=o0;function s0(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(i=>t[i]!==void 0))}hn.shouldUseRule=s0});var Ra=D(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.reportTypeError=ut.checkDataTypes=ut.checkDataType=ut.coerceAndCheckDataType=ut.getJSONTypes=ut.getSchemaTypes=ut.DataType=void 0;var bN=$v(),_N=kv(),wN=Ca(),ee=te(),a0=he(),Io;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Io||(ut.DataType=Io={}));function $N(t){let e=c0(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ut.getSchemaTypes=$N;function c0(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(bN.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ut.getJSONTypes=c0;function kN(t,e){let{gen:r,data:i,opts:n}=t,o=xN(e,n.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,_N.schemaHasRulesForType)(t,e[0]));if(s){let a=Sv(e,i,n.strictNumbers,Io.Wrong);r.if(a,()=>{o.length?SN(t,e,o):Iv(t)})}return s}ut.coerceAndCheckDataType=kN;var l0=new Set(["string","number","integer","boolean","null"]);function xN(t,e){return e?t.filter(r=>l0.has(r)||e==="array"&&r==="array"):[]}function SN(t,e,r){let{gen:i,data:n,opts:o}=t,s=i.let("dataType",(0,ee._)`typeof ${n}`),a=i.let("coerced",(0,ee._)`undefined`);o.coerceTypes==="array"&&i.if((0,ee._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,ee._)`${n}[0]`).assign(s,(0,ee._)`typeof ${n}`).if(Sv(e,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,ee._)`${a} !== undefined`);for(let l of r)(l0.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);i.else(),Iv(t),i.endIf(),i.if((0,ee._)`${a} !== undefined`,()=>{i.assign(n,a),IN(t,a)});function c(l){switch(l){case"string":i.elseIf((0,ee._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,ee._)`"" + ${n}`).elseIf((0,ee._)`${n} === null`).assign(a,(0,ee._)`""`);return;case"number":i.elseIf((0,ee._)`${s} == "boolean" || ${n} === null
|
|
4
|
+
|| (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,ee._)`+${n}`);return;case"integer":i.elseIf((0,ee._)`${s} === "boolean" || ${n} === null
|
|
5
|
+
|| (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,ee._)`+${n}`);return;case"boolean":i.elseIf((0,ee._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,ee._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,ee._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,ee._)`${s} === "string" || ${s} === "number"
|
|
6
|
+
|| ${s} === "boolean" || ${n} === null`).assign(a,(0,ee._)`[${n}]`)}}}function IN({gen:t,parentData:e,parentDataProperty:r},i){t.if((0,ee._)`${e} !== undefined`,()=>t.assign((0,ee._)`${e}[${r}]`,i))}function xv(t,e,r,i=Io.Correct){let n=i===Io.Correct?ee.operators.EQ:ee.operators.NEQ,o;switch(t){case"null":return(0,ee._)`${e} ${n} null`;case"array":o=(0,ee._)`Array.isArray(${e})`;break;case"object":o=(0,ee._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,ee._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,ee._)`typeof ${e} ${n} ${t}`}return i===Io.Correct?o:(0,ee.not)(o);function s(a=ee.nil){return(0,ee.and)((0,ee._)`typeof ${e} == "number"`,a,r?(0,ee._)`isFinite(${e})`:ee.nil)}}ut.checkDataType=xv;function Sv(t,e,r,i){if(t.length===1)return xv(t[0],e,r,i);let n,o=(0,a0.toHash)(t);if(o.array&&o.object){let s=(0,ee._)`typeof ${e} != "object"`;n=o.null?s:(0,ee._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else n=ee.nil;o.number&&delete o.integer;for(let s in o)n=(0,ee.and)(n,xv(s,e,r,i));return n}ut.checkDataTypes=Sv;var TN={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ee._)`{type: ${t}}`:(0,ee._)`{type: ${e}}`};function Iv(t){let e=PN(t);(0,wN.reportError)(e,TN)}ut.reportTypeError=Iv;function PN(t){let{gen:e,data:r,schema:i}=t,n=(0,a0.schemaRefOrVal)(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}});var d0=D(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.assignDefaults=void 0;var To=te(),zN=he();function CN(t,e){let{properties:r,items:i}=t.schema;if(e==="object"&&r)for(let n in r)u0(t,n,r[n].default);else e==="array"&&Array.isArray(i)&&i.forEach((n,o)=>u0(t,o,n.default))}ip.assignDefaults=CN;function u0(t,e,r){let{gen:i,compositeRule:n,data:o,opts:s}=t;if(r===void 0)return;let a=(0,To._)`${o}${(0,To.getProperty)(e)}`;if(n){(0,zN.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,To._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,To._)`${c} || ${a} === null || ${a} === ""`),i.if(c,(0,To._)`${a} = ${(0,To.stringify)(r)}`)}});var Vt=D(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.validateUnion=Pe.validateArray=Pe.usePattern=Pe.callValidateCode=Pe.schemaProperties=Pe.allSchemaProperties=Pe.noPropertyInData=Pe.propertyInData=Pe.isOwnProperty=Pe.hasPropFunc=Pe.reportMissingProp=Pe.checkMissingProp=Pe.checkReportMissingProp=void 0;var Ae=te(),Tv=he(),gn=Nr(),RN=he();function EN(t,e){let{gen:r,data:i,it:n}=t;r.if(zv(r,i,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ae._)`${e}`},!0),t.error()})}Pe.checkReportMissingProp=EN;function AN({gen:t,data:e,it:{opts:r}},i,n){return(0,Ae.or)(...i.map(o=>(0,Ae.and)(zv(t,e,o,r.ownProperties),(0,Ae._)`${n} = ${o}`)))}Pe.checkMissingProp=AN;function ON(t,e){t.setParams({missingProperty:e},!0),t.error()}Pe.reportMissingProp=ON;function p0(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ae._)`Object.prototype.hasOwnProperty`})}Pe.hasPropFunc=p0;function Pv(t,e,r){return(0,Ae._)`${p0(t)}.call(${e}, ${r})`}Pe.isOwnProperty=Pv;function NN(t,e,r,i){let n=(0,Ae._)`${e}${(0,Ae.getProperty)(r)} !== undefined`;return i?(0,Ae._)`${n} && ${Pv(t,e,r)}`:n}Pe.propertyInData=NN;function zv(t,e,r,i){let n=(0,Ae._)`${e}${(0,Ae.getProperty)(r)} === undefined`;return i?(0,Ae.or)(n,(0,Ae.not)(Pv(t,e,r))):n}Pe.noPropertyInData=zv;function f0(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Pe.allSchemaProperties=f0;function MN(t,e){return f0(e).filter(r=>!(0,Tv.alwaysValidSchema)(t,e[r]))}Pe.schemaProperties=MN;function jN({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,c,l){let u=l?(0,Ae._)`${t}, ${e}, ${i}${n}`:e,d=[[gn.default.instancePath,(0,Ae.strConcat)(gn.default.instancePath,o)],[gn.default.parentData,s.parentData],[gn.default.parentDataProperty,s.parentDataProperty],[gn.default.rootData,gn.default.rootData]];s.opts.dynamicRef&&d.push([gn.default.dynamicAnchors,gn.default.dynamicAnchors]);let p=(0,Ae._)`${u}, ${r.object(...d)}`;return c!==Ae.nil?(0,Ae._)`${a}.call(${c}, ${p})`:(0,Ae._)`${a}(${p})`}Pe.callValidateCode=jN;var DN=(0,Ae._)`new RegExp`;function UN({gen:t,it:{opts:e}},r){let i=e.unicodeRegExp?"u":"",{regExp:n}=e.code,o=n(r,i);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Ae._)`${n.code==="new RegExp"?DN:(0,RN.useFunc)(t,n)}(${r}, ${i})`})}Pe.usePattern=UN;function LN(t){let{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let c=e.const("len",(0,Ae._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Tv.Type.Num},o),e.if((0,Ae.not)(o),a)})}}Pe.validateArray=LN;function ZN(t){let{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Tv.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:i,schemaProp:l,compositeRule:!0},a);e.assign(s,(0,Ae._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Ae.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Pe.validateUnion=ZN});var g0=D(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.validateKeywordUsage=gr.validSchemaType=gr.funcKeywordCode=gr.macroKeywordCode=void 0;var bt=te(),Gn=Nr(),FN=Vt(),qN=Ca();function VN(t,e){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=t,a=e.macro.call(s.self,n,o,s),c=h0(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:bt.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}gr.macroKeywordCode=VN;function HN(t,e){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:c}=t;BN(c,e);let l=!a&&e.compile?e.compile.call(c.self,o,s,c):e.validate,u=h0(i,n,l),d=i.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&m0(t),y(()=>t.error());else{let _=e.async?f():m();e.modifying&&m0(t),y(()=>WN(t,_))}}function f(){let _=i.let("ruleErrs",null);return i.try(()=>h((0,bt._)`await `),$=>i.assign(d,!1).if((0,bt._)`${$} instanceof ${c.ValidationError}`,()=>i.assign(_,(0,bt._)`${$}.errors`),()=>i.throw($))),_}function m(){let _=(0,bt._)`${u}.errors`;return i.assign(_,null),h(bt.nil),_}function h(_=e.async?(0,bt._)`await `:bt.nil){let $=c.opts.passContext?Gn.default.this:Gn.default.self,w=!("compile"in e&&!a||e.schema===!1);i.assign(d,(0,bt._)`${_}${(0,FN.callValidateCode)(t,u,$,w)}`,e.modifying)}function y(_){var $;i.if((0,bt.not)(($=e.valid)!==null&&$!==void 0?$:d),_)}}gr.funcKeywordCode=HN;function m0(t){let{gen:e,data:r,it:i}=t;e.if(i.parentData,()=>e.assign(r,(0,bt._)`${i.parentData}[${i.parentDataProperty}]`))}function WN(t,e){let{gen:r}=t;r.if((0,bt._)`Array.isArray(${e})`,()=>{r.assign(Gn.default.vErrors,(0,bt._)`${Gn.default.vErrors} === null ? ${e} : ${Gn.default.vErrors}.concat(${e})`).assign(Gn.default.errors,(0,bt._)`${Gn.default.vErrors}.length`),(0,qN.extendErrors)(t)},()=>t.error())}function BN({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function h0(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,bt.stringify)(r)})}function JN(t,e,r=!1){return!e.length||e.some(i=>i==="array"?Array.isArray(t):i==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==i||r&&typeof t>"u")}gr.validSchemaType=JN;function GN({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}gr.validateKeywordUsage=GN});var v0=D(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.extendSubschemaMode=yn.extendSubschemaData=yn.getSubschema=void 0;var yr=te(),y0=he();function KN(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,yr._)`${t.schemaPath}${(0,yr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,yr._)`${t.schemaPath}${(0,yr.getProperty)(e)}${(0,yr.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,y0.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}yn.getSubschema=KN;function XN(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,p=a.let("data",(0,yr._)`${e.data}${(0,yr.getProperty)(r)}`,!0);c(p),t.errorPath=(0,yr.str)`${l}${(0,y0.getErrorPath)(r,i,d.jsPropertySyntax)}`,t.parentDataProperty=(0,yr._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(n!==void 0){let l=n instanceof yr.Name?n:a.let("data",n,!0);c(l),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}yn.extendSubschemaData=XN;function YN(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(t.compositeRule=i),n!==void 0&&(t.createErrors=n),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}yn.extendSubschemaMode=YN});var Cv=D((OJ,b0)=>{"use strict";b0.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if(i=e.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var w0=D((NJ,_0)=>{"use strict";var vn=_0.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};op(e,i,n,t,"",t)};vn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};vn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};vn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};vn.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 op(t,e,r,i,n,o,s,a,c,l){if(i&&typeof i=="object"&&!Array.isArray(i)){e(i,n,o,s,a,c,l);for(var u in i){var d=i[u];if(Array.isArray(d)){if(u in vn.arrayKeywords)for(var p=0;p<d.length;p++)op(t,e,r,d[p],n+"/"+u+"/"+p,o,n,u,i,p)}else if(u in vn.propsKeywords){if(d&&typeof d=="object")for(var f in d)op(t,e,r,d[f],n+"/"+u+"/"+QN(f),o,n,u,i,f)}else(u in vn.keywords||t.allKeys&&!(u in vn.skipKeywords))&&op(t,e,r,d,n+"/"+u,o,n,u,i)}r(i,n,o,s,a,c,l)}}function QN(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ea=D(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.getSchemaRefs=zt.resolveUrl=zt.normalizeId=zt._getFullPath=zt.getFullPath=zt.inlineRef=void 0;var eM=he(),tM=Cv(),rM=w0(),nM=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function iM(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Rv(t):e?$0(t)<=e:!1}zt.inlineRef=iM;var oM=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Rv(t){for(let e in t){if(oM.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Rv)||typeof r=="object"&&Rv(r))return!0}return!1}function $0(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!nM.has(r)&&(typeof t[r]=="object"&&(0,eM.eachItem)(t[r],i=>e+=$0(i)),e===1/0))return 1/0}return e}function k0(t,e="",r){r!==!1&&(e=Po(e));let i=t.parse(e);return x0(t,i)}zt.getFullPath=k0;function x0(t,e){return t.serialize(e).split("#")[0]+"#"}zt._getFullPath=x0;var sM=/#\/?$/;function Po(t){return t?t.replace(sM,""):""}zt.normalizeId=Po;function aM(t,e,r){return r=Po(r),t.resolve(e,r)}zt.resolveUrl=aM;var cM=/^[a-z_][-a-z0-9._]*$/i;function lM(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=Po(t[r]||e),o={"":n},s=k0(i,n,!1),a={},c=new Set;return rM(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,y=o[m];typeof d[r]=="string"&&(y=_.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),o[p]=y;function _(w){let k=this.opts.uriResolver.resolve;if(w=Po(y?k(y,w):w),c.has(w))throw u(w);c.add(w);let S=this.refs[w];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?l(d,S.schema,w):w!==Po(h)&&(w[0]==="#"?(l(d,a[w],w),a[w]=d):this.refs[w]=h),w}function $(w){if(typeof w=="string"){if(!cM.test(w))throw new Error(`invalid anchor "${w}"`);_.call(this,`#${w}`)}}}),a;function l(d,p,f){if(p!==void 0&&!tM(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}zt.getSchemaRefs=lM});var Na=D(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.getData=bn.KeywordCxt=bn.validateFunctionCode=void 0;var z0=i0(),S0=Ra(),Av=kv(),sp=Ra(),uM=d0(),Oa=g0(),Ev=v0(),V=te(),K=Nr(),dM=Ea(),Mr=he(),Aa=Ca();function pM(t){if(E0(t)&&(A0(t),R0(t))){hM(t);return}C0(t,()=>(0,z0.topBoolOrEmptySchema)(t))}bn.validateFunctionCode=pM;function C0({gen:t,validateName:e,schema:r,schemaEnv:i,opts:n},o){n.code.es5?t.func(e,(0,V._)`${K.default.data}, ${K.default.valCxt}`,i.$async,()=>{t.code((0,V._)`"use strict"; ${I0(r,n)}`),mM(t,n),t.code(o)}):t.func(e,(0,V._)`${K.default.data}, ${fM(n)}`,i.$async,()=>t.code(I0(r,n)).code(o))}function fM(t){return(0,V._)`{${K.default.instancePath}="", ${K.default.parentData}, ${K.default.parentDataProperty}, ${K.default.rootData}=${K.default.data}${t.dynamicRef?(0,V._)`, ${K.default.dynamicAnchors}={}`:V.nil}}={}`}function mM(t,e){t.if(K.default.valCxt,()=>{t.var(K.default.instancePath,(0,V._)`${K.default.valCxt}.${K.default.instancePath}`),t.var(K.default.parentData,(0,V._)`${K.default.valCxt}.${K.default.parentData}`),t.var(K.default.parentDataProperty,(0,V._)`${K.default.valCxt}.${K.default.parentDataProperty}`),t.var(K.default.rootData,(0,V._)`${K.default.valCxt}.${K.default.rootData}`),e.dynamicRef&&t.var(K.default.dynamicAnchors,(0,V._)`${K.default.valCxt}.${K.default.dynamicAnchors}`)},()=>{t.var(K.default.instancePath,(0,V._)`""`),t.var(K.default.parentData,(0,V._)`undefined`),t.var(K.default.parentDataProperty,(0,V._)`undefined`),t.var(K.default.rootData,K.default.data),e.dynamicRef&&t.var(K.default.dynamicAnchors,(0,V._)`{}`)})}function hM(t){let{schema:e,opts:r,gen:i}=t;C0(t,()=>{r.$comment&&e.$comment&&N0(t),_M(t),i.let(K.default.vErrors,null),i.let(K.default.errors,0),r.unevaluated&&gM(t),O0(t),kM(t)})}function gM(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,V._)`${r}.evaluated`),e.if((0,V._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,V._)`${t.evaluated}.props`,(0,V._)`undefined`)),e.if((0,V._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,V._)`${t.evaluated}.items`,(0,V._)`undefined`))}function I0(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,V._)`/*# sourceURL=${r} */`:V.nil}function yM(t,e){if(E0(t)&&(A0(t),R0(t))){vM(t,e);return}(0,z0.boolOrEmptySchema)(t,e)}function R0({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function E0(t){return typeof t.schema!="boolean"}function vM(t,e){let{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&N0(t),wM(t),$M(t);let o=i.const("_errs",K.default.errors);O0(t,o),i.var(e,(0,V._)`${o} === ${K.default.errors}`)}function A0(t){(0,Mr.checkUnknownRules)(t),bM(t)}function O0(t,e){if(t.opts.jtd)return T0(t,[],!1,e);let r=(0,S0.getSchemaTypes)(t.schema),i=(0,S0.coerceAndCheckDataType)(t,r);T0(t,r,!i,e)}function bM(t){let{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&(0,Mr.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _M(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Mr.checkStrictMode)(t,"default is ignored in the schema root")}function wM(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,dM.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function $M(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function N0({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)t.code((0,V._)`${K.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,V.str)`${i}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,V._)`${K.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function kM(t){let{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if((0,V._)`${K.default.errors} === 0`,()=>e.return(K.default.data),()=>e.throw((0,V._)`new ${n}(${K.default.vErrors})`)):(e.assign((0,V._)`${i}.errors`,K.default.vErrors),o.unevaluated&&xM(t),e.return((0,V._)`${K.default.errors} === 0`))}function xM({gen:t,evaluated:e,props:r,items:i}){r instanceof V.Name&&t.assign((0,V._)`${e}.props`,r),i instanceof V.Name&&t.assign((0,V._)`${e}.items`,i)}function T0(t,e,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Mr.schemaHasRulesButRef)(o,u))){n.block(()=>j0(t,"$ref",u.all.$ref.definition));return}c.jtd||SM(t,e),n.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,Av.shouldUseGroup)(o,p)&&(p.type?(n.if((0,sp.checkDataType)(p.type,s,c.strictNumbers)),P0(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,sp.reportTypeError)(t)),n.endIf()):P0(t,p),a||n.if((0,V._)`${K.default.errors} === ${i||0}`))}}function P0(t,e){let{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&(0,uM.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,Av.shouldUseRule)(i,o)&&j0(t,o.keyword,o.definition,e.type)})}function SM(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(IM(t,e),t.opts.allowUnionTypes||TM(t,e),PM(t,t.dataTypes))}function IM(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{M0(t.dataTypes,r)||Ov(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),CM(t,e)}}function TM(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ov(t,"use allowUnionTypes to allow union type keyword")}function PM(t,e){let r=t.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Av.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>zM(e,s))&&Ov(t,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function zM(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function M0(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function CM(t,e){let r=[];for(let i of t.dataTypes)M0(e,i)?r.push(i):e.includes("integer")&&i==="number"&&r.push("integer");t.dataTypes=r}function Ov(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Mr.checkStrictMode)(t,e,t.opts.strictTypes)}var ap=class{constructor(e,r,i){if((0,Oa.validateKeywordUsage)(e,r,i),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=i,this.data=e.data,this.schema=e.schema[i],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Mr.schemaRefOrVal)(e,this.schema,i,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",D0(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Oa.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",K.default.errors))}result(e,r,i){this.failResult((0,V.not)(e),r,i)}failResult(e,r,i){this.gen.if(e),i?i():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,V.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,V._)`${r} !== undefined && (${(0,V.or)(this.invalid$data(),e)})`)}error(e,r,i){if(r){this.setParams(r),this._error(e,i),this.setParams({});return}this._error(e,i)}_error(e,r){(e?Aa.reportExtraError:Aa.reportError)(this,this.def.error,r)}$dataError(){(0,Aa.reportError)(this,this.def.$dataError||Aa.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Aa.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,i=V.nil){this.gen.block(()=>{this.check$data(e,i),r()})}check$data(e=V.nil,r=V.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,V.or)((0,V._)`${n} === undefined`,r)),e!==V.nil&&i.assign(e,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),e!==V.nil&&i.assign(e,!1)),i.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,V.or)(s(),a());function s(){if(i.length){if(!(r instanceof V.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,V._)`${(0,sp.checkDataTypes)(c,r,o.opts.strictNumbers,sp.DataType.Wrong)}`}return V.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,V._)`!${c}(${r})`}return V.nil}}subschema(e,r){let i=(0,Ev.getSubschema)(this.it,e);(0,Ev.extendSubschemaData)(i,this.it,e),(0,Ev.extendSubschemaMode)(i,e);let n={...this.it,...i,items:void 0,props:void 0};return yM(n,r),n}mergeEvaluated(e,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&e.props!==void 0&&(i.props=Mr.mergeEvaluated.props(n,e.props,i.props,r)),i.items!==!0&&e.items!==void 0&&(i.items=Mr.mergeEvaluated.items(n,e.items,i.items,r)))}mergeValidEvaluated(e,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,V.Name)),!0}};bn.KeywordCxt=ap;function j0(t,e,r,i){let n=new ap(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?(0,Oa.funcKeywordCode)(n,r):"macro"in r?(0,Oa.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Oa.funcKeywordCode)(n,r)}var RM=/^\/(?:[^~]|~0|~1)*$/,EM=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function D0(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(t==="")return K.default.rootData;if(t[0]==="/"){if(!RM.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=K.default.rootData}else{let l=EM.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=e)throw new Error(c("property/index",u));return i[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!n)return o}let s=o,a=n.split("/");for(let l of a)l&&(o=(0,V._)`${o}${(0,V.getProperty)((0,Mr.unescapeJsonPointer)(l))}`,s=(0,V._)`${s} && ${o}`);return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}bn.getData=D0});var cp=D(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});var Nv=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Mv.default=Nv});var Ma=D(Uv=>{"use strict";Object.defineProperty(Uv,"__esModule",{value:!0});var jv=Ea(),Dv=class extends Error{constructor(e,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,jv.resolveUrl)(e,r,i),this.missingSchema=(0,jv.normalizeId)((0,jv.getFullPath)(e,this.missingRef))}};Uv.default=Dv});var up=D(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.resolveSchema=Ht.getCompilingSchema=Ht.resolveRef=Ht.compileSchema=Ht.SchemaEnv=void 0;var rr=te(),AM=cp(),Kn=Nr(),nr=Ea(),U0=he(),OM=Na(),zo=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let i;typeof e.schema=="object"&&(i=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,nr.normalizeId)(i?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=i?.$async,this.refs={}}};Ht.SchemaEnv=zo;function Zv(t){let e=L0.call(this,t);if(e)return e;let r=(0,nr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new rr.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:AM.default,code:(0,rr._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let l={gen:s,allErrors:this.opts.allErrors,data:Kn.default.data,parentData:Kn.default.parentData,parentDataProperty:Kn.default.parentDataProperty,dataNames:[Kn.default.data],dataPathArr:[rr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,rr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:rr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,rr._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,OM.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Kn.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let f=new Function(`${Kn.default.self}`,`${Kn.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=l;f.evaluated={props:m instanceof rr.Name?void 0:m,items:h instanceof rr.Name?void 0:h,dynamicProps:m instanceof rr.Name,dynamicItems:h instanceof rr.Name},f.source&&(f.source.evaluated=(0,rr.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Ht.compileSchema=Zv;function NM(t,e,r){var i;r=(0,nr.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let o=DM.call(this,t,r);if(o===void 0){let s=(i=t.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new zo({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=MM.call(this,o)}Ht.resolveRef=NM;function MM(t){return(0,nr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Zv.call(this,t)}function L0(t){for(let e of this._compilations)if(jM(e,t))return e}Ht.getCompilingSchema=L0;function jM(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function DM(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||lp.call(this,t,e)}function lp(t,e){let r=this.opts.uriResolver.parse(e),i=(0,nr._getFullPath)(this.opts.uriResolver,r),n=(0,nr.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===n)return Lv.call(this,r,t);let o=(0,nr.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=lp.call(this,t,s);return typeof a?.schema!="object"?void 0:Lv.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||Zv.call(this,s),o===(0,nr.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,nr.resolveUrl)(this.opts.uriResolver,n,l)),new zo({schema:a,schemaId:c,root:t,baseId:n})}return Lv.call(this,r,s)}}Ht.resolveSchema=lp;var UM=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Lv(t,{baseId:e,schema:r,root:i}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,U0.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!UM.has(a)&&l&&(e=(0,nr.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,U0.schemaHasRulesButRef)(r,this.RULES)){let a=(0,nr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=lp.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new zo({schema:r,schemaId:s,root:i,baseId:e}),o.schema!==o.root.schema)return o}});var Z0=D((ZJ,LM)=>{LM.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 qv=D((FJ,H0)=>{"use strict";var ZM=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),q0=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);function Fv(t){let e="",r=0,i=0;for(i=0;i<t.length;i++)if(r=t[i].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[i];break}for(i+=1;i<t.length;i++){if(r=t[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[i]}return e}var FM=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F0(t){return t.length=0,!0}function qM(t,e,r){if(t.length){let i=Fv(t);if(i!=="")e.push(i);else return r.error=!0,!1;t.length=0}return!0}function VM(t){let e=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,a=qM;for(let c=0;c<t.length;c++){let l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(o===!0&&(s=!0),!a(n,i,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),i.push(":");continue}else if(l==="%"){if(!a(n,i,r))break;a=F0}else{n.push(l);continue}}return n.length&&(a===F0?r.zone=n.join(""):s?i.push(n.join("")):i.push(Fv(n))),r.address=i.join(""),r}function V0(t){if(HM(t,":")<2)return{host:t,isIPV6:!1};let e=VM(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,i=e.address;return e.zone&&(r+="%"+e.zone,i+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:i}}}function HM(t,e){let r=0;for(let i=0;i<t.length;i++)t[i]===e&&r++;return r}function WM(t){let e=t,r=[],i=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((i=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,i)),e=e.slice(i)}return r.join("")}function BM(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function JM(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!q0(r)){let i=V0(r);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}H0.exports={nonSimpleDomain:FM,recomposeAuthority:JM,normalizeComponentEncoding:BM,removeDotSegments:WM,isIPv4:q0,isUUID:ZM,normalizeIPv6:V0,stringArrayToHexStripped:Fv}});var K0=D((qJ,G0)=>{"use strict";var{isUUID:GM}=qv(),KM=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,XM=["http","https","ws","wss","urn","urn:uuid"];function YM(t){return XM.indexOf(t)!==-1}function Vv(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function W0(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function B0(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function QM(t){return t.secure=Vv(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function ej(t){if((t.port===(Vv(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function tj(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(KM);if(r){let i=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${i}:${e.nid||t.nid}`,o=Hv(n);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function rj(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),n=`${r}:${e.nid||i}`,o=Hv(n);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${i||e.nid}:${a}`,e.skipEscape=!0,s}function nj(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!GM(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function ij(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var J0={scheme:"http",domainHost:!0,parse:W0,serialize:B0},oj={scheme:"https",domainHost:J0.domainHost,parse:W0,serialize:B0},dp={scheme:"ws",domainHost:!0,parse:QM,serialize:ej},sj={scheme:"wss",domainHost:dp.domainHost,parse:dp.parse,serialize:dp.serialize},aj={scheme:"urn",parse:tj,serialize:rj,skipNormalize:!0},cj={scheme:"urn:uuid",parse:nj,serialize:ij,skipNormalize:!0},pp={http:J0,https:oj,ws:dp,wss:sj,urn:aj,"urn:uuid":cj};Object.setPrototypeOf(pp,null);function Hv(t){return t&&(pp[t]||pp[t.toLowerCase()])||void 0}G0.exports={wsIsSecure:Vv,SCHEMES:pp,isValidSchemeName:YM,getSchemeHandler:Hv}});var Q0=D((VJ,mp)=>{"use strict";var{normalizeIPv6:lj,removeDotSegments:ja,recomposeAuthority:uj,normalizeComponentEncoding:fp,isIPv4:dj,nonSimpleDomain:pj}=qv(),{SCHEMES:fj,getSchemeHandler:X0}=K0();function mj(t,e){return typeof t=="string"?t=vr(jr(t,e),e):typeof t=="object"&&(t=jr(vr(t,e),e)),t}function hj(t,e,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Y0(jr(t,i),jr(e,i),i,!0);return i.skipEscape=!0,vr(n,i)}function Y0(t,e,r,i){let n={};return i||(t=jr(vr(t,r),r),e=jr(vr(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=ja(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=ja(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=ja(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=ja(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function gj(t,e,r){return typeof t=="string"?(t=unescape(t),t=vr(fp(jr(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=vr(fp(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=vr(fp(jr(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=vr(fp(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function vr(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},i=Object.assign({},e),n=[],o=X0(i.scheme||r.scheme);o&&o.serialize&&o.serialize(r,i),r.path!==void 0&&(i.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),i.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let s=uj(r);if(s!==void 0&&(i.reference!=="suffix"&&n.push("//"),n.push(s),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!i.absolutePath&&(!o||!o.absolutePath)&&(a=ja(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var yj=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function jr(t,e){let r=Object.assign({},e),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(yj);if(o){if(i.scheme=o[1],i.userinfo=o[3],i.host=o[4],i.port=parseInt(o[5],10),i.path=o[6]||"",i.query=o[7],i.fragment=o[8],isNaN(i.port)&&(i.port=o[5]),i.host)if(dj(i.host)===!1){let c=lj(i.host);i.host=c.host.toLowerCase(),n=c.isIPV6}else n=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference="same-document":i.scheme===void 0?i.reference="relative":i.fragment===void 0?i.reference="absolute":i.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let s=X0(r.scheme||i.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&i.host&&(r.domainHost||s&&s.domainHost)&&n===!1&&pj(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(a){i.error=i.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),s&&s.parse&&s.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return i}var Wv={SCHEMES:fj,normalize:mj,resolve:hj,resolveComponent:Y0,equal:gj,serialize:vr,parse:jr};mp.exports=Wv;mp.exports.default=Wv;mp.exports.fastUri=Wv});var tI=D(Bv=>{"use strict";Object.defineProperty(Bv,"__esModule",{value:!0});var eI=Q0();eI.code='require("ajv/dist/runtime/uri").default';Bv.default=eI});var lI=D(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.CodeGen=rt.Name=rt.nil=rt.stringify=rt.str=rt._=rt.KeywordCxt=void 0;var vj=Na();Object.defineProperty(rt,"KeywordCxt",{enumerable:!0,get:function(){return vj.KeywordCxt}});var Co=te();Object.defineProperty(rt,"_",{enumerable:!0,get:function(){return Co._}});Object.defineProperty(rt,"str",{enumerable:!0,get:function(){return Co.str}});Object.defineProperty(rt,"stringify",{enumerable:!0,get:function(){return Co.stringify}});Object.defineProperty(rt,"nil",{enumerable:!0,get:function(){return Co.nil}});Object.defineProperty(rt,"Name",{enumerable:!0,get:function(){return Co.Name}});Object.defineProperty(rt,"CodeGen",{enumerable:!0,get:function(){return Co.CodeGen}});var bj=cp(),sI=Ma(),_j=$v(),Da=up(),wj=te(),Ua=Ea(),hp=Ra(),Gv=he(),rI=Z0(),$j=tI(),aI=(t,e)=>new RegExp(t,e);aI.code="new RegExp";var kj=["removeAdditional","useDefaults","coerceTypes"],xj=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Sj={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."},Ij={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nI=200;function Tj(t){var e,r,i,n,o,s,a,c,l,u,d,p,f,m,h,y,_,$,w,k,S,J,F,P,se;let ue=t.strict,ae=(e=t.code)===null||e===void 0?void 0:e.optimize,Me=ae===!0||ae===void 0?1:ae||0,je=(i=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:aI,ie=(n=t.uriResolver)!==null&&n!==void 0?n:$j.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:ue)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ue)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:ue)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ue)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ue)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Me,regExp:je}:{optimize:Me,regExp:je},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:nI,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:nI,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:($=t.messages)!==null&&$!==void 0?$:!0,inlineRefs:(w=t.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(S=t.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(J=t.validateSchema)!==null&&J!==void 0?J:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(P=t.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(se=t.int32range)!==null&&se!==void 0?se:!0,uriResolver:ie}}var La=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Tj(e)};let{es5:r,lines:i}=this.opts.code;this.scope=new wj.ValueScope({scope:{},prefixes:xj,es5:r,lines:i}),this.logger=Aj(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,_j.getRules)(),iI.call(this,Sj,e,"NOT SUPPORTED"),iI.call(this,Ij,e,"DEPRECATED","warn"),this._metaOpts=Rj.call(this),e.formats&&zj.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Cj.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Pj.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:i}=this.opts,n=rI;i==="id"&&(n={...rI},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[i],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let i;if(typeof e=="string"){if(i=this.getSchema(e),!i)throw new Error(`no schema with key or ref "${e}"`)}else i=this.compile(e);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(e,r){let i=this._addSchema(e,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,e,r);async function n(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof sI.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=i(u))}finally{delete this._loading[u]}}}addSchema(e,r,i,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,i,n);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Ua.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,i,r,n,!0),this}addMetaSchema(e,r,i=this.opts.validateSchema){return this.addSchema(e,r,!0,i),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let i;if(i=e.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,e);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(e){let r;for(;typeof(r=oI.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:i}=this.opts,n=new Da.SchemaEnv({schema:{},schemaId:i});if(r=Da.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}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 r=oI.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let i=e[this.opts.schemaId];return i&&(i=(0,Ua.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let i;if(typeof e=="string")i=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof e=="object"&&r===void 0){if(r=e,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Nj.call(this,i,r),!r)return(0,Gv.eachItem)(i,o=>Jv.call(this,o)),this;jj.call(this,r);let n={...r,type:(0,hp.getJSONTypes)(r.type),schemaType:(0,hp.getJSONTypes)(r.schemaType)};return(0,Gv.eachItem)(i,n.type.length===0?o=>Jv.call(this,o,n):o=>n.type.forEach(s=>Jv.call(this,o,n,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let i of r.rules){let n=i.rules.findIndex(o=>o.keyword===e);n>=0&&i.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:i="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(e,r){let i=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let o=n.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in i){let c=i[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=s[a];l&&u&&(s[a]=cI(u))}}return e}_removeAllSchemas(e,r){for(let i in e){let n=e[i];(!r||r.test(i))&&(typeof n=="string"?delete e[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[i]))}}_addSchema(e,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;i=(0,Ua.normalizeId)(s||i);let l=Ua.getSchemaRefs.call(this,e,i);return c=new Da.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:i,localRefs:l}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Da.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Da.compileSchema.call(this,e)}finally{this.opts=r}}};La.ValidationError=bj.default;La.MissingRefError=sI.default;rt.default=La;function iI(t,e,r,i="error"){for(let n in t){let o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function oI(t){return t=(0,Ua.normalizeId)(t),this.schemas[t]||this.refs[t]}function Pj(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function zj(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Cj(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Rj(){let t={...this.opts};for(let e of kj)delete t[e];return t}var Ej={log(){},warn(){},error(){}};function Aj(t){if(t===!1)return Ej;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Oj=/^[a-z_$][a-z0-9_$:-]*$/i;function Nj(t,e){let{RULES:r}=this;if((0,Gv.eachItem)(t,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!Oj.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Jv(t,e,r){var i;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,hp.getJSONTypes)(e.type),schemaType:(0,hp.getJSONTypes)(e.schemaType)}};e.before?Mj.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(i=e.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function Mj(t,e,r){let i=t.rules.findIndex(n=>n.keyword===r);i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function jj(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=cI(e)),t.validateSchema=this.compile(e,!0))}var Dj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cI(t){return{anyOf:[t,Dj]}}});var uI=D(Kv=>{"use strict";Object.defineProperty(Kv,"__esModule",{value:!0});var Uj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Kv.default=Uj});var mI=D(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.callRef=Xn.getValidate=void 0;var Lj=Ma(),dI=Vt(),Ct=te(),Ro=Nr(),pI=up(),gp=he(),Zj={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:i}=t,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:c}=i,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=pI.resolveRef.call(c,l,n,r);if(u===void 0)throw new Lj.default(i.opts.uriResolver,n,r);if(u instanceof pI.SchemaEnv)return p(u);return f(u);function d(){if(o===l)return yp(t,s,o,o.$async);let m=e.scopeValue("root",{ref:l});return yp(t,(0,Ct._)`${m}.validate`,l,l.$async)}function p(m){let h=fI(t,m);yp(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Ct.stringify)(m)}:{ref:m}),y=e.name("valid"),_=t.subschema({schema:m,dataTypes:[],schemaPath:Ct.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function fI(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ct._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Xn.getValidate=fI;function yp(t,e,r,i){let{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:c}=o,l=c.passContext?Ro.default.this:Ct.nil;i?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Ct._)`await ${(0,dI.callValidateCode)(t,e,l)}`),f(e),s||n.assign(m,!0)},h=>{n.if((0,Ct._)`!(${h} instanceof ${o.ValidationError})`,()=>n.throw(h)),p(h),s||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,dI.callValidateCode)(t,e,l),()=>f(e),()=>p(e))}function p(m){let h=(0,Ct._)`${m}.errors`;n.assign(Ro.default.vErrors,(0,Ct._)`${Ro.default.vErrors} === null ? ${h} : ${Ro.default.vErrors}.concat(${h})`),n.assign(Ro.default.errors,(0,Ct._)`${Ro.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=gp.mergeEvaluated.props(n,y.props,o.props));else{let _=n.var("props",(0,Ct._)`${m}.evaluated.props`);o.props=gp.mergeEvaluated.props(n,_,o.props,Ct.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=gp.mergeEvaluated.items(n,y.items,o.items));else{let _=n.var("items",(0,Ct._)`${m}.evaluated.items`);o.items=gp.mergeEvaluated.items(n,_,o.items,Ct.Name)}}}Xn.callRef=yp;Xn.default=Zj});var hI=D(Xv=>{"use strict";Object.defineProperty(Xv,"__esModule",{value:!0});var Fj=uI(),qj=mI(),Vj=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Fj.default,qj.default];Xv.default=Vj});var gI=D(Yv=>{"use strict";Object.defineProperty(Yv,"__esModule",{value:!0});var vp=te(),_n=vp.operators,bp={maximum:{okStr:"<=",ok:_n.LTE,fail:_n.GT},minimum:{okStr:">=",ok:_n.GTE,fail:_n.LT},exclusiveMaximum:{okStr:"<",ok:_n.LT,fail:_n.GTE},exclusiveMinimum:{okStr:">",ok:_n.GT,fail:_n.LTE}},Hj={message:({keyword:t,schemaCode:e})=>(0,vp.str)`must be ${bp[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,vp._)`{comparison: ${bp[t].okStr}, limit: ${e}}`},Wj={keyword:Object.keys(bp),type:"number",schemaType:"number",$data:!0,error:Hj,code(t){let{keyword:e,data:r,schemaCode:i}=t;t.fail$data((0,vp._)`${r} ${bp[e].fail} ${i} || isNaN(${r})`)}};Yv.default=Wj});var yI=D(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});var Za=te(),Bj={message:({schemaCode:t})=>(0,Za.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Za._)`{multipleOf: ${t}}`},Jj={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Bj,code(t){let{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Za._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Za._)`${s} !== parseInt(${s})`;t.fail$data((0,Za._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};Qv.default=Jj});var bI=D(eb=>{"use strict";Object.defineProperty(eb,"__esModule",{value:!0});function vI(t){let e=t.length,r=0,i=0,n;for(;i<e;)r++,n=t.charCodeAt(i++),n>=55296&&n<=56319&&i<e&&(n=t.charCodeAt(i),(n&64512)===56320&&i++);return r}eb.default=vI;vI.code='require("ajv/dist/runtime/ucs2length").default'});var _I=D(tb=>{"use strict";Object.defineProperty(tb,"__esModule",{value:!0});var Yn=te(),Gj=he(),Kj=bI(),Xj={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Yn.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Yn._)`{limit: ${t}}`},Yj={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Xj,code(t){let{keyword:e,data:r,schemaCode:i,it:n}=t,o=e==="maxLength"?Yn.operators.GT:Yn.operators.LT,s=n.opts.unicode===!1?(0,Yn._)`${r}.length`:(0,Yn._)`${(0,Gj.useFunc)(t.gen,Kj.default)}(${r})`;t.fail$data((0,Yn._)`${s} ${o} ${i}`)}};tb.default=Yj});var wI=D(rb=>{"use strict";Object.defineProperty(rb,"__esModule",{value:!0});var Qj=Vt(),eD=he(),Eo=te(),tD={message:({schemaCode:t})=>(0,Eo.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Eo._)`{pattern: ${t}}`},rD={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:tD,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=s.opts.code,l=c.code==="new RegExp"?(0,Eo._)`new RegExp`:(0,eD.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,Eo._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,Eo._)`!${u}`)}else{let c=(0,Qj.usePattern)(t,n);t.fail$data((0,Eo._)`!${c}.test(${r})`)}}};rb.default=rD});var $I=D(nb=>{"use strict";Object.defineProperty(nb,"__esModule",{value:!0});var Fa=te(),nD={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Fa.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Fa._)`{limit: ${t}}`},iD={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:nD,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxProperties"?Fa.operators.GT:Fa.operators.LT;t.fail$data((0,Fa._)`Object.keys(${r}).length ${n} ${i}`)}};nb.default=iD});var kI=D(ib=>{"use strict";Object.defineProperty(ib,"__esModule",{value:!0});var qa=Vt(),Va=te(),oD=he(),sD={message:({params:{missingProperty:t}})=>(0,Va.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Va._)`{missingProperty: ${t}}`},aD={keyword:"required",type:"object",schemaType:"array",$data:!0,error:sD,code(t){let{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?l():u(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,_=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,oD.checkStrictMode)(s,_,s.opts.strictRequired)}}function l(){if(c||o)t.block$data(Va.nil,d);else for(let f of r)(0,qa.checkReportMissingProp)(t,f)}function u(){let f=e.let("missing");if(c||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,qa.checkMissingProp)(t,r,f)),(0,qa.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",i,f=>{t.setParams({missingProperty:f}),e.if((0,qa.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,i,()=>{e.assign(m,(0,qa.propertyInData)(e,n,f,a.ownProperties)),e.if((0,Va.not)(m),()=>{t.error(),e.break()})},Va.nil)}}};ib.default=aD});var xI=D(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});var Ha=te(),cD={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ha._)`{limit: ${t}}`},lD={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:cD,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxItems"?Ha.operators.GT:Ha.operators.LT;t.fail$data((0,Ha._)`${r}.length ${n} ${i}`)}};ob.default=lD});var _p=D(sb=>{"use strict";Object.defineProperty(sb,"__esModule",{value:!0});var SI=Cv();SI.code='require("ajv/dist/runtime/equal").default';sb.default=SI});var II=D(cb=>{"use strict";Object.defineProperty(cb,"__esModule",{value:!0});var ab=Ra(),nt=te(),uD=he(),dD=_p(),pD={message:({params:{i:t,j:e}})=>(0,nt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,nt._)`{i: ${t}, j: ${e}}`},fD={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:pD,code(t){let{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;let c=e.let("valid"),l=o.items?(0,ab.getSchemaTypes)(o.items):[];t.block$data(c,u,(0,nt._)`${s} === false`),t.ok(c);function u(){let m=e.let("i",(0,nt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,nt._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),_=(0,ab.checkDataTypes)(l,y,a.opts.strictNumbers,ab.DataType.Wrong),$=e.const("indices",(0,nt._)`{}`);e.for((0,nt._)`;${m}--;`,()=>{e.let(y,(0,nt._)`${r}[${m}]`),e.if(_,(0,nt._)`continue`),l.length>1&&e.if((0,nt._)`typeof ${y} == "string"`,(0,nt._)`${y} += "_"`),e.if((0,nt._)`typeof ${$}[${y}] == "number"`,()=>{e.assign(h,(0,nt._)`${$}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,nt._)`${$}[${y}] = ${m}`)})}function f(m,h){let y=(0,uD.useFunc)(e,dD.default),_=e.name("outer");e.label(_).for((0,nt._)`;${m}--;`,()=>e.for((0,nt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,nt._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};cb.default=fD});var TI=D(ub=>{"use strict";Object.defineProperty(ub,"__esModule",{value:!0});var lb=te(),mD=he(),hD=_p(),gD={message:"must be equal to constant",params:({schemaCode:t})=>(0,lb._)`{allowedValue: ${t}}`},yD={keyword:"const",$data:!0,error:gD,code(t){let{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&typeof o=="object"?t.fail$data((0,lb._)`!${(0,mD.useFunc)(e,hD.default)}(${r}, ${n})`):t.fail((0,lb._)`${o} !== ${r}`)}};ub.default=yD});var PI=D(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});var Wa=te(),vD=he(),bD=_p(),_D={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wa._)`{allowedValues: ${t}}`},wD={keyword:"enum",schemaType:"array",$data:!0,error:_D,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,l=()=>c??(c=(0,vD.useFunc)(e,bD.default)),u;if(a||i)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",o);u=(0,Wa.or)(...n.map((m,h)=>p(f,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,f=>e.if((0,Wa._)`${l()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function p(f,m){let h=n[m];return typeof h=="object"&&h!==null?(0,Wa._)`${l()}(${r}, ${f}[${m}])`:(0,Wa._)`${r} === ${h}`}}};db.default=wD});var zI=D(pb=>{"use strict";Object.defineProperty(pb,"__esModule",{value:!0});var $D=gI(),kD=yI(),xD=_I(),SD=wI(),ID=$I(),TD=kI(),PD=xI(),zD=II(),CD=TI(),RD=PI(),ED=[$D.default,kD.default,xD.default,SD.default,ID.default,TD.default,PD.default,zD.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CD.default,RD.default];pb.default=ED});var mb=D(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.validateAdditionalItems=void 0;var Qn=te(),fb=he(),AD={message:({params:{len:t}})=>(0,Qn.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Qn._)`{limit: ${t}}`},OD={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:AD,code(t){let{parentSchema:e,it:r}=t,{items:i}=e;if(!Array.isArray(i)){(0,fb.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}CI(t,i)}};function CI(t,e){let{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Qn._)`${n}.length`);if(i===!1)t.setParams({len:e.length}),t.pass((0,Qn._)`${a} <= ${e.length}`);else if(typeof i=="object"&&!(0,fb.alwaysValidSchema)(s,i)){let l=r.var("valid",(0,Qn._)`${a} <= ${e.length}`);r.if((0,Qn.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:fb.Type.Num},l),s.allErrors||r.if((0,Qn.not)(l),()=>r.break())})}}Ba.validateAdditionalItems=CI;Ba.default=OD});var hb=D(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.validateTuple=void 0;var RI=te(),wp=he(),ND=Vt(),MD={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return EI(t,"additionalItems",e);r.items=!0,!(0,wp.alwaysValidSchema)(r,e)&&t.ok((0,ND.validateArray)(t))}};function EI(t,e,r=t.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=wp.mergeEvaluated.items(i,r.length,a.items));let c=i.name("valid"),l=i.const("len",(0,RI._)`${o}.length`);r.forEach((d,p)=>{(0,wp.alwaysValidSchema)(a,d)||(i.if((0,RI._)`${l} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},c)),t.ok(c))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,wp.checkStrictMode)(a,y,p.strictTuples)}}}Ja.validateTuple=EI;Ja.default=MD});var AI=D(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0});var jD=hb(),DD={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,jD.validateTuple)(t,"items")};gb.default=DD});var NI=D(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});var OI=te(),UD=he(),LD=Vt(),ZD=mb(),FD={message:({params:{len:t}})=>(0,OI.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,OI._)`{limit: ${t}}`},qD={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:FD,code(t){let{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,!(0,UD.alwaysValidSchema)(i,e)&&(n?(0,ZD.validateAdditionalItems)(t,n):t.ok((0,LD.validateArray)(t)))}};yb.default=qD});var MI=D(vb=>{"use strict";Object.defineProperty(vb,"__esModule",{value:!0});var Wt=te(),$p=he(),VD={message:({params:{min:t,max:e}})=>e===void 0?(0,Wt.str)`must contain at least ${t} valid item(s)`:(0,Wt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Wt._)`{minContains: ${t}}`:(0,Wt._)`{minContains: ${t}, maxContains: ${e}}`},HD={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:VD,code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t,s,a,{minContains:c,maxContains:l}=i;o.opts.next?(s=c===void 0?1:c,a=l):s=1;let u=e.const("len",(0,Wt._)`${n}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,$p.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,$p.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,$p.alwaysValidSchema)(o,r)){let h=(0,Wt._)`${u} >= ${s}`;a!==void 0&&(h=(0,Wt._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Wt._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,u,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:$p.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Wt._)`${h}++`),a===void 0?e.if((0,Wt._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Wt._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Wt._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};vb.default=HD});var UI=D(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.validateSchemaDeps=br.validatePropertyDeps=br.error=void 0;var bb=te(),WD=he(),Ga=Vt();br.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let i=e===1?"property":"properties";return(0,bb.str)`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>(0,bb._)`{property: ${t},
|
|
7
|
+
missingProperty: ${i},
|
|
8
|
+
depsCount: ${e},
|
|
9
|
+
deps: ${r}}`};var BD={keyword:"dependencies",type:"object",schemaType:"object",error:br.error,code(t){let[e,r]=JD(t);jI(t,e),DI(t,r)}};function JD({schema:t}){let e={},r={};for(let i in t){if(i==="__proto__")continue;let n=Array.isArray(t[i])?e:r;n[i]=t[i]}return[e,r]}function jI(t,e=t.schema){let{gen:r,data:i,it:n}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,Ga.propertyInData)(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,Ga.checkReportMissingProp)(t,l)}):(r.if((0,bb._)`${c} && (${(0,Ga.checkMissingProp)(t,a,o)})`),(0,Ga.reportMissingProp)(t,o),r.else())}}br.validatePropertyDeps=jI;function DI(t,e=t.schema){let{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(let a in e)(0,WD.alwaysValidSchema)(o,e[a])||(r.if((0,Ga.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}br.validateSchemaDeps=DI;br.default=BD});var ZI=D(_b=>{"use strict";Object.defineProperty(_b,"__esModule",{value:!0});var LI=te(),GD=he(),KD={message:"property name must be valid",params:({params:t})=>(0,LI._)`{propertyName: ${t.propertyName}}`},XD={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KD,code(t){let{gen:e,schema:r,data:i,it:n}=t;if((0,GD.alwaysValidSchema)(n,r))return;let o=e.name("valid");e.forIn("key",i,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,LI.not)(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}};_b.default=XD});var $b=D(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});var kp=Vt(),ir=te(),YD=Nr(),xp=he(),QD={message:"must NOT have additional properties",params:({params:t})=>(0,ir._)`{additionalProperty: ${t.additionalProperty}}`},eU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:QD,code(t){let{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,xp.alwaysValidSchema)(s,r))return;let l=(0,kp.allSchemaProperties)(i.properties),u=(0,kp.allSchemaProperties)(i.patternProperties);d(),t.ok((0,ir._)`${o} === ${YD.default.errors}`);function d(){e.forIn("key",n,y=>{!l.length&&!u.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let _;if(l.length>8){let $=(0,xp.schemaRefOrVal)(s,i.properties,"properties");_=(0,kp.isOwnProperty)(e,$,y)}else l.length?_=(0,ir.or)(...l.map($=>(0,ir._)`${y} === ${$}`)):_=ir.nil;return u.length&&(_=(0,ir.or)(_,...u.map($=>(0,ir._)`${(0,kp.usePattern)(t,$)}.test(${y})`))),(0,ir.not)(_)}function f(y){e.code((0,ir._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,xp.alwaysValidSchema)(s,r)){let _=e.name("valid");c.removeAdditional==="failing"?(h(y,_,!1),e.if((0,ir.not)(_),()=>{t.reset(),f(y)})):(h(y,_),a||e.if((0,ir.not)(_),()=>e.break()))}}function h(y,_,$){let w={keyword:"additionalProperties",dataProp:y,dataPropType:xp.Type.Str};$===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,_)}}};wb.default=eU});var VI=D(xb=>{"use strict";Object.defineProperty(xb,"__esModule",{value:!0});var tU=Na(),FI=Vt(),kb=he(),qI=$b(),rU={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&qI.default.code(new tU.KeywordCxt(o,qI.default,"additionalProperties"));let s=(0,FI.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=kb.mergeEvaluated.props(e,(0,kb.toHash)(s),o.props));let a=s.filter(d=>!(0,kb.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,FI.propertyInData)(e,n,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};xb.default=rU});var JI=D(Sb=>{"use strict";Object.defineProperty(Sb,"__esModule",{value:!0});var HI=Vt(),Sp=te(),WI=he(),BI=he(),nU={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=(0,HI.allSchemaProperties)(r),c=a.filter(h=>(0,WI.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&n.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof Sp.Name)&&(o.props=(0,BI.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let h of a)l&&f(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function f(h){for(let y in l)new RegExp(h).test(y)&&(0,WI.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",i,y=>{e.if((0,Sp._)`${(0,HI.usePattern)(t,h)}.test(${y})`,()=>{let _=c.includes(h);_||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:BI.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,Sp._)`${d}[${y}]`,!0):!_&&!o.allErrors&&e.if((0,Sp.not)(u),()=>e.break())})})}}};Sb.default=nU});var GI=D(Ib=>{"use strict";Object.defineProperty(Ib,"__esModule",{value:!0});var iU=he(),oU={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:i}=t;if((0,iU.alwaysValidSchema)(i,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Ib.default=oU});var KI=D(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});var sU=Vt(),aU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:sU.validateUnion,error:{message:"must match a schema in anyOf"}};Tb.default=aU});var XI=D(Pb=>{"use strict";Object.defineProperty(Pb,"__esModule",{value:!0});var Ip=te(),cU=he(),lU={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ip._)`{passingSchemas: ${t.passing}}`},uU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lU,code(t){let{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(s,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((u,d)=>{let p;(0,cU.alwaysValidSchema)(n,u)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Ip._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Ip._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Ip.Name)})})}}};Pb.default=uU});var YI=D(zb=>{"use strict";Object.defineProperty(zb,"__esModule",{value:!0});var dU=he(),pU={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((o,s)=>{if((0,dU.alwaysValidSchema)(i,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};zb.default=pU});var tT=D(Cb=>{"use strict";Object.defineProperty(Cb,"__esModule",{value:!0});var Tp=te(),eT=he(),fU={message:({params:t})=>(0,Tp.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Tp._)`{failingKeyword: ${t.ifClause}}`},mU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:fU,code(t){let{gen:e,parentSchema:r,it:i}=t;r.then===void 0&&r.else===void 0&&(0,eT.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=QI(i,"then"),o=QI(i,"else");if(!n&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else n?e.if(a,l("then")):e.if((0,Tp.not)(a),l("else"));t.pass(s,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let p=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,Tp._)`${u}`):t.setParams({ifClause:u})}}}};function QI(t,e){let r=t.schema[e];return r!==void 0&&!(0,eT.alwaysValidSchema)(t,r)}Cb.default=mU});var rT=D(Rb=>{"use strict";Object.defineProperty(Rb,"__esModule",{value:!0});var hU=he(),gU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,hU.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Rb.default=gU});var nT=D(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});var yU=mb(),vU=AI(),bU=hb(),_U=NI(),wU=MI(),$U=UI(),kU=ZI(),xU=$b(),SU=VI(),IU=JI(),TU=GI(),PU=KI(),zU=XI(),CU=YI(),RU=tT(),EU=rT();function AU(t=!1){let e=[TU.default,PU.default,zU.default,CU.default,RU.default,EU.default,kU.default,xU.default,$U.default,SU.default,IU.default];return t?e.push(vU.default,_U.default):e.push(yU.default,bU.default),e.push(wU.default),e}Eb.default=AU});var iT=D(Ab=>{"use strict";Object.defineProperty(Ab,"__esModule",{value:!0});var Ze=te(),OU={message:({schemaCode:t})=>(0,Ze.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ze._)`{format: ${t}}`},NU={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:OU,code(t,e){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Ze._)`${m}[${s}]`),y=r.let("fType"),_=r.let("format");r.if((0,Ze._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Ze._)`${h}.type || "string"`).assign(_,(0,Ze._)`${h}.validate`),()=>r.assign(y,(0,Ze._)`"string"`).assign(_,h)),t.fail$data((0,Ze.or)($(),w()));function $(){return c.strictSchema===!1?Ze.nil:(0,Ze._)`${s} && !${_}`}function w(){let k=u.$async?(0,Ze._)`(${h}.async ? await ${_}(${i}) : ${_}(${i}))`:(0,Ze._)`${_}(${i})`,S=(0,Ze._)`(typeof ${_} == "function" ? ${k} : ${_}.test(${i}))`;return(0,Ze._)`${_} && ${_} !== true && ${y} === ${e} && !${S}`}}function f(){let m=d.formats[o];if(!m){$();return}if(m===!0)return;let[h,y,_]=w(m);h===e&&t.pass(k());function $(){if(c.strictSchema===!1){d.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function w(S){let J=S instanceof RegExp?(0,Ze.regexpCode)(S):c.code.formats?(0,Ze._)`${c.code.formats}${(0,Ze.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:S,code:J});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,Ze._)`${F}.validate`]:["string",S,F]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ze._)`await ${_}(${i})`}return typeof y=="function"?(0,Ze._)`${_}(${i})`:(0,Ze._)`${_}.test(${i})`}}}};Ab.default=NU});var oT=D(Ob=>{"use strict";Object.defineProperty(Ob,"__esModule",{value:!0});var MU=iT(),jU=[MU.default];Ob.default=jU});var sT=D(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.contentVocabulary=Ao.metadataVocabulary=void 0;Ao.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ao.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var cT=D(Nb=>{"use strict";Object.defineProperty(Nb,"__esModule",{value:!0});var DU=hI(),UU=zI(),LU=nT(),ZU=oT(),aT=sT(),FU=[DU.default,UU.default,(0,LU.default)(),ZU.default,aT.metadataVocabulary,aT.contentVocabulary];Nb.default=FU});var uT=D(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.DiscrError=void 0;var lT;(function(t){t.Tag="tag",t.Mapping="mapping"})(lT||(Pp.DiscrError=lT={}))});var pT=D(jb=>{"use strict";Object.defineProperty(jb,"__esModule",{value:!0});var Oo=te(),Mb=uT(),dT=up(),qU=Ma(),VU=he(),HU={message:({params:{discrError:t,tagName:e}})=>t===Mb.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Oo._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},WU={keyword:"discriminator",type:"object",schemaType:"object",error:HU,code(t){let{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,Oo._)`${r}${(0,Oo.getProperty)(a)}`);e.if((0,Oo._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:Mb.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Oo._)`${l} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Mb.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Oo.Name),m}function p(){var f;let m={},h=_(n),y=!0;for(let k=0;k<s.length;k++){let S=s[k];if(S?.$ref&&!(0,VU.schemaHasRulesButRef)(S,o.self.RULES)){let F=S.$ref;if(S=dT.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,F),S instanceof dT.SchemaEnv&&(S=S.schema),S===void 0)throw new qU.default(o.opts.uriResolver,o.baseId,F)}let J=(f=S?.properties)===null||f===void 0?void 0:f[a];if(typeof J!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||_(S)),$(J,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function _({required:k}){return Array.isArray(k)&&k.includes(a)}function $(k,S){if(k.const)w(k.const,S);else if(k.enum)for(let J of k.enum)w(J,S);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(k,S){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=S}}}};jb.default=WU});var fT=D((EG,BU)=>{BU.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 Ub=D((Oe,Db)=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.MissingRefError=Oe.ValidationError=Oe.CodeGen=Oe.Name=Oe.nil=Oe.stringify=Oe.str=Oe._=Oe.KeywordCxt=Oe.Ajv=void 0;var JU=lI(),GU=cT(),KU=pT(),mT=fT(),XU=["/properties"],zp="http://json-schema.org/draft-07/schema",No=class extends JU.default{_addVocabularies(){super._addVocabularies(),GU.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(KU.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(mT,XU):mT;this.addMetaSchema(e,zp,!1),this.refs["http://json-schema.org/schema"]=zp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(zp)?zp:void 0)}};Oe.Ajv=No;Db.exports=Oe=No;Db.exports.Ajv=No;Object.defineProperty(Oe,"__esModule",{value:!0});Oe.default=No;var YU=Na();Object.defineProperty(Oe,"KeywordCxt",{enumerable:!0,get:function(){return YU.KeywordCxt}});var Mo=te();Object.defineProperty(Oe,"_",{enumerable:!0,get:function(){return Mo._}});Object.defineProperty(Oe,"str",{enumerable:!0,get:function(){return Mo.str}});Object.defineProperty(Oe,"stringify",{enumerable:!0,get:function(){return Mo.stringify}});Object.defineProperty(Oe,"nil",{enumerable:!0,get:function(){return Mo.nil}});Object.defineProperty(Oe,"Name",{enumerable:!0,get:function(){return Mo.Name}});Object.defineProperty(Oe,"CodeGen",{enumerable:!0,get:function(){return Mo.CodeGen}});var QU=cp();Object.defineProperty(Oe,"ValidationError",{enumerable:!0,get:function(){return QU.default}});var e4=Ma();Object.defineProperty(Oe,"MissingRefError",{enumerable:!0,get:function(){return e4.default}})});var $T=D(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.formatNames=wr.fastFormats=wr.fullFormats=void 0;function _r(t,e){return{validate:t,compare:e}}wr.fullFormats={date:_r(vT,qb),time:_r(Zb(!0),Vb),"date-time":_r(hT(!0),_T),"iso-time":_r(Zb(),bT),"iso-date-time":_r(hT(),wT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:s4,"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:f4,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:a4,int32:{type:"number",validate:u4},int64:{type:"number",validate:d4},float:{type:"number",validate:yT},double:{type:"number",validate:yT},password:!0,binary:!0};wr.fastFormats={...wr.fullFormats,date:_r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,qb),time:_r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Vb),"date-time":_r(/^\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,_T),"iso-time":_r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bT),"iso-date-time":_r(/^\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,wT),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};wr.formatNames=Object.keys(wr.fullFormats);function t4(t){return t%4===0&&(t%100!==0||t%400===0)}var r4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function vT(t){let e=r4.exec(t);if(!e)return!1;let r=+e[1],i=+e[2],n=+e[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&t4(r)?29:n4[i])}function qb(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Lb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Zb(t){return function(r){let i=Lb.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],a=i[4],c=i[5]==="-"?-1:1,l=+(i[6]||0),u=+(i[7]||0);if(l>23||u>59||t&&!a)return!1;if(n<=23&&o<=59&&s<60)return!0;let d=o-u*c,p=n-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&s<61}}function Vb(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+e).valueOf();if(r&&i)return r-i}function bT(t,e){if(!(t&&e))return;let r=Lb.exec(t),i=Lb.exec(e);if(r&&i)return t=r[1]+r[2]+r[3],e=i[1]+i[2]+i[3],t>e?1:t<e?-1:0}var Fb=/t|\s/i;function hT(t){let e=Zb(t);return function(i){let n=i.split(Fb);return n.length===2&&vT(n[0])&&e(n[1])}}function _T(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),i=new Date(e).valueOf();if(r&&i)return r-i}function wT(t,e){if(!(t&&e))return;let[r,i]=t.split(Fb),[n,o]=e.split(Fb),s=qb(r,n);if(s!==void 0)return s||Vb(i,o)}var i4=/\/|:/,o4=/^(?:[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 s4(t){return i4.test(t)&&o4.test(t)}var gT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function a4(t){return gT.lastIndex=0,gT.test(t)}var c4=-(2**31),l4=2**31-1;function u4(t){return Number.isInteger(t)&&t<=l4&&t>=c4}function d4(t){return Number.isInteger(t)}function yT(){return!0}var p4=/[^\\]\\Z/;function f4(t){if(p4.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var kT=D(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.formatLimitDefinition=void 0;var m4=Ub(),or=te(),wn=or.operators,Cp={formatMaximum:{okStr:"<=",ok:wn.LTE,fail:wn.GT},formatMinimum:{okStr:">=",ok:wn.GTE,fail:wn.LT},formatExclusiveMaximum:{okStr:"<",ok:wn.LT,fail:wn.GTE},formatExclusiveMinimum:{okStr:">",ok:wn.GT,fail:wn.LTE}},h4={message:({keyword:t,schemaCode:e})=>(0,or.str)`should be ${Cp[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,or._)`{comparison: ${Cp[t].okStr}, limit: ${e}}`};jo.formatLimitDefinition={keyword:Object.keys(Cp),type:"string",schemaType:"string",$data:!0,error:h4,code(t){let{gen:e,data:r,schemaCode:i,keyword:n,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new m4.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let p=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),f=e.const("fmt",(0,or._)`${p}[${c.schemaCode}]`);t.fail$data((0,or.or)((0,or._)`typeof ${f} != "object"`,(0,or._)`${f} instanceof RegExp`,(0,or._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:s.code.formats?(0,or._)`${s.code.formats}${(0,or.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,or._)`${p}.compare(${r}, ${i}) ${Cp[n].fail} 0`}},dependencies:["format"]};var g4=t=>(t.addKeyword(jo.formatLimitDefinition),t);jo.default=g4});var TT=D((Ka,IT)=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var Do=$T(),y4=kT(),Hb=te(),xT=new Hb.Name("fullFormats"),v4=new Hb.Name("fastFormats"),Wb=(t,e={keywords:!0})=>{if(Array.isArray(e))return ST(t,e,Do.fullFormats,xT),t;let[r,i]=e.mode==="fast"?[Do.fastFormats,v4]:[Do.fullFormats,xT],n=e.formats||Do.formatNames;return ST(t,n,r,i),e.keywords&&(0,y4.default)(t),t};Wb.get=(t,e="full")=>{let i=(e==="fast"?Do.fastFormats:Do.fullFormats)[t];if(!i)throw new Error(`Unknown format "${t}"`);return i};function ST(t,e,r,i){var n,o;(n=(o=t.opts.code).formats)!==null&&n!==void 0||(o.formats=(0,Hb._)`require("ajv-formats/dist/formats").${i}`);for(let s of e)t.addFormat(s,r[s])}IT.exports=Ka=Wb;Object.defineProperty(Ka,"__esModule",{value:!0});Ka.default=Wb});import*as mC from"node:fs";import*as Ic from"node:path";import{fileURLToPath as X2}from"node:url";import{parseArgs as Y2}from"node:util";import{stdout as DC,stdin as UC}from"node:process";import*as Vr from"node:readline";var sw=(()=>{let t=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return e=>{let r=0;for(t.lastIndex=0;t.test(e);)r+=1;return e.length-r}})(),aw=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,cw=t=>t===8987||t===9001||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t>=131072&&t<=196605||t>=196608&&t<=262141;var $C=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kC=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,lw=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,xC=/\t{1,1000}/y,uw=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,SC=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,IC=/\p{M}+/gu,TC={limit:1/0,ellipsis:""},dw=(t,e={},r={})=>{let i=e.limit??1/0,n=e.ellipsis??"",o=e?.ellipsisWidth??(n?dw(n,TC,r).width:0),s=0,a=r.controlWidth??0,c=r.tabWidth??8,l=r.emojiWidth??2,u=2,d=r.regularWidth??1,p=r.wideWidth??u,f=[[SC,d],[$C,s],[kC,a],[xC,c],[uw,l],[lw,p]],m=0,h=0,y=t.length,_=0,$=!1,w=y,k=Math.max(0,i-o),S=0,J=0,F=0,P=0;e:for(;;){if(J>S||h>=y&&h>m){let se=t.slice(S,J)||t.slice(m,h);_=0;for(let ue of se.replaceAll(IC,"")){let ae=ue.codePointAt(0)||0;if(aw(ae)?P=u:cw(ae)?P=p:P=d,F+P>k&&(w=Math.min(w,Math.max(S,m)+_)),F+P>i){$=!0;break e}_+=ue.length,F+=P}S=J=0}if(h>=y)break e;for(let se=0,ue=f.length;se<ue;se++){let[ae,Me]=f[se];if(ae.lastIndex=h,ae.test(t)){if(_=ae===lw?sw(t.slice(h,ae.lastIndex)):ae===uw?1:ae.lastIndex-h,P=_*Me,F+P>k&&(w=Math.min(w,h+Math.floor((k-F)/Me))),F+P>i){$=!0;break e}F+=P,S=m,J=h,h=m=ae.lastIndex;continue e}}h+=1}return{width:$?k:F,index:$?w:y,truncated:$,ellipsed:$&&i>=o}},pw=dw;var PC={limit:1/0,ellipsis:"",ellipsisWidth:0},zC=(t,e={})=>pw(t,PC,e).width,dt=zC;var Cc="\x1B",yw="\x9B",CC=39,Uf="\x07",vw="[",RC="]",bw="m",Lf=`${RC}8;;`,fw=new RegExp(`(?:\\${vw}(?<code>\\d+)m|\\${Lf}(?<uri>.*)${Uf})`,"y"),mw=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},hw=t=>`${Cc}${vw}${t}${bw}`,gw=t=>`${Cc}${Lf}${t}${Uf}`,Df=(t,e,r)=>{let i=e[Symbol.iterator](),n=!1,o=!1,s=t.at(-1),a=s===void 0?0:dt(s),c=i.next(),l=i.next(),u=0;for(;!c.done;){let d=c.value,p=dt(d);a+p<=r?t[t.length-1]+=d:(t.push(d),a=0),(d===Cc||d===yw)&&(n=!0,o=e.startsWith(Lf,u+1)),n?o?d===Uf&&(n=!1,o=!1):d===bw&&(n=!1):(a+=p,a===r&&!l.done&&(t.push(""),a=0)),c=l,l=i.next(),u+=d.length}s=t.at(-1),!a&&s!==void 0&&s.length&&t.length>1&&(t[t.length-2]+=t.pop())},EC=t=>{let e=t.split(" "),r=e.length;for(;r&&!dt(e[r-1]);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},AC=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let i="",n,o,s=t.split(" "),a=[""],c=0;for(let d=0;d<s.length;d++){let p=s[d];if(r.trim!==!1){let m=a.at(-1)??"",h=m.trimStart();m.length!==h.length&&(a[a.length-1]=h,c=dt(h))}d!==0&&(c>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c||r.trim===!1)&&(a[a.length-1]+=" ",c++));let f=dt(p);if(r.hard&&f>e){let m=e-c,h=1+Math.floor((f-m-1)/e);Math.floor((f-1)/e)<h&&a.push(""),Df(a,p,e),c=dt(a.at(-1)??"");continue}if(c+f>e&&c&&f){if(r.wordWrap===!1&&c<e){Df(a,p,e),c=dt(a.at(-1)??"");continue}a.push(""),c=0}if(c+f>e&&r.wordWrap===!1){Df(a,p,e),c=dt(a.at(-1)??"");continue}a[a.length-1]+=p,c+=f}r.trim!==!1&&(a=a.map(d=>EC(d)));let l=a.join(`
|
|
10
|
+
`),u=!1;for(let d=0;d<l.length;d++){let p=l[d];if(i+=p,u)u=!1;else if(u=p>="\uD800"&&p<="\uDBFF",u)continue;if(p===Cc||p===yw){fw.lastIndex=d+1;let m=fw.exec(l)?.groups;if(m?.code!==void 0){let h=Number.parseFloat(m.code);n=h===CC?void 0:h}else m?.uri!==void 0&&(o=m.uri.length===0?void 0:m.uri)}if(l[d+1]===`
|
|
11
|
+
`){o&&(i+=gw(""));let f=n?mw(n):void 0;n&&f&&(i+=hw(f))}else p===`
|
|
12
|
+
`&&(n&&mw(n)&&(i+=hw(n)),o&&(i+=gw(o)))}return i},OC=/\r?\n/;function hi(t,e,r){return String(t).normalize().split(OC).map(i=>AC(i,e,r)).join(`
|
|
13
|
+
`)}var Ko=zc(qf(),1);import{ReadStream as ww}from"node:tty";var LC=["up","down","left","right","space","enter","cancel"],ZC=["January","February","March","April","May","June","July","August","September","October","November","December"],lr={actions:new Set(LC),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...ZC],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(t,e)=>`There are only ${t} days in ${e}`,afterMin:t=>`Date must be on or after ${t.toISOString().slice(0,10)}`,beforeMax:t=>`Date must be on or before ${t.toISOString().slice(0,10)}`}}};function $w(t,e){if(typeof t=="string")return lr.aliases.get(t)===e;for(let r of t)if(r!==void 0&&$w(r,e))return!0;return!1}var FC=globalThis.process.platform.startsWith("win"),bF=Symbol("clack:cancel");function kw({input:t=UC,output:e=DC,overwrite:r=!0,hideCursor:i=!0}={}){let n=Vr.createInterface({input:t,output:e,prompt:"",tabSize:1});Vr.emitKeypressEvents(t,n),t instanceof ww&&t.isTTY&&t.setRawMode(!0);let o=(s,{name:a,sequence:c})=>{let l=String(s);if($w([l,a,c],"cancel")){i&&e.write(Ko.cursor.show),process.exit(0);return}if(!r)return;Vr.moveCursor(e,a==="return"?0:-1,a==="return"?-1:0,()=>{Vr.clearLine(e,1,()=>{t.once("keypress",o)})})};return i&&e.write(Ko.cursor.hide),t.once("keypress",o),()=>{t.off("keypress",o),i&&e.write(Ko.cursor.show),t instanceof ww&&t.isTTY&&!FC&&t.setRawMode(!1),n.terminal=!1,n.close()}}var Vf=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80;import{styleText as He,stripVTControlCharacters as jF}from"node:util";import Dt from"node:process";var Xo=zc(qf(),1);function VC(){return Dt.platform!=="win32"?Dt.env.TERM!=="linux":!!Dt.env.CI||!!Dt.env.WT_SESSION||!!Dt.env.TERMINUS_SUBLIME||Dt.env.ConEmuTask==="{cmd::Cmder}"||Dt.env.TERM_PROGRAM==="Terminus-Sublime"||Dt.env.TERM_PROGRAM==="vscode"||Dt.env.TERM==="xterm-256color"||Dt.env.TERM==="alacritty"||Dt.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Hf=VC(),HC=()=>process.env.CI==="true";var xe=(t,e)=>Hf?t:e,ZF=xe("\u25C6","*"),WC=xe("\u25A0","x"),BC=xe("\u25B2","x"),Sw=xe("\u25C7","o"),JC=xe("\u250C","T"),gi=xe("\u2502","|"),Iw=xe("\u2514","\u2014"),FF=xe("\u2510","T"),qF=xe("\u2518","\u2014"),VF=xe("\u25CF",">"),HF=xe("\u25CB"," "),WF=xe("\u25FB","[\u2022]"),BF=xe("\u25FC","[+]"),JF=xe("\u25FB","[ ]"),GF=xe("\u25AA","\u2022"),xw=xe("\u2500","-"),GC=xe("\u256E","+"),KC=xe("\u251C","+"),XC=xe("\u256F","+"),YC=xe("\u2570","+"),KF=xe("\u256D","+"),XF=xe("\u25CF","\u2022"),YF=xe("\u25C6","*"),QF=xe("\u25B2","!"),eq=xe("\u25A0","x");var Wf=(t="",e)=>{let r=e?.output??process.stdout,i=e?.withGuide??lr.withGuide?`${He("gray",Iw)} `:"";r.write(`${i}${He("red",t)}
|
|
14
|
+
|
|
15
|
+
`)},Tw=(t="",e)=>{let r=e?.output??process.stdout,i=e?.withGuide??lr.withGuide?`${He("gray",JC)} `:"";r.write(`${i}${t}
|
|
16
|
+
`)},Pw=(t="",e)=>{let r=e?.output??process.stdout,i=e?.withGuide??lr.withGuide?`${He("gray",gi)}
|
|
17
|
+
${He("gray",Iw)} `:"";r.write(`${i}${t}
|
|
18
|
+
|
|
19
|
+
`)};var QC=t=>He("dim",t),eR=(t,e,r)=>{let i={hard:!0,trim:!1},n=hi(t,e,i).split(`
|
|
20
|
+
`),o=n.reduce((c,l)=>Math.max(dt(l),c),0),s=n.map(r).reduce((c,l)=>Math.max(dt(l),c),0),a=e-(s-o);return hi(t,a,i)},zw=(t="",e="",r)=>{let i=r?.output??Dt.stdout,n=r?.withGuide??lr.withGuide,o=r?.format??QC,s=["",...eR(t,Vf(i)-6,o).split(`
|
|
21
|
+
`).map(o),""],a=dt(e),c=Math.max(s.reduce((p,f)=>{let m=dt(f);return m>p?m:p},0),a)+2,l=s.map(p=>`${He("gray",gi)} ${p}${" ".repeat(c-dt(p))}${He("gray",gi)}`).join(`
|
|
22
|
+
`),u=n?`${He("gray",gi)}
|
|
23
|
+
`:"",d=n?KC:YC;i.write(`${u}${He("green",Sw)} ${He("reset",e)} ${He("gray",xw.repeat(Math.max(c-a-1,1))+GC)}
|
|
24
|
+
${l}
|
|
25
|
+
${He("gray",d+xw.repeat(c+2)+XC)}
|
|
26
|
+
`)};var tR=t=>He("magenta",t),Cw=({indicator:t="dots",onCancel:e,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:o=Hf?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:s=Hf?80:120,signal:a,...c}={})=>{let l=HC(),u,d,p=!1,f=!1,m="",h,y=performance.now(),_=Vf(r),$=c?.styleFrame??tR,w=ie=>{let qe=ie>1?n??lr.messages.error:i??lr.messages.cancel;f=ie===1,p&&(je(qe,ie),f&&typeof e=="function"&&e())},k=()=>w(2),S=()=>w(1),J=()=>{process.on("uncaughtExceptionMonitor",k),process.on("unhandledRejection",k),process.on("SIGINT",S),process.on("SIGTERM",S),process.on("exit",w),a&&a.addEventListener("abort",S)},F=()=>{process.removeListener("uncaughtExceptionMonitor",k),process.removeListener("unhandledRejection",k),process.removeListener("SIGINT",S),process.removeListener("SIGTERM",S),process.removeListener("exit",w),a&&a.removeEventListener("abort",S)},P=()=>{if(h===void 0)return;l&&r.write(`
|
|
27
|
+
`);let ie=hi(h,_,{hard:!0,trim:!1}).split(`
|
|
28
|
+
`);ie.length>1&&r.write(Xo.cursor.up(ie.length-1)),r.write(Xo.cursor.to(0)),r.write(Xo.erase.down())},se=ie=>ie.replace(/\.+$/,""),ue=ie=>{let qe=(performance.now()-ie)/1e3,Ve=Math.floor(qe/60),We=Math.floor(qe%60);return Ve>0?`[${Ve}m ${We}s]`:`[${We}s]`},ae=c.withGuide??lr.withGuide,Me=(ie="")=>{p=!0,u=kw({output:r}),m=se(ie),y=performance.now(),ae&&r.write(`${He("gray",gi)}
|
|
29
|
+
`);let qe=0,Ve=0;J(),d=setInterval(()=>{if(l&&m===h)return;P(),h=m;let We=$(o[qe]),Et;if(l)Et=`${We} ${m}...`;else if(t==="timer")Et=`${We} ${m} ${ue(y)}`;else{let de=".".repeat(Math.floor(Ve)).slice(0,3);Et=`${We} ${m}${de}`}let j=hi(Et,_,{hard:!0,trim:!1});r.write(j),qe=qe+1<o.length?qe+1:0,Ve=Ve<4?Ve+.125:0},s)},je=(ie="",qe=0,Ve=!1)=>{if(!p)return;p=!1,clearInterval(d),P();let We=qe===0?He("green",Sw):qe===1?He("red",WC):He("red",BC);m=ie??m,Ve||(t==="timer"?r.write(`${We} ${m} ${ue(y)}
|
|
30
|
+
`):r.write(`${We} ${m}
|
|
31
|
+
`)),F(),u()};return{start:Me,stop:(ie="")=>je(ie,0),message:(ie="")=>{m=se(ie??m)},cancel:(ie="")=>je(ie,1),error:(ie="")=>je(ie,2),clear:()=>je("",0,!0),get isCancelled(){return f}}},tq={light:xe("\u2500","-"),heavy:xe("\u2501","="),block:xe("\u2588","#")};var rq=`${He("gray",gi)} `;import*as At from"node:fs";import*as Rw from"node:os";import*as Jf from"node:path";var Bf=Jf.join(Rw.homedir(),".gigabuddy"),rR={shared:{prod:"credentials.json",staging:"credentials.staging.json"},user:{prod:"user-credentials.json",staging:"user-credentials.staging.json"},agent:{prod:"agent-credentials.json",staging:"agent-credentials.staging.json"}};function Yo(t=!1,e="shared"){let r=rR[e];return Jf.join(Bf,t?r.staging:r.prod)}function Gf(t=!1,e="shared"){try{let r=At.readFileSync(Yo(t,e),"utf-8"),i=JSON.parse(r);return i.refreshToken?i:null}catch{return null}}function Kf(t,e=!1,r="shared"){At.existsSync(Bf)||At.mkdirSync(Bf,{recursive:!0,mode:448}),Ow(Yo(e,r),JSON.stringify(t,null,2))}function Ew(t=!1,e="shared"){let r=Yo(t,e);At.existsSync(r)&&At.unlinkSync(r)}function Aw(t,e=!1,r="shared"){let i=Gf(e,r);i&&(i.refreshToken=t,Kf(i,e,r))}function Ow(t,e){At.writeFileSync(t,e,{mode:384});try{At.chmodSync(t,384)}catch{}}var le;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of o)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=i,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(le||(le={}));var Nw;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Nw||(Nw={}));var L=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Sr=t=>{switch(typeof t){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN(t)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(t)?L.array:t===null?L.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?L.promise:typeof Map<"u"&&t instanceof Map?L.map:typeof Set<"u"&&t instanceof Set?L.set:typeof Date<"u"&&t instanceof Date?L.date:L.object;default:return L.unknown}};var z=le.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"]);var Ot=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let a=i,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return n(this),i}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),i=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Ot.create=t=>new Ot(t);var nR=(t,e)=>{let r;switch(t.code){case z.invalid_type:t.received===L.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case z.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,le.assertNever(t)}return{message:r}},Hr=nR;var iR=Hr;function Qo(){return iR}var Rc=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let a="",c=i.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...n,path:o,message:a}};function N(t,e){let r=Qo(),i=Rc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Hr?void 0:Hr].filter(n=>!!n)});t.common.issues.push(i)}var st=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return W;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return W;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}},W=Object.freeze({status:"aborted"}),yi=t=>({status:"dirty",value:t}),pt=t=>({status:"valid",value:t}),Xf=t=>t.status==="aborted",Yf=t=>t.status==="dirty",Pn=t=>t.status==="valid",es=t=>typeof Promise<"u"&&t instanceof Promise;var q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(q||(q={}));var Ut=class{constructor(e,r,i,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Mw=(t,e)=>{if(Pn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ot(t.common.issues);return this._error=r,this._error}}};function X(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var re=class{get description(){return this._def.description}_getType(e){return Sr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new st,ctx:{common:e.parent.common,data:e.data,parsedType:Sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(es(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Sr(e)},n=this._parseSync({data:e,path:i.path,parent:i});return Mw(i,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Sr(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return Pn(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>Pn(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Sr(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(es(n)?n:Promise.resolve(n));return Mw(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=e(n),a=()=>o.addIssue({code:z.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new Gt({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Jt.create(this,this._def)}nullable(){return Pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Br.create(this)}promise(){return zn.create(this,this._def)}or(e){return $i.create([this,e],this._def)}and(e){return ki.create(this,e,this._def)}transform(e){return new Gt({...X(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Pi({...X(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new Ec({typeName:C.ZodBranded,type:this,...X(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zi({...X(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ac.create(this,e)}readonly(){return Ci.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},oR=/^c[^\s-]{8,}$/i,sR=/^[0-9a-z]+$/,aR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cR=/^[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,lR=/^[a-z0-9_-]{21}$/i,uR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dR=/^[-+]?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)?)??$/,pR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qf,mR=/^(?:(?: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])$/,hR=/^(?:(?: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])$/,gR=/^(([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]))$/,yR=/^(([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])$/,vR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jw="((\\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])))",_R=new RegExp(`^${jw}$`);function Dw(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function wR(t){return new RegExp(`^${Dw(t)}$`)}function $R(t){let e=`${jw}T${Dw(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function kR(t,e){return!!((e==="v4"||!e)&&mR.test(t)||(e==="v6"||!e)&&gR.test(t))}function xR(t,e){if(!uR.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function SR(t,e){return!!((e==="v4"||!e)&&hR.test(t)||(e==="v6"||!e)&&yR.test(t))}var bi=class t extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){let o=this._getOrReturnCtx(e);return N(o,{code:z.invalid_type,expected:L.string,received:o.parsedType}),W}let i=new st,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),N(n,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),N(n,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?N(n,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&N(n,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")pR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"email",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")Qf||(Qf=new RegExp(fR,"u")),Qf.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"emoji",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")cR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"uuid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")lR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"nanoid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")oR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"cuid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")sR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"cuid2",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")aR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"ulid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),N(n,{validation:"url",code:z.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"regex",code:z.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?$R(o).test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?_R.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?wR(o).test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:z.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?dR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"duration",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?kR(e.data,o.version)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"ip",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?xR(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"jwt",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?SR(e.data,o.version)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"cidr",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?vR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"base64",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?bR.test(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{validation:"base64url",code:z.invalid_string,message:o.message}),i.dirty()):le.assertNever(o);return{status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(n=>e.test(n),{validation:r,code:z.invalid_string,...q.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...q.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...q.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...q.errToObj(r)})}nonempty(e){return this.min(1,q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};bi.create=t=>new bi({checks:[],typeName:C.ZodString,coerce:t?.coerce??!1,...X(t)});function IR(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}var ts=class t extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==L.number){let o=this._getOrReturnCtx(e);return N(o,{code:z.invalid_type,expected:L.number,received:o.parsedType}),W}let i,n=new st;for(let o of this._def.checks)o.kind==="int"?le.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),N(i,{code:z.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?IR(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),N(i,{code:z.not_finite,message:o.message}),n.dirty()):le.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,q.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:q.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ts.create=t=>new ts({checks:[],typeName:C.ZodNumber,coerce:t?.coerce||!1,...X(t)});var rs=class t extends re{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)!==L.bigint)return this._getInvalidInput(e);let i,n=new st;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),N(i,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):le.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return N(r,{code:z.invalid_type,expected:L.bigint,received:r.parsedType}),W}gte(e,r){return this.setLimit("min",e,!0,q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,q.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:q.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};rs.create=t=>new rs({checks:[],typeName:C.ZodBigInt,coerce:t?.coerce??!1,...X(t)});var ns=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.boolean,received:i.parsedType}),W}return pt(e.data)}};ns.create=t=>new ns({typeName:C.ZodBoolean,coerce:t?.coerce||!1,...X(t)});var is=class t extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){let o=this._getOrReturnCtx(e);return N(o,{code:z.invalid_type,expected:L.date,received:o.parsedType}),W}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return N(o,{code:z.invalid_date}),W}let i=new st,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),N(n,{code:z.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),N(n,{code:z.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):le.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};is.create=t=>new is({checks:[],coerce:t?.coerce||!1,typeName:C.ZodDate,...X(t)});var os=class extends re{_parse(e){if(this._getType(e)!==L.symbol){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.symbol,received:i.parsedType}),W}return pt(e.data)}};os.create=t=>new os({typeName:C.ZodSymbol,...X(t)});var _i=class extends re{_parse(e){if(this._getType(e)!==L.undefined){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.undefined,received:i.parsedType}),W}return pt(e.data)}};_i.create=t=>new _i({typeName:C.ZodUndefined,...X(t)});var wi=class extends re{_parse(e){if(this._getType(e)!==L.null){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.null,received:i.parsedType}),W}return pt(e.data)}};wi.create=t=>new wi({typeName:C.ZodNull,...X(t)});var ss=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}};ss.create=t=>new ss({typeName:C.ZodAny,...X(t)});var Wr=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}};Wr.create=t=>new Wr({typeName:C.ZodUnknown,...X(t)});var ur=class extends re{_parse(e){let r=this._getOrReturnCtx(e);return N(r,{code:z.invalid_type,expected:L.never,received:r.parsedType}),W}};ur.create=t=>new ur({typeName:C.ZodNever,...X(t)});var as=class extends re{_parse(e){if(this._getType(e)!==L.undefined){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.void,received:i.parsedType}),W}return pt(e.data)}};as.create=t=>new as({typeName:C.ZodVoid,...X(t)});var Br=class t extends re{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==L.array)return N(r,{code:z.invalid_type,expected:L.array,received:r.parsedType}),W;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(N(r,{code:s?z.too_big:z.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(N(r,{code:z.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(N(r,{code:z.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Ut(r,s,r.path,a)))).then(s=>st.mergeArray(i,s));let o=[...r.data].map((s,a)=>n.type._parseSync(new Ut(r,s,r.path,a)));return st.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:q.toString(r)}})}nonempty(e){return this.min(1,e)}};Br.create=(t,e)=>new Br({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...X(e)});function vi(t){if(t instanceof Nt){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Jt.create(vi(i))}return new Nt({...t._def,shape:()=>e})}else return t instanceof Br?new Br({...t._def,type:vi(t.element)}):t instanceof Jt?Jt.create(vi(t.unwrap())):t instanceof Pr?Pr.create(vi(t.unwrap())):t instanceof Tr?Tr.create(t.items.map(e=>vi(e))):t}var Nt=class t extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==L.object){let l=this._getOrReturnCtx(e);return N(l,{code:z.invalid_type,expected:L.object,received:l.parsedType}),W}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ur&&this._def.unknownKeys==="strip"))for(let l in n.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let u=o[l],d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ut(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof ur){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")a.length>0&&(N(n,{code:z.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ut(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>st.mergeObjectSync(i,l)):st.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(e){return q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:q.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let i of le.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let i of le.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}deepPartial(){return vi(this)}partial(e){let r={};for(let i of le.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?r[i]=n:r[i]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let i of le.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof Jt;)o=o._def.innerType;r[i]=o}return new t({...this._def,shape:()=>r})}keyof(){return Uw(le.objectKeys(this.shape))}};Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:ur.create(),typeName:C.ZodObject,...X(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:ur.create(),typeName:C.ZodObject,...X(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:ur.create(),typeName:C.ZodObject,...X(e)});var $i=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Ot(a.ctx.common.issues));return N(r,{code:z.invalid_union,unionErrors:s}),W}if(r.common.async)return Promise.all(i.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let c of i){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Ot(c));return N(r,{code:z.invalid_union,unionErrors:a}),W}}get options(){return this._def.options}};$i.create=(t,e)=>new $i({options:t,typeName:C.ZodUnion,...X(e)});var Ir=t=>t instanceof xi?Ir(t.schema):t instanceof Gt?Ir(t.innerType()):t instanceof Si?[t.value]:t instanceof Ii?t.options:t instanceof Ti?le.objectValues(t.enum):t instanceof Pi?Ir(t._def.innerType):t instanceof _i?[void 0]:t instanceof wi?[null]:t instanceof Jt?[void 0,...Ir(t.unwrap())]:t instanceof Pr?[null,...Ir(t.unwrap())]:t instanceof Ec||t instanceof Ci?Ir(t.unwrap()):t instanceof zi?Ir(t._def.innerType):[],em=class t extends re{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.object)return N(r,{code:z.invalid_type,expected:L.object,received:r.parsedType}),W;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(N(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),W)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let n=new Map;for(let o of r){let s=Ir(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,o)}}return new t({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...X(i)})}};function tm(t,e){let r=Sr(t),i=Sr(e);if(t===e)return{valid:!0,data:t};if(r===L.object&&i===L.object){let n=le.objectKeys(e),o=le.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=tm(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===L.array&&i===L.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=tm(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===L.date&&i===L.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ki=class extends re{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,s)=>{if(Xf(o)||Xf(s))return W;let a=tm(o.value,s.value);return a.valid?((Yf(o)||Yf(s))&&r.dirty(),{status:r.value,value:a.data}):(N(i,{code:z.invalid_intersection_types}),W)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};ki.create=(t,e,r)=>new ki({left:t,right:e,typeName:C.ZodIntersection,...X(r)});var Tr=class t extends re{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==L.array)return N(i,{code:z.invalid_type,expected:L.array,received:i.parsedType}),W;if(i.data.length<this._def.items.length)return N(i,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W;!this._def.rest&&i.data.length>this._def.items.length&&(N(i,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ut(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>st.mergeArray(r,s)):st.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Tr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Tr({items:t,typeName:C.ZodTuple,rest:null,...X(e)})};var rm=class t extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==L.object)return N(i,{code:z.invalid_type,expected:L.object,received:i.parsedType}),W;let n=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)n.push({key:o._parse(new Ut(i,a,i.path,a)),value:s._parse(new Ut(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?st.mergeObjectAsync(r,n):st.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof re?new t({keyType:e,valueType:r,typeName:C.ZodRecord,...X(i)}):new t({keyType:bi.create(),valueType:e,typeName:C.ZodRecord,...X(r)})}},cs=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==L.map)return N(i,{code:z.invalid_type,expected:L.map,received:i.parsedType}),W;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,c],l)=>({key:n._parse(new Ut(i,a,i.path,[l,"key"])),value:o._parse(new Ut(i,c,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return W;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return W;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};cs.create=(t,e,r)=>new cs({valueType:e,keyType:t,typeName:C.ZodMap,...X(r)});var ls=class t extends re{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==L.set)return N(i,{code:z.invalid_type,expected:L.set,received:i.parsedType}),W;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(N(i,{code:z.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(N(i,{code:z.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return W;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...i.data.values()].map((c,l)=>o._parse(new Ut(i,c,i.path,l)));return i.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ls.create=(t,e)=>new ls({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...X(e)});var nm=class t extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.function)return N(r,{code:z.invalid_type,expected:L.function,received:r.parsedType}),W;function i(a,c){return Rc({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qo(),Hr].filter(l=>!!l),issueData:{code:z.invalid_arguments,argumentsError:c}})}function n(a,c){return Rc({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qo(),Hr].filter(l=>!!l),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof zn){let a=this;return pt(async function(...c){let l=new Ot([]),u=await a._def.args.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw l.addIssue(n(d,f)),l})})}else{let a=this;return pt(function(...c){let l=a._def.args.safeParse(c,o);if(!l.success)throw new Ot([i(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new Ot([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Tr.create(e).rest(Wr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new t({args:e||Tr.create([]).rest(Wr.create()),returns:r||Wr.create(),typeName:C.ZodFunction,...X(i)})}},xi=class extends re{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};xi.create=(t,e)=>new xi({getter:t,typeName:C.ZodLazy,...X(e)});var Si=class extends re{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return N(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),W}return{status:"valid",value:e.data}}get value(){return this._def.value}};Si.create=(t,e)=>new Si({value:t,typeName:C.ZodLiteral,...X(e)});function Uw(t,e){return new Ii({values:t,typeName:C.ZodEnum,...X(e)})}var Ii=class t extends re{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return N(r,{expected:le.joinValues(i),received:r.parsedType,code:z.invalid_type}),W}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return N(r,{received:r.data,code:z.invalid_enum_value,options:i}),W}return pt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}};Ii.create=Uw;var Ti=class extends re{_parse(e){let r=le.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==L.string&&i.parsedType!==L.number){let n=le.objectValues(r);return N(i,{expected:le.joinValues(n),received:i.parsedType,code:z.invalid_type}),W}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=le.objectValues(r);return N(i,{received:i.data,code:z.invalid_enum_value,options:n}),W}return pt(e.data)}get enum(){return this._def.values}};Ti.create=(t,e)=>new Ti({values:t,typeName:C.ZodNativeEnum,...X(e)});var zn=class extends re{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==L.promise&&r.common.async===!1)return N(r,{code:z.invalid_type,expected:L.promise,received:r.parsedType}),W;let i=r.parsedType===L.promise?r.data:Promise.resolve(r.data);return pt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};zn.create=(t,e)=>new zn({type:t,typeName:C.ZodPromise,...X(e)});var Gt=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:s=>{N(i,s),s.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return W;let c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?W:c.status==="dirty"?yi(c.value):r.value==="dirty"?yi(c.value):c});{if(r.value==="aborted")return W;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?W:a.status==="dirty"?yi(a.value):r.value==="dirty"?yi(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?W:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?W:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Pn(s))return W;let a=n.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>Pn(s)?Promise.resolve(n.transform(s.value,o)).then(a=>({status:r.value,value:a})):W);le.assertNever(n)}};Gt.create=(t,e,r)=>new Gt({schema:t,typeName:C.ZodEffects,effect:e,...X(r)});Gt.createWithPreprocess=(t,e,r)=>new Gt({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...X(r)});var Jt=class extends re{_parse(e){return this._getType(e)===L.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jt.create=(t,e)=>new Jt({innerType:t,typeName:C.ZodOptional,...X(e)});var Pr=class extends re{_parse(e){return this._getType(e)===L.null?pt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pr.create=(t,e)=>new Pr({innerType:t,typeName:C.ZodNullable,...X(e)});var Pi=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===L.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pi.create=(t,e)=>new Pi({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...X(e)});var zi=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return es(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ot(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ot(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};zi.create=(t,e)=>new zi({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...X(e)});var us=class extends re{_parse(e){if(this._getType(e)!==L.nan){let i=this._getOrReturnCtx(e);return N(i,{code:z.invalid_type,expected:L.nan,received:i.parsedType}),W}return{status:"valid",value:e.data}}};us.create=t=>new us({typeName:C.ZodNaN,...X(t)});var kq=Symbol("zod_brand"),Ec=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},Ac=class t extends re{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?W:o.status==="dirty"?(r.dirty(),yi(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?W:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,r){return new t({in:e,out:r,typeName:C.ZodPipeline})}},Ci=class extends re{_parse(e){let r=this._def.innerType._parse(e),i=n=>(Pn(n)&&(n.value=Object.freeze(n.value)),n);return es(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};Ci.create=(t,e)=>new Ci({innerType:t,typeName:C.ZodReadonly,...X(e)});var xq={object:Nt.lazycreate},C;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(C||(C={}));var Sq=bi.create,Iq=ts.create,Tq=us.create,Pq=rs.create,zq=ns.create,Cq=is.create,Rq=os.create,Eq=_i.create,Aq=wi.create,Oq=ss.create,Nq=Wr.create,Mq=ur.create,jq=as.create,Dq=Br.create,Lw=Nt.create,Uq=Nt.strictCreate,Lq=$i.create,Zq=em.create,Fq=ki.create,qq=Tr.create,Vq=rm.create,Hq=cs.create,Wq=ls.create,Bq=nm.create,Jq=xi.create,Gq=Si.create,Kq=Ii.create,Xq=Ti.create,Yq=zn.create,Qq=Gt.create,eV=Jt.create,tV=Pr.create,rV=Gt.createWithPreprocess,nV=Ac.create;var Yt={};xr(Yt,{$ZodAny:()=>Sl,$ZodArray:()=>Cl,$ZodAsyncError:()=>Kt,$ZodBase64:()=>hl,$ZodBase64URL:()=>gl,$ZodBigInt:()=>Ss,$ZodBigIntFormat:()=>wl,$ZodBoolean:()=>Ui,$ZodCIDRv4:()=>fl,$ZodCIDRv6:()=>ml,$ZodCUID:()=>ol,$ZodCUID2:()=>sl,$ZodCatch:()=>Jl,$ZodCheck:()=>Se,$ZodCheckBigIntFormat:()=>Jm,$ZodCheckEndsWith:()=>sh,$ZodCheckGreaterThan:()=>Jc,$ZodCheckIncludes:()=>ih,$ZodCheckLengthEquals:()=>eh,$ZodCheckLessThan:()=>Bc,$ZodCheckLowerCase:()=>rh,$ZodCheckMaxLength:()=>Ym,$ZodCheckMaxSize:()=>Gm,$ZodCheckMimeType:()=>ch,$ZodCheckMinLength:()=>Qm,$ZodCheckMinSize:()=>Km,$ZodCheckMultipleOf:()=>Wm,$ZodCheckNumberFormat:()=>Bm,$ZodCheckOverwrite:()=>lh,$ZodCheckProperty:()=>ah,$ZodCheckRegex:()=>th,$ZodCheckSizeEquals:()=>Xm,$ZodCheckStartsWith:()=>oh,$ZodCheckStringFormat:()=>Di,$ZodCheckUpperCase:()=>nh,$ZodCodec:()=>Zi,$ZodCustom:()=>tu,$ZodCustomStringFormat:()=>bl,$ZodDate:()=>zl,$ZodDefault:()=>Vl,$ZodDiscriminatedUnion:()=>Al,$ZodE164:()=>yl,$ZodEmail:()=>tl,$ZodEmoji:()=>nl,$ZodEncodeError:()=>Jr,$ZodEnum:()=>Dl,$ZodError:()=>vs,$ZodExactOptional:()=>Fl,$ZodFile:()=>Ll,$ZodFunction:()=>Yl,$ZodGUID:()=>Qc,$ZodIPv4:()=>ul,$ZodIPv6:()=>dl,$ZodISODate:()=>fh,$ZodISODateTime:()=>ph,$ZodISODuration:()=>hh,$ZodISOTime:()=>mh,$ZodIntersection:()=>Ol,$ZodJWT:()=>vl,$ZodKSUID:()=>ll,$ZodLazy:()=>eu,$ZodLiteral:()=>Ul,$ZodMAC:()=>pl,$ZodMap:()=>Ml,$ZodNaN:()=>Gl,$ZodNanoID:()=>il,$ZodNever:()=>Tl,$ZodNonOptional:()=>Wl,$ZodNull:()=>xl,$ZodNullable:()=>ql,$ZodNumber:()=>xs,$ZodNumberFormat:()=>_l,$ZodObject:()=>Rl,$ZodObjectJIT:()=>yh,$ZodOptional:()=>Ts,$ZodPipe:()=>Ps,$ZodPrefault:()=>Hl,$ZodPreprocess:()=>vh,$ZodPromise:()=>Ql,$ZodReadonly:()=>Kl,$ZodRealError:()=>kt,$ZodRecord:()=>Nl,$ZodRegistry:()=>ou,$ZodSet:()=>jl,$ZodString:()=>tn,$ZodStringFormat:()=>$e,$ZodSuccess:()=>Bl,$ZodSymbol:()=>$l,$ZodTemplateLiteral:()=>Xl,$ZodTransform:()=>Zl,$ZodTuple:()=>Is,$ZodType:()=>G,$ZodULID:()=>al,$ZodURL:()=>rl,$ZodUUID:()=>el,$ZodUndefined:()=>kl,$ZodUnion:()=>Li,$ZodUnknown:()=>Il,$ZodVoid:()=>Pl,$ZodXID:()=>cl,$ZodXor:()=>El,$brand:()=>im,$constructor:()=>v,$input:()=>_h,$output:()=>bh,Doc:()=>ks,JSONSchema:()=>Ek,JSONSchemaGenerator:()=>qu,NEVER:()=>ds,TimePrecision:()=>$h,_any:()=>$u,_array:()=>Rh,_base64:()=>Ws,_base64url:()=>Bs,_bigint:()=>gu,_boolean:()=>hu,_catch:()=>NA,_check:()=>Rk,_cidrv4:()=>Vs,_cidrv6:()=>Hs,_coercedBigint:()=>zh,_coercedBoolean:()=>Ph,_coercedDate:()=>Ch,_coercedNumber:()=>Th,_coercedString:()=>wh,_cuid:()=>js,_cuid2:()=>Ds,_custom:()=>Ou,_date:()=>Iu,_decode:()=>Dc,_decodeAsync:()=>Lc,_default:()=>EA,_discriminatedUnion:()=>_A,_e164:()=>Js,_email:()=>Cs,_emoji:()=>Ns,_encode:()=>jc,_encodeAsync:()=>Uc,_endsWith:()=>Xi,_enum:()=>IA,_file:()=>Au,_float32:()=>du,_float64:()=>pu,_gt:()=>pr,_gte:()=>mt,_guid:()=>Vi,_includes:()=>Gi,_int:()=>uu,_int32:()=>fu,_int64:()=>yu,_intersection:()=>wA,_ipv4:()=>Fs,_ipv6:()=>qs,_isoDate:()=>xh,_isoDateTime:()=>kh,_isoDuration:()=>Ih,_isoTime:()=>Sh,_jwt:()=>Gs,_ksuid:()=>Zs,_lazy:()=>UA,_length:()=>jn,_literal:()=>PA,_lowercase:()=>Bi,_lt:()=>dr,_lte:()=>Mt,_mac:()=>cu,_map:()=>xA,_max:()=>Mt,_maxLength:()=>Mn,_maxSize:()=>nn,_mime:()=>Yi,_min:()=>mt,_minLength:()=>Cr,_minSize:()=>fr,_multipleOf:()=>rn,_nan:()=>Tu,_nanoid:()=>Ms,_nativeEnum:()=>TA,_negative:()=>zu,_never:()=>xu,_nonnegative:()=>Ru,_nonoptional:()=>AA,_nonpositive:()=>Cu,_normalize:()=>Qi,_null:()=>wu,_nullable:()=>RA,_number:()=>lu,_optional:()=>CA,_overwrite:()=>Xt,_parse:()=>Oi,_parseAsync:()=>Ni,_pipe:()=>MA,_positive:()=>Pu,_promise:()=>LA,_property:()=>Eu,_readonly:()=>jA,_record:()=>kA,_refine:()=>Nu,_regex:()=>Wi,_safeDecode:()=>Fc,_safeDecodeAsync:()=>Vc,_safeEncode:()=>Zc,_safeEncodeAsync:()=>qc,_safeParse:()=>Mi,_safeParseAsync:()=>ji,_set:()=>SA,_size:()=>Nn,_slugify:()=>no,_startsWith:()=>Ki,_string:()=>au,_stringFormat:()=>Dn,_stringbool:()=>Uu,_success:()=>OA,_superRefine:()=>Mu,_symbol:()=>bu,_templateLiteral:()=>DA,_toLowerCase:()=>to,_toUpperCase:()=>ro,_transform:()=>zA,_trim:()=>eo,_tuple:()=>$A,_uint32:()=>mu,_uint64:()=>vu,_ulid:()=>Us,_undefined:()=>_u,_union:()=>vA,_unknown:()=>ku,_uppercase:()=>Ji,_url:()=>Hi,_uuid:()=>Rs,_uuidv4:()=>Es,_uuidv6:()=>As,_uuidv7:()=>Os,_void:()=>Su,_xid:()=>Ls,_xor:()=>bA,clone:()=>Ke,config:()=>Ue,createStandardJSONSchemaMethod:()=>io,createToJSONSchemaMethod:()=>Eh,decode:()=>e$,decodeAsync:()=>r$,describe:()=>ju,encode:()=>Qw,encodeAsync:()=>t$,extractDefs:()=>sn,finalize:()=>an,flattenError:()=>bs,formatError:()=>_s,globalConfig:()=>Cn,globalRegistry:()=>Xe,initializeContext:()=>on,isValidBase64:()=>gh,isValidBase64URL:()=>T$,isValidJWT:()=>P$,locales:()=>qi,meta:()=>Du,parse:()=>En,parseAsync:()=>An,prettifyError:()=>gm,process:()=>be,regexes:()=>xt,registry:()=>su,safeDecode:()=>i$,safeDecodeAsync:()=>s$,safeEncode:()=>n$,safeEncodeAsync:()=>o$,safeParse:()=>Qr,safeParseAsync:()=>en,toDotPath:()=>Yw,toJSONSchema:()=>Un,treeifyError:()=>hm,util:()=>T,version:()=>uh});var Zw,ds=Object.freeze({status:"aborted"});function v(t,e,r){function i(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=l[p].bind(a))}}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:t});function s(a){var c;let l=r?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var im=Symbol("zod_brand"),Kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Jr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Zw=globalThis).__zod_globalConfig??(Zw.__zod_globalConfig={});var Cn=globalThis.__zod_globalConfig;function Ue(t){return t&&Object.assign(Cn,t),Cn}var T={};xr(T,{BIGINT_FORMAT_RANGES:()=>fm,Class:()=>sm,NUMBER_FORMAT_RANGES:()=>pm,aborted:()=>Yr,allowsEval:()=>lm,assert:()=>RR,assertEqual:()=>TR,assertIs:()=>zR,assertNever:()=>CR,assertNotEqual:()=>PR,assignProp:()=>Kr,base64ToUint8Array:()=>Gw,base64urlToUint8Array:()=>FR,cached:()=>Ei,captureStackTrace:()=>Nc,cleanEnum:()=>ZR,cleanRegex:()=>ms,clone:()=>Ke,cloneDef:()=>AR,createTransparentProxy:()=>UR,defineLazy:()=>Q,esc:()=>Oc,escapeRegex:()=>Lt,explicitlyAborted:()=>mm,extend:()=>Hw,finalizeIssue:()=>ft,floatSafeRemainder:()=>am,getElementAtPath:()=>OR,getEnumValues:()=>fs,getLengthableOrigin:()=>ys,getParsedType:()=>DR,getSizableOrigin:()=>gs,hexToUint8Array:()=>VR,isObject:()=>Rn,isPlainObject:()=>Xr,issue:()=>Ai,joinValues:()=>b,jsonStringifyReplacer:()=>Ri,merge:()=>LR,mergeDefs:()=>zr,normalizeParams:()=>R,nullish:()=>Gr,numKeys:()=>jR,objectClone:()=>ER,omit:()=>Vw,optionalKeys:()=>dm,parsedType:()=>I,partial:()=>Bw,pick:()=>qw,prefixIssues:()=>$t,primitiveTypes:()=>um,promiseAllObject:()=>NR,propertyKeyTypes:()=>hs,randomString:()=>MR,required:()=>Jw,safeExtend:()=>Ww,shallowClone:()=>Mc,slugify:()=>cm,stringifyPrimitive:()=>x,uint8ArrayToBase64:()=>Kw,uint8ArrayToBase64url:()=>qR,uint8ArrayToHex:()=>HR,unwrapMessage:()=>ps});function TR(t){return t}function PR(t){return t}function zR(t){}function CR(t){throw new Error("Unexpected value in exhaustive check")}function RR(t){}function fs(t){let e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function b(t,e="|"){return t.map(r=>x(r)).join(e)}function Ri(t,e){return typeof e=="bigint"?e.toString():e}function Ei(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Gr(t){return t==null}function ms(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function am(t,e){let r=t/e,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var Fw=Symbol("evaluating");function Q(t,e,r){let i;Object.defineProperty(t,e,{get(){if(i!==Fw)return i===void 0&&(i=Fw,i=r()),i},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function ER(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Kr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function zr(...t){let e={};for(let r of t){let i=Object.getOwnPropertyDescriptors(r);Object.assign(e,i)}return Object.defineProperties({},e)}function AR(t){return zr(t._zod.def)}function OR(t,e){return e?e.reduce((r,i)=>r?.[i],t):t}function NR(t){let e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function MR(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Oc(t){return JSON.stringify(t)}function cm(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Nc="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Rn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var lm=Ei(()=>{if(Cn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Xr(t){if(Rn(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Rn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mc(t){return Xr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function jR(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var DR=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},hs=new Set(["string","number","symbol"]),um=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Lt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(t,e,r){let i=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(i._zod.parent=t),i}function R(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function UR(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,o){return e??(e=t()),Reflect.set(e,i,n,o)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function x(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function dm(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var pm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fm={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function qw(t,e){let r=t._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=zr(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Kr(this,"shape",s),s},checks:[]});return Ke(t,o)}function Vw(t,e){let r=t._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=zr(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Kr(this,"shape",s),s},checks:[]});return Ke(t,o)}function Hw(t,e){if(!Xr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=zr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Kr(this,"shape",o),o}});return Ke(t,n)}function Ww(t,e){if(!Xr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=zr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Kr(this,"shape",i),i}});return Ke(t,r)}function LR(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=zr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e._zod.def.shape};return Kr(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ke(t,r)}function Bw(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=zr(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return Kr(this,"shape",c),c},checks:[]});return Ke(e,s)}function Jw(t,e,r){let i=zr(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Kr(this,"shape",o),o}});return Ke(e,i)}function Yr(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function mm(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function $t(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function ps(t){return typeof t=="string"?t:t?.message}function ft(t,e,r){let i=t.message?t.message:ps(t.inst?._zod.def?.error?.(t))??ps(e?.error?.(t))??ps(r.customError?.(t))??ps(r.localeError?.(t))??"Invalid input",{inst:n,continue:o,input:s,...a}=t;return a.path??(a.path=[]),a.message=i,e?.reportInput&&(a.input=s),a}function gs(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ys(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function I(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Ai(...t){let[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function ZR(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Gw(t){let e=atob(t),r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return r}function Kw(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function FR(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Gw(e+r)}function qR(t){return Kw(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function VR(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)r[i/2]=Number.parseInt(e.slice(i,i+2),16);return r}function HR(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var sm=class{constructor(...e){}};var Xw=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Ri,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},vs=v("$ZodError",Xw),kt=v("$ZodError",Xw,{Parent:Error});function bs(t,e=r=>r.message){let r={},i=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function _s(t,e=r=>r.message){let r={_errors:[]},i=(n,o=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,l=0;for(;l<a.length;){let u=a[l];l===a.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(e(s))):c[u]=c[u]||{_errors:[]},c=c[u],l++}}}};return i(t),r}function hm(t,e=r=>r.message){let r={errors:[]},i=(n,o=[])=>{var s,a;for(let c of n.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>i({issues:l},[...o,...c.path]));else if(c.code==="invalid_key")i({issues:c.issues},[...o,...c.path]);else if(c.code==="invalid_element")i({issues:c.issues},[...o,...c.path]);else{let l=[...o,...c.path];if(l.length===0){r.errors.push(e(c));continue}let u=r,d=0;for(;d<l.length;){let p=l[d],f=d===l.length-1;typeof p=="string"?(u.properties??(u.properties={}),(s=u.properties)[p]??(s[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(a=u.items)[p]??(a[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(e(c)),d++}}};return i(t),r}function Yw(t){let e=[],r=t.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?e.push(`[${i}]`):typeof i=="symbol"?e.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?e.push(`[${JSON.stringify(i)}]`):(e.length&&e.push("."),e.push(i));return e.join("")}function gm(t){let e=[],r=[...t.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)e.push(`\u2716 ${i.message}`),i.path?.length&&e.push(` \u2192 at ${Yw(i.path)}`);return e.join(`
|
|
32
|
+
`)}var Oi=t=>(e,r,i,n)=>{let o=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kt;if(s.issues.length){let a=new(n?.Err??t)(s.issues.map(c=>ft(c,o,Ue())));throw Nc(a,n?.callee),a}return s.value},En=Oi(kt),Ni=t=>async(e,r,i,n)=>{let o=i?{...i,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(n?.Err??t)(s.issues.map(c=>ft(c,o,Ue())));throw Nc(a,n?.callee),a}return s.value},An=Ni(kt),Mi=t=>(e,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Kt;return o.issues.length?{success:!1,error:new(t??vs)(o.issues.map(s=>ft(s,n,Ue())))}:{success:!0,data:o.value}},Qr=Mi(kt),ji=t=>async(e,r,i)=>{let n=i?{...i,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>ft(s,n,Ue())))}:{success:!0,data:o.value}},en=ji(kt),jc=t=>(e,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Oi(t)(e,r,n)},Qw=jc(kt),Dc=t=>(e,r,i)=>Oi(t)(e,r,i),e$=Dc(kt),Uc=t=>async(e,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Ni(t)(e,r,n)},t$=Uc(kt),Lc=t=>async(e,r,i)=>Ni(t)(e,r,i),r$=Lc(kt),Zc=t=>(e,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Mi(t)(e,r,n)},n$=Zc(kt),Fc=t=>(e,r,i)=>Mi(t)(e,r,i),i$=Fc(kt),qc=t=>async(e,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return ji(t)(e,r,n)},o$=qc(kt),Vc=t=>async(e,r,i)=>ji(t)(e,r,i),s$=Vc(kt);var xt={};xr(xt,{base64:()=>Em,base64url:()=>Hc,bigint:()=>Um,boolean:()=>Zm,browserEmail:()=>eE,cidrv4:()=>Cm,cidrv6:()=>Rm,cuid:()=>ym,cuid2:()=>vm,date:()=>Nm,datetime:()=>jm,domain:()=>nE,duration:()=>km,e164:()=>Om,email:()=>Sm,emoji:()=>Im,extendedDuration:()=>BR,guid:()=>xm,hex:()=>iE,hostname:()=>rE,html5Email:()=>XR,httpProtocol:()=>Am,idnEmail:()=>QR,integer:()=>Lm,ipv4:()=>Tm,ipv6:()=>Pm,ksuid:()=>wm,lowercase:()=>Vm,mac:()=>zm,md5_base64:()=>sE,md5_base64url:()=>aE,md5_hex:()=>oE,nanoid:()=>$m,null:()=>Fm,number:()=>Wc,rfc5322Email:()=>YR,sha1_base64:()=>lE,sha1_base64url:()=>uE,sha1_hex:()=>cE,sha256_base64:()=>pE,sha256_base64url:()=>fE,sha256_hex:()=>dE,sha384_base64:()=>hE,sha384_base64url:()=>gE,sha384_hex:()=>mE,sha512_base64:()=>vE,sha512_base64url:()=>bE,sha512_hex:()=>yE,string:()=>Dm,time:()=>Mm,ulid:()=>bm,undefined:()=>qm,unicodeEmail:()=>a$,uppercase:()=>Hm,uuid:()=>On,uuid4:()=>JR,uuid6:()=>GR,uuid7:()=>KR,xid:()=>_m});var ym=/^[cC][0-9a-z]{6,}$/,vm=/^[0-9a-z]+$/,bm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_m=/^[0-9a-vA-V]{20}$/,wm=/^[A-Za-z0-9]{27}$/,$m=/^[a-zA-Z0-9_-]{21}$/,km=/^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)?)??$/,xm=/^([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})$/,On=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,JR=On(4),GR=On(6),KR=On(7),Sm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,XR=/^[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])?)*$/,YR=/^(([^<>()\[\]\\.,;:\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,}))$/,a$=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,QR=a$,eE=/^[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])?)*$/,tE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Im(){return new RegExp(tE,"u")}var Tm=/^(?:(?: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])$/,Pm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zm=t=>{let e=Lt(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Cm=/^((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])$/,Rm=/^(([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])$/,Em=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hc=/^[A-Za-z0-9_-]*$/,rE=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,nE=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Am=/^https?$/,Om=/^\+[1-9]\d{6,14}$/,c$="(?:(?:\\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])))",Nm=new RegExp(`^${c$}$`);function l$(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Mm(t){return new RegExp(`^${l$(t)}$`)}function jm(t){let e=l$({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${e}(?:${r.join("|")})`;return new RegExp(`^${c$}T(?:${i})$`)}var Dm=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Um=/^-?\d+n?$/,Lm=/^-?\d+$/,Wc=/^-?\d+(?:\.\d+)?$/,Zm=/^(?:true|false)$/i,Fm=/^null$/i;var qm=/^undefined$/i;var Vm=/^[^A-Z]*$/,Hm=/^[^a-z]*$/,iE=/^[0-9a-fA-F]*$/;function ws(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function $s(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var oE=/^[0-9a-fA-F]{32}$/,sE=ws(22,"=="),aE=$s(22),cE=/^[0-9a-fA-F]{40}$/,lE=ws(27,"="),uE=$s(27),dE=/^[0-9a-fA-F]{64}$/,pE=ws(43,"="),fE=$s(43),mE=/^[0-9a-fA-F]{96}$/,hE=ws(64,""),gE=$s(64),yE=/^[0-9a-fA-F]{128}$/,vE=ws(86,"=="),bE=$s(86);var Se=v("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),d$={number:"number",bigint:"bigint",object:"date"},Bc=v("$ZodCheckLessThan",(t,e)=>{Se.init(t,e);let r=d$[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Jc=v("$ZodCheckGreaterThan",(t,e)=>{Se.init(t,e);let r=d$[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wm=v("$ZodCheckMultipleOf",(t,e)=>{Se.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):am(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Bm=v("$ZodCheckNumberFormat",(t,e)=>{Se.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),i=r?"int":"number",[n,o]=pm[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=n,a.maximum=o,r&&(a.pattern=Lm)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){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:t,origin:i,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),Jm=v("$ZodCheckBigIntFormat",(t,e)=>{Se.init(t,e);let[r,i]=fm[e.format];t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,o.minimum=r,o.maximum=i}),t._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Gm=v("$ZodCheckMaxSize",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{let n=i.value;n.size<=e.maximum||i.issues.push({origin:gs(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Km=v("$ZodCheckMinSize",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{let n=i.value;n.size>=e.minimum||i.issues.push({origin:gs(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Xm=v("$ZodCheckSizeEquals",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.size,n.maximum=e.size,n.size=e.size}),t._zod.check=i=>{let n=i.value,o=n.size;if(o===e.size)return;let s=o>e.size;i.issues.push({origin:gs(n),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),Ym=v("$ZodCheckMaxLength",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{let n=i.value;if(n.length<=e.maximum)return;let s=ys(n);i.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Qm=v("$ZodCheckMinLength",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{let n=i.value;if(n.length>=e.minimum)return;let s=ys(n);i.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),eh=v("$ZodCheckLengthEquals",(t,e)=>{var r;Se.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Gr(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=i=>{let n=i.value,o=n.length;if(o===e.length)return;let s=ys(n),a=o>e.length;i.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),Di=v("$ZodCheckStringFormat",(t,e)=>{var r,i;Se.init(t,e),t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),th=v("$ZodCheckRegex",(t,e)=>{Di.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),rh=v("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Vm),Di.init(t,e)}),nh=v("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Hm),Di.init(t,e)}),ih=v("$ZodCheckIncludes",(t,e)=>{Se.init(t,e);let r=Lt(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),oh=v("$ZodCheckStartsWith",(t,e)=>{Se.init(t,e);let r=new RegExp(`^${Lt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),sh=v("$ZodCheckEndsWith",(t,e)=>{Se.init(t,e);let r=new RegExp(`.*${Lt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function u$(t,e,r){t.issues.length&&e.issues.push(...$t(r,t.issues))}var ah=v("$ZodCheckProperty",(t,e)=>{Se.init(t,e),t._zod.check=r=>{let i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>u$(n,r,e.property));u$(i,r,e.property)}}),ch=v("$ZodCheckMimeType",(t,e)=>{Se.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,inst:t,continue:!e.abort})}}),lh=v("$ZodCheckOverwrite",(t,e)=>{Se.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var ks=class{constructor(e=[]){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 i=e.split(`
|
|
33
|
+
`).filter(s=>s),n=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,n.join(`
|
|
34
|
+
`))}};var uh={major:4,minor:4,patch:3};var G=v("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=uh;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let n of i)for(let o of n._zod.onattach)o(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(s,a,c)=>{let l=Yr(s),u;for(let d of a){if(d._zod.def.when){if(mm(s)||!d._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new Kt;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=Yr(s,p)))});else{if(s.issues.length===p)continue;l||(l=Yr(s,p))}}return u?u.then(()=>s):s},o=(s,a,c)=>{if(Yr(s))return s.aborted=!0,s;let l=n(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new Kt;return l.then(u=>t._zod.parse(u,c))}return t._zod.parse(l,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let l=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>o(u,s,a)):o(l,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Kt;return c.then(l=>n(l,i,a))}return n(c,i,a)}}Q(t,"~standard",()=>({validate:n=>{try{let o=Qr(t,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return en(t,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),tn=v("$ZodString",(t,e)=>{G.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Dm(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),$e=v("$ZodStringFormat",(t,e)=>{Di.init(t,e),tn.init(t,e)}),Qc=v("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=xm),$e.init(t,e)}),el=v("$ZodUUID",(t,e)=>{if(e.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=On(i))}else e.pattern??(e.pattern=On());$e.init(t,e)}),tl=v("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Sm),$e.init(t,e)}),rl=v("$ZodURL",(t,e)=>{$e.init(t,e),t._zod.check=r=>{try{let i=r.value.trim();if(!e.normalize&&e.protocol?.source===Am.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let n=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),nl=v("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Im()),$e.init(t,e)}),il=v("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=$m),$e.init(t,e)}),ol=v("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=ym),$e.init(t,e)}),sl=v("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=vm),$e.init(t,e)}),al=v("$ZodULID",(t,e)=>{e.pattern??(e.pattern=bm),$e.init(t,e)}),cl=v("$ZodXID",(t,e)=>{e.pattern??(e.pattern=_m),$e.init(t,e)}),ll=v("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=wm),$e.init(t,e)}),ph=v("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=jm(e)),$e.init(t,e)}),fh=v("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Nm),$e.init(t,e)}),mh=v("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Mm(e)),$e.init(t,e)}),hh=v("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=km),$e.init(t,e)}),ul=v("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Tm),$e.init(t,e),t._zod.bag.format="ipv4"}),dl=v("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Pm),$e.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),pl=v("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=zm(e.delimiter)),$e.init(t,e),t._zod.bag.format="mac"}),fl=v("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Cm),$e.init(t,e)}),ml=v("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Rm),$e.init(t,e),t._zod.check=r=>{let i=r.value.split("/");try{if(i.length!==2)throw new Error;let[n,o]=i;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function gh(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var hl=v("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Em),$e.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{gh(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function T$(t){if(!Hc.test(t))return!1;let e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return gh(r)}var gl=v("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Hc),$e.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{T$(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),yl=v("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Om),$e.init(t,e)});function P$(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var vl=v("$ZodJWT",(t,e)=>{$e.init(t,e),t._zod.check=r=>{P$(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),bl=v("$ZodCustomStringFormat",(t,e)=>{$e.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),xs=v("$ZodNumber",(t,e)=>{G.init(t,e),t._zod.pattern=t._zod.bag.pattern??Wc,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),r}}),_l=v("$ZodNumberFormat",(t,e)=>{Bm.init(t,e),xs.init(t,e)}),Ui=v("$ZodBoolean",(t,e)=>{G.init(t,e),t._zod.pattern=Zm,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ss=v("$ZodBigInt",(t,e)=>{G.init(t,e),t._zod.pattern=Um,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),wl=v("$ZodBigIntFormat",(t,e)=>{Jm.init(t,e),Ss.init(t,e)}),$l=v("$ZodSymbol",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),kl=v("$ZodUndefined",(t,e)=>{G.init(t,e),t._zod.pattern=qm,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),xl=v("$ZodNull",(t,e)=>{G.init(t,e),t._zod.pattern=Fm,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Sl=v("$ZodAny",(t,e)=>{G.init(t,e),t._zod.parse=r=>r}),Il=v("$ZodUnknown",(t,e)=>{G.init(t,e),t._zod.parse=r=>r}),Tl=v("$ZodNever",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Pl=v("$ZodVoid",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),zl=v("$ZodDate",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:t}),r}});function f$(t,e,r){t.issues.length&&e.issues.push(...$t(r,t.issues)),e.value[r]=t.value}var Cl=v("$ZodArray",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let o=[];for(let s=0;s<n.length;s++){let a=n[s],c=e.element._zod.run({value:a,issues:[]},i);c instanceof Promise?o.push(c.then(l=>f$(l,r,s))):f$(c,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function Yc(t,e,r,i,n,o){let s=r in i;if(t.issues.length){if(n&&o&&!s)return;e.issues.push(...$t(r,t.issues))}if(!s&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?s&&(e.value[r]=void 0):e.value[r]=t.value}function z$(t){let e=Object.keys(t.shape);for(let i of e)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=dm(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function C$(t,e,r,i,n,o){let s=[],a=n.keySet,c=n.catchall._zod,l=c.def.type,u=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(l==="never"){s.push(p);continue}let f=c.run({value:e[p],issues:[]},i);f instanceof Promise?t.push(f.then(m=>Yc(m,r,p,e,u,d))):Yc(f,r,p,e,u,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}var Rl=v("$ZodObject",(t,e)=>{if(G.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let i=Ei(()=>z$(e));Q(t._zod,"propValues",()=>{let a=e.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let n=Rn,o=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=i.value);let l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let u=[],d=s.shape;for(let p of s.keys){let f=d[p],m=f._zod.optin==="optional",h=f._zod.optout==="optional",y=f._zod.run({value:l[p],issues:[]},c);y instanceof Promise?u.push(y.then(_=>Yc(_,a,p,l,m,h))):Yc(y,a,p,l,m,h)}return o?C$(u,l,a,c,i.value,t):u.length?Promise.all(u).then(()=>a):a}}),yh=v("$ZodObjectJIT",(t,e)=>{Rl.init(t,e);let r=t._zod.parse,i=Ei(()=>z$(e)),n=p=>{let f=new ks(["shape","payload","ctx"]),m=i.value,h=w=>{let k=Oc(w);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),_=0;for(let w of m.keys)y[w]=`key_${_++}`;f.write("const newResult = {};");for(let w of m.keys){let k=y[w],S=Oc(w),J=p[w],F=J?._zod?.optin==="optional",P=J?._zod?.optout==="optional";f.write(`const ${k} = ${h(w)};`),F&&P?f.write(`
|
|
35
|
+
if (${k}.issues.length) {
|
|
36
|
+
if (${S} in input) {
|
|
37
|
+
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
38
|
+
...iss,
|
|
39
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (${k}.value === undefined) {
|
|
45
|
+
if (${S} in input) {
|
|
46
|
+
newResult[${S}] = undefined;
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
newResult[${S}] = ${k}.value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
`):F?f.write(`
|
|
53
|
+
if (${k}.issues.length) {
|
|
54
|
+
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
55
|
+
...iss,
|
|
56
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
57
|
+
})));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (${k}.value === undefined) {
|
|
61
|
+
if (${S} in input) {
|
|
62
|
+
newResult[${S}] = undefined;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
newResult[${S}] = ${k}.value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
`):f.write(`
|
|
69
|
+
const ${k}_present = ${S} in input;
|
|
70
|
+
if (${k}.issues.length) {
|
|
71
|
+
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
72
|
+
...iss,
|
|
73
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
if (!${k}_present && !${k}.issues.length) {
|
|
77
|
+
payload.issues.push({
|
|
78
|
+
code: "invalid_type",
|
|
79
|
+
expected: "nonoptional",
|
|
80
|
+
input: undefined,
|
|
81
|
+
path: [${S}]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (${k}_present) {
|
|
86
|
+
if (${k}.value === undefined) {
|
|
87
|
+
newResult[${S}] = undefined;
|
|
88
|
+
} else {
|
|
89
|
+
newResult[${S}] = ${k}.value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let $=f.compile();return(w,k)=>$(p,w,k)},o,s=Rn,a=!Cn.jitless,l=a&&lm.value,u=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=i.value);let m=p.value;return s(m)?a&&l&&f?.async===!1&&f.jitless!==!0?(o||(o=n(e.shape)),p=o(p,f),u?C$([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function m$(t,e,r,i){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let n=t.filter(o=>!Yr(o));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ft(s,i,Ue())))}),e)}var Li=v("$ZodUnion",(t,e)=>{G.init(t,e),Q(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Q(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Q(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),Q(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${i.map(n=>ms(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of e.options){let c=a._zod.run({value:i.value,issues:[]},n);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>m$(a,i,t,n)):m$(s,i,t,n)}});function h$(t,e,r,i){let n=t.filter(o=>o.issues.length===0);return n.length===1?(e.value=n[0].value,e):(n.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ft(s,i,Ue())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var El=v("$ZodXor",(t,e)=>{Li.init(t,e),e.inclusive=!1;let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of e.options){let c=a._zod.run({value:i.value,issues:[]},n);c instanceof Promise?(s.push(c),o=!0):s.push(c)}return o?Promise.all(s).then(a=>h$(a,i,t,n)):h$(s,i,t,n)}}),Al=v("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Li.init(t,e);let r=t._zod.parse;Q(t._zod,"propValues",()=>{let n={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,c]of Object.entries(s)){n[a]||(n[a]=new Set);for(let l of c)n[a].add(l)}}return n});let i=Ei(()=>{let n=e.options,o=new Map;for(let s of n){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,s)}}return o});t._zod.parse=(n,o)=>{let s=n.value;if(!Rn(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let a=i.value.get(s?.[e.discriminator]);return a?a._zod.run(n,o):e.unionFallback||o.direction==="backward"?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()),input:s,path:[e.discriminator],inst:t}),n)}}),Ol=v("$ZodIntersection",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value,o=e.left._zod.run({value:n,issues:[]},i),s=e.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([c,l])=>g$(r,c,l)):g$(r,o,s)}});function dh(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Xr(t)&&Xr(e)){let r=Object.keys(e),i=Object.keys(t).filter(o=>r.indexOf(o)!==-1),n={...t,...e};for(let o of i){let s=dh(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n[o]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i<t.length;i++){let n=t[i],o=e[i],s=dh(n,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function g$(t,e,r){let i=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)i.has(c)||i.set(c,{}),i.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)i.has(c)||i.set(c,{}),i.get(c).r=!0;else t.issues.push(a);let o=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&n&&t.issues.push({...n,keys:o}),Yr(t))return t;let s=dh(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}var Is=v("$ZodTuple",(t,e)=>{G.init(t,e);let r=e.items;t._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),i;i.value=[];let s=[],a=y$(r,"optin"),c=y$(r,"optout");if(!e.rest){if(o.length<a)return i.issues.push({code:"too_small",minimum:a,inclusive:!0,input:o,inst:t,origin:"array"}),i;o.length>r.length&&i.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:o,inst:t,origin:"array"})}let l=new Array(r.length);for(let u=0;u<r.length;u++){let d=r[u]._zod.run({value:o[u],issues:[]},n);d instanceof Promise?s.push(d.then(p=>{l[u]=p})):l[u]=d}if(e.rest){let u=r.length-1,d=o.slice(r.length);for(let p of d){u++;let f=e.rest._zod.run({value:p,issues:[]},n);f instanceof Promise?s.push(f.then(m=>v$(m,i,u))):v$(f,i,u)}}return s.length?Promise.all(s).then(()=>b$(l,i,r,o,c)):b$(l,i,r,o,c)}});function y$(t,e){for(let r=t.length-1;r>=0;r--)if(t[r]._zod[e]!=="optional")return r+1;return 0}function v$(t,e,r){t.issues.length&&e.issues.push(...$t(r,t.issues)),e.value[r]=t.value}function b$(t,e,r,i,n){for(let o=0;o<r.length;o++){let s=t[o],a=o<i.length;if(s.issues.length){if(!a&&o>=n){e.value.length=o;break}e.issues.push(...$t(o,s.issues))}e.value[o]=s.value}for(let o=e.value.length-1;o>=i.length&&(r[o]._zod.optout==="optional"&&e.value[o]===void 0);o--)e.value.length=o;return e}var Nl=v("$ZodRecord",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Xr(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){a.add(typeof l=="number"?l.toString():l);let u=e.keyType._zod.run({value:l,issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>ft(f,i,Ue())),input:l,path:[l],inst:t});continue}let d=u.value,p=e.valueType._zod.run({value:n[l],issues:[]},i);p instanceof Promise?o.push(p.then(f=>{f.issues.length&&r.issues.push(...$t(l,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...$t(l,p.issues)),r.value[d]=p.value)}let c;for(let l in n)a.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Wc.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},i);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>ft(d,i,Ue())),input:a,path:[a],inst:t});continue}let u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...$t(a,d.issues)),r.value[c.value]=d.value})):(u.issues.length&&r.issues.push(...$t(a,u.issues)),r.value[c.value]=u.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Ml=v("$ZodMap",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;let o=[];r.value=new Map;for(let[s,a]of n){let c=e.keyType._zod.run({value:s,issues:[]},i),l=e.valueType._zod.run({value:a,issues:[]},i);c instanceof Promise||l instanceof Promise?o.push(Promise.all([c,l]).then(([u,d])=>{_$(u,d,r,s,n,t,i)})):_$(c,l,r,s,n,t,i)}return o.length?Promise.all(o).then(()=>r):r}});function _$(t,e,r,i,n,o,s){t.issues.length&&(hs.has(typeof i)?r.issues.push(...$t(i,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:o,issues:t.issues.map(a=>ft(a,s,Ue()))})),e.issues.length&&(hs.has(typeof i)?r.issues.push(...$t(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:e.issues.map(a=>ft(a,s,Ue()))})),r.value.set(t.value,e.value)}var jl=v("$ZodSet",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let s of n){let a=e.valueType._zod.run({value:s,issues:[]},i);a instanceof Promise?o.push(a.then(c=>w$(c,r))):w$(a,r)}return o.length?Promise.all(o).then(()=>r):r}});function w$(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var Dl=v("$ZodEnum",(t,e)=>{G.init(t,e);let r=fs(e.entries),i=new Set(r);t._zod.values=i,t._zod.pattern=new RegExp(`^(${r.filter(n=>hs.has(typeof n)).map(n=>typeof n=="string"?Lt(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return i.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),Ul=v("$ZodLiteral",(t,e)=>{if(G.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(i=>typeof i=="string"?Lt(i):i?Lt(i.toString()):String(i)).join("|")})$`),t._zod.parse=(i,n)=>{let o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),i}}),Ll=v("$ZodFile",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),Zl=v("$ZodTransform",(t,e)=>{G.init(t,e),t._zod.optin="optional",t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Jr(t.constructor.name);let n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new Kt;return r.value=n,r.fallback=!0,r}});function $$(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var Ts=v("$ZodOptional",(t,e)=>{G.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ms(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,o=e.innerType._zod.run(r,i);return o instanceof Promise?o.then(s=>$$(s,n)):$$(o,n)}return r.value===void 0?r:e.innerType._zod.run(r,i)}}),Fl=v("$ZodExactOptional",(t,e)=>{Ts.init(t,e),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,i)=>e.innerType._zod.run(r,i)}),ql=v("$ZodNullable",(t,e)=>{G.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ms(r.source)}|null)$`):void 0}),Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),Vl=v("$ZodDefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>k$(o,e)):k$(n,e)}});function k$(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Hl=v("$ZodPrefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),Wl=v("$ZodNonOptional",(t,e)=>{G.init(t,e),Q(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>x$(o,t)):x$(n,t)}});function x$(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Bl=v("$ZodSuccess",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Jr("ZodSuccess");let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Jl=v("$ZodCatch",(t,e)=>{G.init(t,e),t._zod.optin="optional",Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ft(s,i,Ue()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(o=>ft(o,i,Ue()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Gl=v("$ZodNaN",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Ps=v("$ZodPipe",(t,e)=>{G.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,i)=>{if(i.direction==="backward"){let o=e.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Gc(s,e.in,i)):Gc(o,e.in,i)}let n=e.in._zod.run(r,i);return n instanceof Promise?n.then(o=>Gc(o,e.out,i)):Gc(n,e.out,i)}});function Gc(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var Zi=v("$ZodCodec",(t,e)=>{G.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,i)=>{if((i.direction||"forward")==="forward"){let o=e.in._zod.run(r,i);return o instanceof Promise?o.then(s=>Kc(s,e,i)):Kc(o,e,i)}else{let o=e.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Kc(s,e,i)):Kc(o,e,i)}}});function Kc(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let n=e.transform(t.value,t);return n instanceof Promise?n.then(o=>Xc(t,o,e.out,r)):Xc(t,n,e.out,r)}else{let n=e.reverseTransform(t.value,t);return n instanceof Promise?n.then(o=>Xc(t,o,e.in,r)):Xc(t,n,e.in,r)}}function Xc(t,e,r,i){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},i)}var vh=v("$ZodPreprocess",(t,e)=>{Ps.init(t,e)}),Kl=v("$ZodReadonly",(t,e)=>{G.init(t,e),Q(t._zod,"propValues",()=>e.innerType._zod.propValues),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"optin",()=>e.innerType?._zod?.optin),Q(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(S$):S$(n)}});function S$(t){return t.value=Object.freeze(t.value),t}var Xl=v("$ZodTemplateLiteral",(t,e)=>{G.init(t,e);let r=[];for(let i of e.parts)if(typeof i=="object"&&i!==null){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);let o=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(o,s))}else if(i===null||um.has(typeof i))r.push(Lt(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"string",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),i)}),Yl=v("$ZodFunction",(t,e)=>(G.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...i){let n=t._def.input?En(t._def.input,i):i,o=Reflect.apply(r,this,n);return t._def.output?En(t._def.output,o):o}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...i){let n=t._def.input?await An(t._def.input,i):i,o=await Reflect.apply(r,this,n);return t._def.output?await An(t._def.output,o):o}},t._zod.parse=(r,i)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let i=t.constructor;return Array.isArray(r[0])?new i({type:"function",input:new Is({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new i({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let i=t.constructor;return new i({type:"function",input:t._def.input,output:r})},t)),Ql=v("$ZodPromise",(t,e)=>{G.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),eu=v("$ZodLazy",(t,e)=>{G.init(t,e),Q(t._zod,"innerType",()=>{let r=e;return r._cachedInner||(r._cachedInner=e.getter()),r._cachedInner}),Q(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Q(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Q(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Q(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),tu=v("$ZodCustom",(t,e)=>{Se.init(t,e),G.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{let i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(o=>I$(o,r,i,t));I$(n,r,i,t)}});function I$(t,e,r,i){if(!t){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(Ai(n))}}var qi={};xr(qi,{ar:()=>R$,az:()=>E$,be:()=>O$,bg:()=>N$,ca:()=>M$,cs:()=>j$,da:()=>D$,de:()=>U$,el:()=>L$,en:()=>ru,eo:()=>Z$,es:()=>F$,fa:()=>q$,fi:()=>V$,fr:()=>H$,frCA:()=>W$,he:()=>B$,hr:()=>J$,hu:()=>G$,hy:()=>X$,id:()=>Y$,is:()=>Q$,it:()=>ek,ja:()=>tk,ka:()=>rk,kh:()=>nk,km:()=>nu,ko:()=>ik,lt:()=>sk,mk:()=>ak,ms:()=>ck,nl:()=>lk,no:()=>uk,ota:()=>dk,pl:()=>fk,ps:()=>pk,pt:()=>mk,ro:()=>hk,ru:()=>yk,sl:()=>vk,sv:()=>bk,ta:()=>_k,th:()=>wk,tr:()=>$k,ua:()=>kk,uk:()=>iu,ur:()=>xk,uz:()=>Sk,vi:()=>Ik,yo:()=>zk,zhCN:()=>Tk,zhTW:()=>Pk});var wE=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(n){return t[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${x(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${r[o.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${b(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function R$(){return{localeError:wE()}}var $E=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??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"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${a}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${x(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[o.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function E$(){return{localeError:$E()}}function A$(t,e,r,i){let n=Math.abs(t),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?e:o>=2&&o<=4?r:i}var kE=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(n){return t[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},i={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${x(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=A$(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=A$(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${b(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function O$(){return{localeError:kE()}}var xE=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${x(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${b(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function N$(){return{localeError:xE()}}var SE=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",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\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${a}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${x(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${b(n.values," o ")}`;case"too_big":{let o=n.inclusive?"com a m\xE0xim":"menys de",s=e(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${o} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${o} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function M$(){return{localeError:SE()}}var IE=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(n){return t[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 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 \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${x(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${b(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function j$(){return{localeError:IE()}}var TE=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function e(n){return t[n]??null}let r={regex:"input",email:"e-mailadresse",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 klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`:`Ugyldigt input: forventede ${o}, fik ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${x(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin),a=i[n.origin]??n.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${o} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin),a=i[n.origin]??n.origin;return s?`For lille: forventede ${a} ${s.verb} ${o} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${b(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function D$(){return{localeError:TE()}}var PE=()=>{let t={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 e(n){return t[n]??null}let r={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"},i={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${a}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${x(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ist`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ist`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${b(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function U$(){return{localeError:PE()}}var zE=()=>{let t={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function e(n){return t[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 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 \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${x(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${b(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function L$(){return{localeError:zE()}}var CE=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(n){return t[n]??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",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${x(n.values[0])}`:`Invalid option: expected one of ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function ru(){return{localeError:CE()}}var RE=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",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\u016Dro",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"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${a}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${x(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function Z$(){return{localeError:RE()}}var EE=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${x(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${o}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${i[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${i[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function F$(){return{localeError:EE()}}var AE=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(n){return t[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${x(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${b(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[o.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${b(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function q$(){return{localeError:AE()}}var OE=()=>{let t={string:{unit:"merkki\xE4",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\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(n){return t[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",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\xE4iv\xE4m\xE4\xE4r\xE4",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"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${a}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${x(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${o}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${o}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${r[o.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${b(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\xF6te"}}};function V$(){return{localeError:OE()}}var NE=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r={regex:"entr\xE9e",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\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${a} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${x(n.values[0])} attendu`:`Option invalide : une valeur parmi ${b(n.values,"|")} attendue`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Trop grand : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Trop petit : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${b(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function H$(){return{localeError:NE()}}var ME=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r={regex:"entr\xE9e",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\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${a}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${x(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u2264":"<",s=e(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${o}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u2265":">",s=e(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${b(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function W$(){return{localeError:ME()}}var jE=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=l=>l?t[l]:void 0,i=l=>{let u=r(l);return u?u.label:l??t.unknown.label},n=l=>`\u05D4${i(l)}`,o=l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=l=>l?e[l]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let u=l.expected,d=c[u??""]??i(u),p=I(l.input),f=c[p]??t[p]?.label??p;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${x(l.values[0])}`;let u=l.values.map(f=>x(f));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=s(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=l.inclusive?`${l.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=l.inclusive?"<=":"<",f=o(l.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()}`}case"too_small":{let u=s(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let y=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let h=l.inclusive?`${l.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=l.inclusive?">=":">",f=o(l.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()}`}case"invalid_format":{let u=l;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=a[u.format],p=d?.label??u.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${b(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function B$(){return{localeError:jE()}}var DE=()=>{let t={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function e(n){return t[n]??null}let r={regex:"unos",email:"email 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:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${a}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${x(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin),a=i[n.origin]??n.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${o}${n.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin),a=i[n.origin]??n.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${o}${n.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${r[o.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${b(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${i[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function J$(){return{localeError:DE()}}var UE=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}let r={regex:"bemenet",email:"email c\xEDm",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\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${x(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${o}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[o.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function G$(){return{localeError:UE()}}function K$(t,e,r){return Math.abs(t)===1?e:r}function Fi(t){if(!t)return"";let e=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=t[t.length-1];return t+(e.includes(r)?"\u0576":"\u0568")}var LE=()=>{let t={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function e(n){return t[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},i={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${x(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=K$(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Fi(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Fi(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=K$(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Fi(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Fi(n.origin)} \u056C\u056B\u0576\u056B ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[o.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${b(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Fi(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Fi(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function X$(){return{localeError:LE()}}var ZE=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}let r={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"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${x(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${r[o.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":""}: ${b(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 Y$(){return{localeError:ZE()}}var FE=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${x(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${b(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function Q$(){return{localeError:FE()}}var qE=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}let r={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"},i={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`:`Input non valido: atteso ${o}, ricevuto ${a}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${x(n.values[0])}`:`Opzione non valida: atteso uno tra ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${o}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${o}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${r[o.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"}: ${b(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 ek(){return{localeError:qE()}}var VE=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(n){return t[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},i={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${x(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${b(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${b(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function tk(){return{localeError:VE()}}var HE=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},i={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${x(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${b(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${b(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function rk(){return{localeError:HE()}}var WE=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(n){return t[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},i={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${x(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${b(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function nu(){return{localeError:WE()}}function nk(){return nu()}var BE=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${x(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${b(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${o}${s}`}case"too_small":{let o=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[o.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${b(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function ik(){return{localeError:BE()}}var zs=t=>t.charAt(0).toUpperCase()+t.slice(1);function ok(t){let e=Math.abs(t),r=e%10,i=e%100;return i>=11&&i<=19||r===0?"many":r===1?"one":"few"}var JE=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,o,s,a){let c=t[n]??null;return c===null?c:{unit:c.unit[o],verb:c.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},i={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${o}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${x(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${b(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=i[n.origin]??n.origin,s=e(n.origin,ok(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${zs(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${zs(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let o=i[n.origin]??n.origin,s=e(n.origin,ok(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${zs(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${zs(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${b(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=i[n.origin]??n.origin;return`${zs(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function sk(){return{localeError:JE()}}var GE=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(n){return t[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},i={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${x(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${b(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function ak(){return{localeError:GE()}}var KE=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}let r={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"},i={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`:`Input tidak sah: dijangka ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${x(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${r[o.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${b(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 ck(){return{localeError:KE()}}var XE=()=>{let t={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function e(n){return t[n]??null}let r={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"},i={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${o}, ontving ${a}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${x(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} is`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} is`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${r[o.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":""}: ${b(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 lk(){return{localeError:XE()}}var YE=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(n){return t[n]??null}let r={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\xE5de",ipv6:"IPv6-omr\xE5de",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"},i={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`:`Ugyldig input: forventet ${o}, fikk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${x(n.values[0])}`:`Ugyldig valg: forventet en av ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${b(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function uk(){return{localeError:YE()}}var QE=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??null}let r={regex:"giren",email:"epostag\xE2h",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\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${x(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=n;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[o.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function dk(){return{localeError:QE()}}var eA=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(n){return t[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${x(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${b(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[o.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${b(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function pk(){return{localeError:eA()}}var tA=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(n){return t[n]??null}let r={regex:"wyra\u017Cenie",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\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},i={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${a}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${x(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[o.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function fk(){return{localeError:tA()}}var rA=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}let r={regex:"padr\xE3o",email:"endere\xE7o 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\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o 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\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",number:"n\xFAmero",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${o}, recebido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${x(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Muito pequeno: esperado que ${n.origin} tivesse ${o}${n.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${r[o.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${b(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};function mk(){return{localeError:rA()}}var nA=()=>{let t={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function e(n){return t[n]??null}let r={regex:"intrare",email:"adres\u0103 de 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:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${a}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${x(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${r[o.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${b(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function hk(){return{localeError:nA()}}function gk(t,e,r,i){let n=Math.abs(t),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?e:o>=2&&o<=4?r:i}var iA=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${x(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=gk(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=gk(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${b(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function yk(){return{localeError:iA()}}var oA=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}let r={regex:"vnos",email:"e-po\u0161tni 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 \u010Das",date:"ISO datum",time:"ISO \u010Das",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 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${a}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${x(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${o}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${o}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${r[o.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${b(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function vk(){return{localeError:oA()}}var sA=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(n){return t[n]??null}let r={regex:"regulj\xE4rt 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\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${a}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${x(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${r[o.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${b(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function bk(){return{localeError:sA()}}var aA=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(n){return t[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${x(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${b(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function _k(){return{localeError:aA()}}var cA=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(n){return t[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},i={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${x(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${b(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function wk(){return{localeError:cA()}}var lA=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??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\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${x(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function $k(){return{localeError:lA()}}var uA=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${x(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${b(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function iu(){return{localeError:uA()}}function kk(){return iu()}var dA=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(n){return t[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},i={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${x(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${b(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${o}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${o}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${b(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function xk(){return{localeError:dA()}}var pA=()=>{let t={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function e(n){return t[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${a}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${x(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[o.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function Sk(){return{localeError:pA()}}var fA=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(n){return t[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 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\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},i={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${x(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${r[o.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${b(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function Ik(){return{localeError:fA()}}var mA=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(n){return t[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},i={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${x(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${r[o.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${b(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function Tk(){return{localeError:mA()}}var hA=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(n){return t[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${x(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${b(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function Pk(){return{localeError:hA()}}var gA=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(n){return t[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",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:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},i={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=I(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${x(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${b(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${o}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.maximum}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${o}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.minimum}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${r[o.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${b(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function zk(){return{localeError:gA()}}var Ck,bh=Symbol("ZodOutput"),_h=Symbol("ZodInput"),ou=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let i=r[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let n={...i,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function su(){return new ou}(Ck=globalThis).__zod_globalRegistry??(Ck.__zod_globalRegistry=su());var Xe=globalThis.__zod_globalRegistry;function au(t,e){return new t({type:"string",...R(e)})}function wh(t,e){return new t({type:"string",coerce:!0,...R(e)})}function Cs(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...R(e)})}function Vi(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...R(e)})}function Rs(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...R(e)})}function Es(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(e)})}function As(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(e)})}function Os(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(e)})}function Hi(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...R(e)})}function Ns(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...R(e)})}function Ms(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(e)})}function js(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...R(e)})}function Ds(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(e)})}function Us(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...R(e)})}function Ls(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...R(e)})}function Zs(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(e)})}function Fs(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(e)})}function qs(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(e)})}function cu(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...R(e)})}function Vs(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(e)})}function Hs(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(e)})}function Ws(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...R(e)})}function Bs(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...R(e)})}function Js(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...R(e)})}function Gs(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...R(e)})}var $h={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function kh(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(e)})}function xh(t,e){return new t({type:"string",format:"date",check:"string_format",...R(e)})}function Sh(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...R(e)})}function Ih(t,e){return new t({type:"string",format:"duration",check:"string_format",...R(e)})}function lu(t,e){return new t({type:"number",checks:[],...R(e)})}function Th(t,e){return new t({type:"number",coerce:!0,checks:[],...R(e)})}function uu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...R(e)})}function du(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...R(e)})}function pu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...R(e)})}function fu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...R(e)})}function mu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...R(e)})}function hu(t,e){return new t({type:"boolean",...R(e)})}function Ph(t,e){return new t({type:"boolean",coerce:!0,...R(e)})}function gu(t,e){return new t({type:"bigint",...R(e)})}function zh(t,e){return new t({type:"bigint",coerce:!0,...R(e)})}function yu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...R(e)})}function vu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...R(e)})}function bu(t,e){return new t({type:"symbol",...R(e)})}function _u(t,e){return new t({type:"undefined",...R(e)})}function wu(t,e){return new t({type:"null",...R(e)})}function $u(t){return new t({type:"any"})}function ku(t){return new t({type:"unknown"})}function xu(t,e){return new t({type:"never",...R(e)})}function Su(t,e){return new t({type:"void",...R(e)})}function Iu(t,e){return new t({type:"date",...R(e)})}function Ch(t,e){return new t({type:"date",coerce:!0,...R(e)})}function Tu(t,e){return new t({type:"nan",...R(e)})}function dr(t,e){return new Bc({check:"less_than",...R(e),value:t,inclusive:!1})}function Mt(t,e){return new Bc({check:"less_than",...R(e),value:t,inclusive:!0})}function pr(t,e){return new Jc({check:"greater_than",...R(e),value:t,inclusive:!1})}function mt(t,e){return new Jc({check:"greater_than",...R(e),value:t,inclusive:!0})}function Pu(t){return pr(0,t)}function zu(t){return dr(0,t)}function Cu(t){return Mt(0,t)}function Ru(t){return mt(0,t)}function rn(t,e){return new Wm({check:"multiple_of",...R(e),value:t})}function nn(t,e){return new Gm({check:"max_size",...R(e),maximum:t})}function fr(t,e){return new Km({check:"min_size",...R(e),minimum:t})}function Nn(t,e){return new Xm({check:"size_equals",...R(e),size:t})}function Mn(t,e){return new Ym({check:"max_length",...R(e),maximum:t})}function Cr(t,e){return new Qm({check:"min_length",...R(e),minimum:t})}function jn(t,e){return new eh({check:"length_equals",...R(e),length:t})}function Wi(t,e){return new th({check:"string_format",format:"regex",...R(e),pattern:t})}function Bi(t){return new rh({check:"string_format",format:"lowercase",...R(t)})}function Ji(t){return new nh({check:"string_format",format:"uppercase",...R(t)})}function Gi(t,e){return new ih({check:"string_format",format:"includes",...R(e),includes:t})}function Ki(t,e){return new oh({check:"string_format",format:"starts_with",...R(e),prefix:t})}function Xi(t,e){return new sh({check:"string_format",format:"ends_with",...R(e),suffix:t})}function Eu(t,e,r){return new ah({check:"property",property:t,schema:e,...R(r)})}function Yi(t,e){return new ch({check:"mime_type",mime:t,...R(e)})}function Xt(t){return new lh({check:"overwrite",tx:t})}function Qi(t){return Xt(e=>e.normalize(t))}function eo(){return Xt(t=>t.trim())}function to(){return Xt(t=>t.toLowerCase())}function ro(){return Xt(t=>t.toUpperCase())}function no(){return Xt(t=>cm(t))}function Rh(t,e,r){return new t({type:"array",element:e,...R(r)})}function vA(t,e,r){return new t({type:"union",options:e,...R(r)})}function bA(t,e,r){return new t({type:"union",options:e,inclusive:!1,...R(r)})}function _A(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...R(i)})}function wA(t,e,r){return new t({type:"intersection",left:e,right:r})}function $A(t,e,r,i){let n=r instanceof G,o=n?i:r,s=n?r:null;return new t({type:"tuple",items:e,rest:s,...R(o)})}function kA(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...R(i)})}function xA(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...R(i)})}function SA(t,e,r){return new t({type:"set",valueType:e,...R(r)})}function IA(t,e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...R(r)})}function TA(t,e,r){return new t({type:"enum",entries:e,...R(r)})}function PA(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...R(r)})}function Au(t,e){return new t({type:"file",...R(e)})}function zA(t,e){return new t({type:"transform",transform:e})}function CA(t,e){return new t({type:"optional",innerType:e})}function RA(t,e){return new t({type:"nullable",innerType:e})}function EA(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():Mc(r)}})}function AA(t,e,r){return new t({type:"nonoptional",innerType:e,...R(r)})}function OA(t,e){return new t({type:"success",innerType:e})}function NA(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function MA(t,e,r){return new t({type:"pipe",in:e,out:r})}function jA(t,e){return new t({type:"readonly",innerType:e})}function DA(t,e,r){return new t({type:"template_literal",parts:e,...R(r)})}function UA(t,e){return new t({type:"lazy",getter:e})}function LA(t,e){return new t({type:"promise",innerType:e})}function Ou(t,e,r){let i=R(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function Nu(t,e,r){return new t({type:"custom",check:"custom",fn:e,...R(r)})}function Mu(t,e){let r=Rk(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(Ai(n,i.value,r._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),i.issues.push(Ai(o))}},t(i.value,i)),e);return r}function Rk(t,e){let r=new Se({check:"custom",...R(e)});return r._zod.check=t,r}function ju(t){let e=new Se({check:"describe"});return e._zod.onattach=[r=>{let i=Xe.get(r)??{};Xe.add(r,{...i,description:t})}],e._zod.check=()=>{},e}function Du(t){let e=new Se({check:"meta"});return e._zod.onattach=[r=>{let i=Xe.get(r)??{};Xe.add(r,{...i,...t})}],e._zod.check=()=>{},e}function Uu(t,e){let r=R(e),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let o=new Set(i),s=new Set(n),a=t.Codec??Zi,c=t.Boolean??Ui,l=t.String??tn,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new a({type:"pipe",in:u,out:d,transform:(f,m)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:p,continue:!1}),{})},reverseTransform:(f,m)=>f===!0?i[0]||"true":n[0]||"false",error:r.error});return p}function Dn(t,e,r,i={}){let n=R(i),o={...R(i),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(o.pattern=r),new t(o)}function on(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Xe,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function be(t,e,r={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s);let a=t._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,u);else{let p=s.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,u)}let d=t._zod.parent;d&&(s.ref||(s.ref=d),be(d,e,u),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(s.schema,c),e.io==="input"&&ht(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function sn(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let s of t.seen.entries()){let a=t.metadataRegistry.get(s[0])?.id;if(a){let c=i.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let n=s=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(s[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=s[1].defId??s[1].schema.id??`schema${t.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(s[1]===r)return{ref:"#"};let l=`#/${a}/`,u=s[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:l+u}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=n(s);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(t.cycles==="throw")for(let s of t.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
94
|
+
|
|
95
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){o(s);continue}if(t.external){let l=t.external.registry.get(s[0])?.id;if(e!==s[0]&&l){o(s);continue}}if(t.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&t.reused==="ref"){o(s);continue}}}function an(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=t.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){i(d);let f=t.seen.get(d),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),a._zod.parent===d)for(let y in l)y==="$ref"||y==="allOf"||y in u||delete l[y];if(m.$ref&&f.def)for(let y in l)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(l[y])===JSON.stringify(f.def[y])&&delete l[y]}let p=a._zod.parent;if(p&&p!==d){i(p);let f=t.seen.get(p);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let m in l)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(l[m])===JSON.stringify(f.def[m])&&delete l[m]}t.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())i(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let o=t.metadataRegistry.get(e)?.id;o!==void 0&&n.id===o&&delete n.id;let s=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:io(e,"input",t.processors),output:io(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ht(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return ht(i.element,r);if(i.type==="set")return ht(i.valueType,r);if(i.type==="lazy")return ht(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return ht(i.innerType,r);if(i.type==="intersection")return ht(i.left,r)||ht(i.right,r);if(i.type==="record"||i.type==="map")return ht(i.keyType,r)||ht(i.valueType,r);if(i.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:ht(i.in,r)||ht(i.out,r);if(i.type==="object"){for(let n in i.shape)if(ht(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(ht(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(ht(n,r))return!0;return!!(i.rest&&ht(i.rest,r))}return!1}var Eh=(t,e={})=>r=>{let i=on({...r,processors:e});return be(t,i),sn(i,t),an(i,t)},io=(t,e,r={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=on({...n??{},target:o,io:e,processors:r});return be(t,s),sn(s,t),an(s,t)};var ZA={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ah=(t,e,r,i)=>{let n=r;n.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof o=="number"&&(n.minLength=o),typeof s=="number"&&(n.maxLength=s),a&&(n.format=ZA[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?n.pattern=u[0].source:u.length>1&&(n.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Oh=(t,e,r,i)=>{let n=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof u=="number"&&u>=(o??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof o=="number"&&(n.minimum=o),p?f?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:typeof s=="number"&&(n.maximum=s),typeof c=="number"&&(n.multipleOf=c)},Nh=(t,e,r,i)=>{r.type="boolean"},Mh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},jh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Dh=(t,e,r,i)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Uh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Lh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Zh=(t,e,r,i)=>{r.not={}},Fh=(t,e,r,i)=>{},qh=(t,e,r,i)=>{},Vh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Hh=(t,e,r,i)=>{let n=t._zod.def,o=fs(n.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},Wh=(t,e,r,i)=>{let n=t._zod.def,o=[];for(let s of n.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},Bh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Jh=(t,e,r,i)=>{let n=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},Gh=(t,e,r,i)=>{let n=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=t._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(n,o)):(Object.assign(n,o),n.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(n,o)},Kh=(t,e,r,i)=>{r.type="boolean"},Xh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Yh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Qh=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},eg=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},tg=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},rg=(t,e,r,i)=>{let n=r,o=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=be(o.element,e,{...i,path:[...i.path,"items"]})},ng=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="object",n.properties={};let s=o.shape;for(let l in s)n.properties[l]=be(s[l],e,{...i,path:[...i.path,"properties",l]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(l=>{let u=o.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(n.required=Array.from(c)),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall?o.catchall&&(n.additionalProperties=be(o.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},Zu=(t,e,r,i)=>{let n=t._zod.def,o=n.inclusive===!1,s=n.options.map((a,c)=>be(a,e,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},ig=(t,e,r,i)=>{let n=t._zod.def,o=be(n.left,e,{...i,path:[...i.path,"allOf",0]}),s=be(n.right,e,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c},og=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((p,f)=>be(p,e,{...i,path:[...i.path,s,f]})),l=o.rest?be(o.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(n.prefixItems=c,l&&(n.items=l)):e.target==="openapi-3.0"?(n.items={anyOf:c},l&&n.items.anyOf.push(l),n.minItems=c.length,l||(n.maxItems=c.length)):(n.items=c,l&&(n.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(n.minItems=u),typeof d=="number"&&(n.maxItems=d)},sg=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let u=be(o.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=be(o.keyType,e,{...i,path:[...i.path,"propertyNames"]})),n.additionalProperties=be(o.valueType,e,{...i,path:[...i.path,"additionalProperties"]});let l=s._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(n.required=u)}},ag=(t,e,r,i)=>{let n=t._zod.def,o=be(n.innerType,e,i),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},cg=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},lg=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},ug=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},dg=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},pg=(t,e,r,i)=>{let n=t._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?o?n.out:n.in:n.out;be(s,e,i);let a=e.seen.get(t);a.ref=s},fg=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,r.readOnly=!0},mg=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},Fu=(t,e,r,i)=>{let n=t._zod.def;be(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},hg=(t,e,r,i)=>{let n=t._zod.innerType;be(n,e,i);let o=e.seen.get(t);o.ref=n},Lu={string:Ah,number:Oh,boolean:Nh,bigint:Mh,symbol:jh,null:Dh,undefined:Uh,void:Lh,never:Zh,any:Fh,unknown:qh,date:Vh,enum:Hh,literal:Wh,nan:Bh,template_literal:Jh,file:Gh,success:Kh,custom:Xh,function:Yh,transform:Qh,map:eg,set:tg,array:rg,object:ng,union:Zu,intersection:ig,tuple:og,record:sg,nullable:ag,nonoptional:cg,default:lg,prefault:ug,catch:dg,pipe:pg,readonly:fg,promise:mg,optional:Fu,lazy:hg};function Un(t,e){if("_idmap"in t){let i=t,n=on({...e,processors:Lu}),o={};for(let c of i._idmap.entries()){let[l,u]=c;be(u,n)}let s={},a={registry:i,uri:e?.uri,defs:o};n.external=a;for(let c of i._idmap.entries()){let[l,u]=c;sn(n,u),s[l]=an(n,u)}if(Object.keys(o).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=on({...e,processors:Lu});return be(t,r),sn(r,t),an(r,t)}var qu=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=on({processors:Lu,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return be(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),sn(this.ctx,e);let i=an(this.ctx,e),{"~standard":n,...o}=i;return o}};var Ek={};var VA=v("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");G.init(t,e),t.def=e,t.type=e.type,t.parse=(r,i)=>En(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>Qr(t,r,i),t.parseAsync=async(r,i)=>An(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>en(t,r,i),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),t.with=t.check,t.clone=(r,i)=>Ke(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.apply=r=>r(t)});var HA=v("ZodMiniObject",(t,e)=>{Rl.init(t,e),VA.init(t,e),Q(t,"shape",()=>e.shape)});function gg(t,e){let r={type:"object",shape:t??{},...R(e)};return new HA(r)}function St(t){return!!t._zod}function Ln(t){let e=Object.values(t);if(e.length===0)return gg({});let r=e.every(St),i=e.every(n=>!St(n));if(r)return gg(t);if(i)return Lw(t);throw new Error("Mixed Zod versions detected in object shape.")}function gt(t,e){return St(t)?Qr(t,e):t.safeParse(e)}async function Vu(t,e){return St(t)?await en(t,e):await t.safeParseAsync(e)}function mr(t){if(!t)return;let e;if(St(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function oo(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let i=Object.values(t);if(i.length>0&&i.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Ln(t)}}if(St(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Hu(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Ak(t){return t.description}function Ok(t){if(St(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function Wu(t){if(St(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=t.value;if(i!==void 0)return i}var H={};xr(H,{$brand:()=>im,$input:()=>_h,$output:()=>bh,NEVER:()=>ds,TimePrecision:()=>$h,ZodAny:()=>jg,ZodArray:()=>Zg,ZodBase64:()=>md,ZodBase64URL:()=>hd,ZodBigInt:()=>fo,ZodBigIntFormat:()=>vd,ZodBoolean:()=>po,ZodCIDRv4:()=>pd,ZodCIDRv6:()=>fd,ZodCUID:()=>od,ZodCUID2:()=>sd,ZodCatch:()=>ay,ZodCodec:()=>sa,ZodCustom:()=>aa,ZodCustomStringFormat:()=>lo,ZodDate:()=>ta,ZodDefault:()=>ty,ZodDiscriminatedUnion:()=>qg,ZodE164:()=>gd,ZodEmail:()=>td,ZodEmoji:()=>nd,ZodEnum:()=>ao,ZodError:()=>BA,ZodExactOptional:()=>Yg,ZodFile:()=>Kg,ZodFirstPartyTypeKind:()=>_y,ZodFunction:()=>yy,ZodGUID:()=>Xs,ZodIPv4:()=>ud,ZodIPv6:()=>dd,ZodISODate:()=>Gu,ZodISODateTime:()=>Ju,ZodISODuration:()=>Xu,ZodISOTime:()=>Ku,ZodIntersection:()=>Vg,ZodIssueCode:()=>wy,ZodJWT:()=>yd,ZodKSUID:()=>ld,ZodLazy:()=>my,ZodLiteral:()=>Gg,ZodMAC:()=>Ag,ZodMap:()=>Bg,ZodNaN:()=>ly,ZodNanoID:()=>id,ZodNever:()=>Ug,ZodNonOptional:()=>$d,ZodNull:()=>Mg,ZodNullable:()=>ey,ZodNumber:()=>uo,ZodNumberFormat:()=>Zn,ZodObject:()=>ra,ZodOptional:()=>go,ZodPipe:()=>oa,ZodPrefault:()=>ny,ZodPreprocess:()=>uy,ZodPromise:()=>gy,ZodReadonly:()=>dy,ZodRealError:()=>It,ZodRecord:()=>so,ZodSet:()=>Jg,ZodString:()=>co,ZodStringFormat:()=>Ie,ZodSuccess:()=>sy,ZodSymbol:()=>Og,ZodTemplateLiteral:()=>fy,ZodTransform:()=>Xg,ZodTuple:()=>Hg,ZodType:()=>Y,ZodULID:()=>ad,ZodURL:()=>ea,ZodUUID:()=>hr,ZodUndefined:()=>Ng,ZodUnion:()=>na,ZodUnknown:()=>Dg,ZodVoid:()=>Lg,ZodXID:()=>cd,ZodXor:()=>Fg,_ZodString:()=>ed,_default:()=>ry,_function:()=>jx,any:()=>bd,array:()=>E,base64:()=>rx,base64url:()=>nx,bigint:()=>mx,boolean:()=>_e,catch:()=>cy,check:()=>Dx,cidrv4:()=>ex,cidrv6:()=>tx,clone:()=>Ke,codec:()=>Ax,coerce:()=>la,config:()=>Ue,core:()=>Yt,cuid:()=>Wk,cuid2:()=>Bk,custom:()=>kd,date:()=>_x,decode:()=>Ig,decodeAsync:()=>Pg,describe:()=>Ux,discriminatedUnion:()=>ia,e164:()=>ix,email:()=>jk,emoji:()=>Vk,encode:()=>Sg,encodeAsync:()=>Tg,endsWith:()=>Xi,enum:()=>Ye,exactOptional:()=>Qg,file:()=>zx,flattenError:()=>bs,float32:()=>ux,float64:()=>dx,formatError:()=>_s,fromJSONSchema:()=>Hx,function:()=>jx,getErrorMap:()=>KA,globalRegistry:()=>Xe,gt:()=>pr,gte:()=>mt,guid:()=>Dk,hash:()=>lx,hex:()=>cx,hostname:()=>ax,httpUrl:()=>qk,includes:()=>Gi,instanceof:()=>Zx,int:()=>Yu,int32:()=>px,int64:()=>hx,intersection:()=>ho,invertCodec:()=>Ox,ipv4:()=>Xk,ipv6:()=>Qk,iso:()=>cn,json:()=>qx,jwt:()=>ox,keyof:()=>wx,ksuid:()=>Kk,lazy:()=>hy,length:()=>jn,literal:()=>Z,locales:()=>qi,looseObject:()=>Le,looseRecord:()=>Sx,lowercase:()=>Bi,lt:()=>dr,lte:()=>Mt,mac:()=>Yk,map:()=>Ix,maxLength:()=>Mn,maxSize:()=>nn,meta:()=>Lx,mime:()=>Yi,minLength:()=>Cr,minSize:()=>fr,multipleOf:()=>rn,nan:()=>Ex,nanoid:()=>Hk,nativeEnum:()=>Px,negative:()=>zu,never:()=>_d,nonnegative:()=>Ru,nonoptional:()=>oy,nonpositive:()=>Cu,normalize:()=>Qi,null:()=>mo,nullable:()=>Ys,nullish:()=>Cx,number:()=>pe,object:()=>A,optional:()=>Ee,overwrite:()=>Xt,parse:()=>wg,parseAsync:()=>$g,partialRecord:()=>xx,pipe:()=>Qu,positive:()=>Pu,prefault:()=>iy,preprocess:()=>ca,prettifyError:()=>gm,promise:()=>Mx,property:()=>Eu,readonly:()=>py,record:()=>Ce,refine:()=>vy,regex:()=>Wi,regexes:()=>xt,registry:()=>su,safeDecode:()=>Cg,safeDecodeAsync:()=>Eg,safeEncode:()=>zg,safeEncodeAsync:()=>Rg,safeParse:()=>kg,safeParseAsync:()=>xg,set:()=>Tx,setErrorMap:()=>GA,size:()=>Nn,slugify:()=>no,startsWith:()=>Ki,strictObject:()=>$x,string:()=>g,stringFormat:()=>sx,stringbool:()=>Fx,success:()=>Rx,superRefine:()=>by,symbol:()=>yx,templateLiteral:()=>Nx,toJSONSchema:()=>Un,toLowerCase:()=>to,toUpperCase:()=>ro,transform:()=>wd,treeifyError:()=>hm,trim:()=>eo,tuple:()=>Wg,uint32:()=>fx,uint64:()=>gx,ulid:()=>Jk,undefined:()=>vx,union:()=>ke,unknown:()=>Te,uppercase:()=>Ji,url:()=>rd,util:()=>T,uuid:()=>Uk,uuidv4:()=>Lk,uuidv6:()=>Zk,uuidv7:()=>Fk,void:()=>bx,xid:()=>Gk,xor:()=>kx});var Ks={};xr(Ks,{ZodAny:()=>jg,ZodArray:()=>Zg,ZodBase64:()=>md,ZodBase64URL:()=>hd,ZodBigInt:()=>fo,ZodBigIntFormat:()=>vd,ZodBoolean:()=>po,ZodCIDRv4:()=>pd,ZodCIDRv6:()=>fd,ZodCUID:()=>od,ZodCUID2:()=>sd,ZodCatch:()=>ay,ZodCodec:()=>sa,ZodCustom:()=>aa,ZodCustomStringFormat:()=>lo,ZodDate:()=>ta,ZodDefault:()=>ty,ZodDiscriminatedUnion:()=>qg,ZodE164:()=>gd,ZodEmail:()=>td,ZodEmoji:()=>nd,ZodEnum:()=>ao,ZodExactOptional:()=>Yg,ZodFile:()=>Kg,ZodFunction:()=>yy,ZodGUID:()=>Xs,ZodIPv4:()=>ud,ZodIPv6:()=>dd,ZodIntersection:()=>Vg,ZodJWT:()=>yd,ZodKSUID:()=>ld,ZodLazy:()=>my,ZodLiteral:()=>Gg,ZodMAC:()=>Ag,ZodMap:()=>Bg,ZodNaN:()=>ly,ZodNanoID:()=>id,ZodNever:()=>Ug,ZodNonOptional:()=>$d,ZodNull:()=>Mg,ZodNullable:()=>ey,ZodNumber:()=>uo,ZodNumberFormat:()=>Zn,ZodObject:()=>ra,ZodOptional:()=>go,ZodPipe:()=>oa,ZodPrefault:()=>ny,ZodPreprocess:()=>uy,ZodPromise:()=>gy,ZodReadonly:()=>dy,ZodRecord:()=>so,ZodSet:()=>Jg,ZodString:()=>co,ZodStringFormat:()=>Ie,ZodSuccess:()=>sy,ZodSymbol:()=>Og,ZodTemplateLiteral:()=>fy,ZodTransform:()=>Xg,ZodTuple:()=>Hg,ZodType:()=>Y,ZodULID:()=>ad,ZodURL:()=>ea,ZodUUID:()=>hr,ZodUndefined:()=>Ng,ZodUnion:()=>na,ZodUnknown:()=>Dg,ZodVoid:()=>Lg,ZodXID:()=>cd,ZodXor:()=>Fg,_ZodString:()=>ed,_default:()=>ry,_function:()=>jx,any:()=>bd,array:()=>E,base64:()=>rx,base64url:()=>nx,bigint:()=>mx,boolean:()=>_e,catch:()=>cy,check:()=>Dx,cidrv4:()=>ex,cidrv6:()=>tx,codec:()=>Ax,cuid:()=>Wk,cuid2:()=>Bk,custom:()=>kd,date:()=>_x,describe:()=>Ux,discriminatedUnion:()=>ia,e164:()=>ix,email:()=>jk,emoji:()=>Vk,enum:()=>Ye,exactOptional:()=>Qg,file:()=>zx,float32:()=>ux,float64:()=>dx,function:()=>jx,guid:()=>Dk,hash:()=>lx,hex:()=>cx,hostname:()=>ax,httpUrl:()=>qk,instanceof:()=>Zx,int:()=>Yu,int32:()=>px,int64:()=>hx,intersection:()=>ho,invertCodec:()=>Ox,ipv4:()=>Xk,ipv6:()=>Qk,json:()=>qx,jwt:()=>ox,keyof:()=>wx,ksuid:()=>Kk,lazy:()=>hy,literal:()=>Z,looseObject:()=>Le,looseRecord:()=>Sx,mac:()=>Yk,map:()=>Ix,meta:()=>Lx,nan:()=>Ex,nanoid:()=>Hk,nativeEnum:()=>Px,never:()=>_d,nonoptional:()=>oy,null:()=>mo,nullable:()=>Ys,nullish:()=>Cx,number:()=>pe,object:()=>A,optional:()=>Ee,partialRecord:()=>xx,pipe:()=>Qu,prefault:()=>iy,preprocess:()=>ca,promise:()=>Mx,readonly:()=>py,record:()=>Ce,refine:()=>vy,set:()=>Tx,strictObject:()=>$x,string:()=>g,stringFormat:()=>sx,stringbool:()=>Fx,success:()=>Rx,superRefine:()=>by,symbol:()=>yx,templateLiteral:()=>Nx,transform:()=>wd,tuple:()=>Wg,uint32:()=>fx,uint64:()=>gx,ulid:()=>Jk,undefined:()=>vx,union:()=>ke,unknown:()=>Te,url:()=>rd,uuid:()=>Uk,uuidv4:()=>Lk,uuidv6:()=>Zk,uuidv7:()=>Fk,void:()=>bx,xid:()=>Gk,xor:()=>kx});var Bu={};xr(Bu,{endsWith:()=>Xi,gt:()=>pr,gte:()=>mt,includes:()=>Gi,length:()=>jn,lowercase:()=>Bi,lt:()=>dr,lte:()=>Mt,maxLength:()=>Mn,maxSize:()=>nn,mime:()=>Yi,minLength:()=>Cr,minSize:()=>fr,multipleOf:()=>rn,negative:()=>zu,nonnegative:()=>Ru,nonpositive:()=>Cu,normalize:()=>Qi,overwrite:()=>Xt,positive:()=>Pu,property:()=>Eu,regex:()=>Wi,size:()=>Nn,slugify:()=>no,startsWith:()=>Ki,toLowerCase:()=>to,toUpperCase:()=>ro,trim:()=>eo,uppercase:()=>Ji});var cn={};xr(cn,{ZodISODate:()=>Gu,ZodISODateTime:()=>Ju,ZodISODuration:()=>Xu,ZodISOTime:()=>Ku,date:()=>vg,datetime:()=>yg,duration:()=>_g,time:()=>bg});var Ju=v("ZodISODateTime",(t,e)=>{ph.init(t,e),Ie.init(t,e)});function yg(t){return kh(Ju,t)}var Gu=v("ZodISODate",(t,e)=>{fh.init(t,e),Ie.init(t,e)});function vg(t){return xh(Gu,t)}var Ku=v("ZodISOTime",(t,e)=>{mh.init(t,e),Ie.init(t,e)});function bg(t){return Sh(Ku,t)}var Xu=v("ZodISODuration",(t,e)=>{hh.init(t,e),Ie.init(t,e)});function _g(t){return Ih(Xu,t)}var Nk=(t,e)=>{vs.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>_s(t,r)},flatten:{value:r=>bs(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Ri,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Ri,2)}},isEmpty:{get(){return t.issues.length===0}}})},BA=v("ZodError",Nk),It=v("ZodError",Nk,{Parent:Error});var wg=Oi(It),$g=Ni(It),kg=Mi(It),xg=ji(It),Sg=jc(It),Ig=Dc(It),Tg=Uc(It),Pg=Lc(It),zg=Zc(It),Cg=Fc(It),Rg=qc(It),Eg=Vc(It);var Mk=new WeakMap;function Qs(t,e,r){let i=Object.getPrototypeOf(t),n=Mk.get(i);if(n||(n=new Set,Mk.set(i,n)),!n.has(e)){n.add(e);for(let o in r){let s=r[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Y=v("ZodType",(t,e)=>(G.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:io(t,"input"),output:io(t,"output")}}),t.toJSONSchema=Eh(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,i)=>wg(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>kg(t,r,i),t.parseAsync=async(r,i)=>$g(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>xg(t,r,i),t.spa=t.safeParseAsync,t.encode=(r,i)=>Sg(t,r,i),t.decode=(r,i)=>Ig(t,r,i),t.encodeAsync=async(r,i)=>Tg(t,r,i),t.decodeAsync=async(r,i)=>Pg(t,r,i),t.safeEncode=(r,i)=>zg(t,r,i),t.safeDecode=(r,i)=>Cg(t,r,i),t.safeEncodeAsync=async(r,i)=>Rg(t,r,i),t.safeDecodeAsync=async(r,i)=>Eg(t,r,i),Qs(t,"ZodType",{check(...r){let i=this.def;return this.clone(T.mergeDefs(i,{checks:[...i.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,i){return Ke(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(vy(r,i))},superRefine(r,i){return this.check(by(r,i))},overwrite(r){return this.check(Xt(r))},optional(){return Ee(this)},exactOptional(){return Qg(this)},nullable(){return Ys(this)},nullish(){return Ee(Ys(this))},nonoptional(r){return oy(this,r)},array(){return E(this)},or(r){return ke([this,r])},and(r){return ho(this,r)},transform(r){return Qu(this,wd(r))},default(r){return ry(this,r)},prefault(r){return iy(this,r)},catch(r){return cy(this,r)},pipe(r){return Qu(this,r)},readonly(){return py(this)},describe(r){let i=this.clone();return Xe.add(i,{description:r}),i},meta(...r){if(r.length===0)return Xe.get(this);let i=this.clone();return Xe.add(i,r[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return Xe.get(t)?.description},configurable:!0}),t)),ed=v("_ZodString",(t,e)=>{tn.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(i,n,o)=>Ah(t,i,n,o);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Qs(t,"_ZodString",{regex(...i){return this.check(Wi(...i))},includes(...i){return this.check(Gi(...i))},startsWith(...i){return this.check(Ki(...i))},endsWith(...i){return this.check(Xi(...i))},min(...i){return this.check(Cr(...i))},max(...i){return this.check(Mn(...i))},length(...i){return this.check(jn(...i))},nonempty(...i){return this.check(Cr(1,...i))},lowercase(i){return this.check(Bi(i))},uppercase(i){return this.check(Ji(i))},trim(){return this.check(eo())},normalize(...i){return this.check(Qi(...i))},toLowerCase(){return this.check(to())},toUpperCase(){return this.check(ro())},slugify(){return this.check(no())}})}),co=v("ZodString",(t,e)=>{tn.init(t,e),ed.init(t,e),t.email=r=>t.check(Cs(td,r)),t.url=r=>t.check(Hi(ea,r)),t.jwt=r=>t.check(Gs(yd,r)),t.emoji=r=>t.check(Ns(nd,r)),t.guid=r=>t.check(Vi(Xs,r)),t.uuid=r=>t.check(Rs(hr,r)),t.uuidv4=r=>t.check(Es(hr,r)),t.uuidv6=r=>t.check(As(hr,r)),t.uuidv7=r=>t.check(Os(hr,r)),t.nanoid=r=>t.check(Ms(id,r)),t.guid=r=>t.check(Vi(Xs,r)),t.cuid=r=>t.check(js(od,r)),t.cuid2=r=>t.check(Ds(sd,r)),t.ulid=r=>t.check(Us(ad,r)),t.base64=r=>t.check(Ws(md,r)),t.base64url=r=>t.check(Bs(hd,r)),t.xid=r=>t.check(Ls(cd,r)),t.ksuid=r=>t.check(Zs(ld,r)),t.ipv4=r=>t.check(Fs(ud,r)),t.ipv6=r=>t.check(qs(dd,r)),t.cidrv4=r=>t.check(Vs(pd,r)),t.cidrv6=r=>t.check(Hs(fd,r)),t.e164=r=>t.check(Js(gd,r)),t.datetime=r=>t.check(yg(r)),t.date=r=>t.check(vg(r)),t.time=r=>t.check(bg(r)),t.duration=r=>t.check(_g(r))});function g(t){return au(co,t)}var Ie=v("ZodStringFormat",(t,e)=>{$e.init(t,e),ed.init(t,e)}),td=v("ZodEmail",(t,e)=>{tl.init(t,e),Ie.init(t,e)});function jk(t){return Cs(td,t)}var Xs=v("ZodGUID",(t,e)=>{Qc.init(t,e),Ie.init(t,e)});function Dk(t){return Vi(Xs,t)}var hr=v("ZodUUID",(t,e)=>{el.init(t,e),Ie.init(t,e)});function Uk(t){return Rs(hr,t)}function Lk(t){return Es(hr,t)}function Zk(t){return As(hr,t)}function Fk(t){return Os(hr,t)}var ea=v("ZodURL",(t,e)=>{rl.init(t,e),Ie.init(t,e)});function rd(t){return Hi(ea,t)}function qk(t){return Hi(ea,{protocol:xt.httpProtocol,hostname:xt.domain,...T.normalizeParams(t)})}var nd=v("ZodEmoji",(t,e)=>{nl.init(t,e),Ie.init(t,e)});function Vk(t){return Ns(nd,t)}var id=v("ZodNanoID",(t,e)=>{il.init(t,e),Ie.init(t,e)});function Hk(t){return Ms(id,t)}var od=v("ZodCUID",(t,e)=>{ol.init(t,e),Ie.init(t,e)});function Wk(t){return js(od,t)}var sd=v("ZodCUID2",(t,e)=>{sl.init(t,e),Ie.init(t,e)});function Bk(t){return Ds(sd,t)}var ad=v("ZodULID",(t,e)=>{al.init(t,e),Ie.init(t,e)});function Jk(t){return Us(ad,t)}var cd=v("ZodXID",(t,e)=>{cl.init(t,e),Ie.init(t,e)});function Gk(t){return Ls(cd,t)}var ld=v("ZodKSUID",(t,e)=>{ll.init(t,e),Ie.init(t,e)});function Kk(t){return Zs(ld,t)}var ud=v("ZodIPv4",(t,e)=>{ul.init(t,e),Ie.init(t,e)});function Xk(t){return Fs(ud,t)}var Ag=v("ZodMAC",(t,e)=>{pl.init(t,e),Ie.init(t,e)});function Yk(t){return cu(Ag,t)}var dd=v("ZodIPv6",(t,e)=>{dl.init(t,e),Ie.init(t,e)});function Qk(t){return qs(dd,t)}var pd=v("ZodCIDRv4",(t,e)=>{fl.init(t,e),Ie.init(t,e)});function ex(t){return Vs(pd,t)}var fd=v("ZodCIDRv6",(t,e)=>{ml.init(t,e),Ie.init(t,e)});function tx(t){return Hs(fd,t)}var md=v("ZodBase64",(t,e)=>{hl.init(t,e),Ie.init(t,e)});function rx(t){return Ws(md,t)}var hd=v("ZodBase64URL",(t,e)=>{gl.init(t,e),Ie.init(t,e)});function nx(t){return Bs(hd,t)}var gd=v("ZodE164",(t,e)=>{yl.init(t,e),Ie.init(t,e)});function ix(t){return Js(gd,t)}var yd=v("ZodJWT",(t,e)=>{vl.init(t,e),Ie.init(t,e)});function ox(t){return Gs(yd,t)}var lo=v("ZodCustomStringFormat",(t,e)=>{bl.init(t,e),Ie.init(t,e)});function sx(t,e,r={}){return Dn(lo,t,e,r)}function ax(t){return Dn(lo,"hostname",xt.hostname,t)}function cx(t){return Dn(lo,"hex",xt.hex,t)}function lx(t,e){let r=e?.enc??"hex",i=`${t}_${r}`,n=xt[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return Dn(lo,i,n,e)}var uo=v("ZodNumber",(t,e)=>{xs.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(i,n,o)=>Oh(t,i,n,o),Qs(t,"ZodNumber",{gt(i,n){return this.check(pr(i,n))},gte(i,n){return this.check(mt(i,n))},min(i,n){return this.check(mt(i,n))},lt(i,n){return this.check(dr(i,n))},lte(i,n){return this.check(Mt(i,n))},max(i,n){return this.check(Mt(i,n))},int(i){return this.check(Yu(i))},safe(i){return this.check(Yu(i))},positive(i){return this.check(pr(0,i))},nonnegative(i){return this.check(mt(0,i))},negative(i){return this.check(dr(0,i))},nonpositive(i){return this.check(Mt(0,i))},multipleOf(i,n){return this.check(rn(i,n))},step(i,n){return this.check(rn(i,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function pe(t){return lu(uo,t)}var Zn=v("ZodNumberFormat",(t,e)=>{_l.init(t,e),uo.init(t,e)});function Yu(t){return uu(Zn,t)}function ux(t){return du(Zn,t)}function dx(t){return pu(Zn,t)}function px(t){return fu(Zn,t)}function fx(t){return mu(Zn,t)}var po=v("ZodBoolean",(t,e)=>{Ui.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Nh(t,r,i,n)});function _e(t){return hu(po,t)}var fo=v("ZodBigInt",(t,e)=>{Ss.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(i,n,o)=>Mh(t,i,n,o),t.gte=(i,n)=>t.check(mt(i,n)),t.min=(i,n)=>t.check(mt(i,n)),t.gt=(i,n)=>t.check(pr(i,n)),t.gte=(i,n)=>t.check(mt(i,n)),t.min=(i,n)=>t.check(mt(i,n)),t.lt=(i,n)=>t.check(dr(i,n)),t.lte=(i,n)=>t.check(Mt(i,n)),t.max=(i,n)=>t.check(Mt(i,n)),t.positive=i=>t.check(pr(BigInt(0),i)),t.negative=i=>t.check(dr(BigInt(0),i)),t.nonpositive=i=>t.check(Mt(BigInt(0),i)),t.nonnegative=i=>t.check(mt(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(rn(i,n));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function mx(t){return gu(fo,t)}var vd=v("ZodBigIntFormat",(t,e)=>{wl.init(t,e),fo.init(t,e)});function hx(t){return yu(vd,t)}function gx(t){return vu(vd,t)}var Og=v("ZodSymbol",(t,e)=>{$l.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>jh(t,r,i,n)});function yx(t){return bu(Og,t)}var Ng=v("ZodUndefined",(t,e)=>{kl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Uh(t,r,i,n)});function vx(t){return _u(Ng,t)}var Mg=v("ZodNull",(t,e)=>{xl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Dh(t,r,i,n)});function mo(t){return wu(Mg,t)}var jg=v("ZodAny",(t,e)=>{Sl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Fh(t,r,i,n)});function bd(){return $u(jg)}var Dg=v("ZodUnknown",(t,e)=>{Il.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>qh(t,r,i,n)});function Te(){return ku(Dg)}var Ug=v("ZodNever",(t,e)=>{Tl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Zh(t,r,i,n)});function _d(t){return xu(Ug,t)}var Lg=v("ZodVoid",(t,e)=>{Pl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Lh(t,r,i,n)});function bx(t){return Su(Lg,t)}var ta=v("ZodDate",(t,e)=>{zl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(i,n,o)=>Vh(t,i,n,o),t.min=(i,n)=>t.check(mt(i,n)),t.max=(i,n)=>t.check(Mt(i,n));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function _x(t){return Iu(ta,t)}var Zg=v("ZodArray",(t,e)=>{Cl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>rg(t,r,i,n),t.element=e.element,Qs(t,"ZodArray",{min(r,i){return this.check(Cr(r,i))},nonempty(r){return this.check(Cr(1,r))},max(r,i){return this.check(Mn(r,i))},length(r,i){return this.check(jn(r,i))},unwrap(){return this.element}})});function E(t,e){return Rh(Zg,t,e)}function wx(t){let e=t._zod.def.shape;return Ye(Object.keys(e))}var ra=v("ZodObject",(t,e)=>{yh.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ng(t,r,i,n),T.defineLazy(t,"shape",()=>e.shape),Qs(t,"ZodObject",{keyof(){return Ye(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Te()})},loose(){return this.clone({...this._zod.def,catchall:Te()})},strict(){return this.clone({...this._zod.def,catchall:_d()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return T.extend(this,r)},safeExtend(r){return T.safeExtend(this,r)},merge(r){return T.merge(this,r)},pick(r){return T.pick(this,r)},omit(r){return T.omit(this,r)},partial(...r){return T.partial(go,this,r[0])},required(...r){return T.required($d,this,r[0])}})});function A(t,e){let r={type:"object",shape:t??{},...T.normalizeParams(e)};return new ra(r)}function $x(t,e){return new ra({type:"object",shape:t,catchall:_d(),...T.normalizeParams(e)})}function Le(t,e){return new ra({type:"object",shape:t,catchall:Te(),...T.normalizeParams(e)})}var na=v("ZodUnion",(t,e)=>{Li.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Zu(t,r,i,n),t.options=e.options});function ke(t,e){return new na({type:"union",options:t,...T.normalizeParams(e)})}var Fg=v("ZodXor",(t,e)=>{na.init(t,e),El.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Zu(t,r,i,n),t.options=e.options});function kx(t,e){return new Fg({type:"union",options:t,inclusive:!1,...T.normalizeParams(e)})}var qg=v("ZodDiscriminatedUnion",(t,e)=>{na.init(t,e),Al.init(t,e)});function ia(t,e,r){return new qg({type:"union",options:e,discriminator:t,...T.normalizeParams(r)})}var Vg=v("ZodIntersection",(t,e)=>{Ol.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ig(t,r,i,n)});function ho(t,e){return new Vg({type:"intersection",left:t,right:e})}var Hg=v("ZodTuple",(t,e)=>{Is.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>og(t,r,i,n),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Wg(t,e,r){let i=e instanceof G,n=i?r:e,o=i?e:null;return new Hg({type:"tuple",items:t,rest:o,...T.normalizeParams(n)})}var so=v("ZodRecord",(t,e)=>{Nl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>sg(t,r,i,n),t.keyType=e.keyType,t.valueType=e.valueType});function Ce(t,e,r){return!e||!e._zod?new so({type:"record",keyType:g(),valueType:t,...T.normalizeParams(e)}):new so({type:"record",keyType:t,valueType:e,...T.normalizeParams(r)})}function xx(t,e,r){let i=Ke(t);return i._zod.values=void 0,new so({type:"record",keyType:i,valueType:e,...T.normalizeParams(r)})}function Sx(t,e,r){return new so({type:"record",keyType:t,valueType:e,mode:"loose",...T.normalizeParams(r)})}var Bg=v("ZodMap",(t,e)=>{Ml.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>eg(t,r,i,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(fr(...r)),t.nonempty=r=>t.check(fr(1,r)),t.max=(...r)=>t.check(nn(...r)),t.size=(...r)=>t.check(Nn(...r))});function Ix(t,e,r){return new Bg({type:"map",keyType:t,valueType:e,...T.normalizeParams(r)})}var Jg=v("ZodSet",(t,e)=>{jl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>tg(t,r,i,n),t.min=(...r)=>t.check(fr(...r)),t.nonempty=r=>t.check(fr(1,r)),t.max=(...r)=>t.check(nn(...r)),t.size=(...r)=>t.check(Nn(...r))});function Tx(t,e){return new Jg({type:"set",valueType:t,...T.normalizeParams(e)})}var ao=v("ZodEnum",(t,e)=>{Dl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(i,n,o)=>Hh(t,i,n,o),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{let o={};for(let s of i)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ao({...e,checks:[],...T.normalizeParams(n),entries:o})},t.exclude=(i,n)=>{let o={...e.entries};for(let s of i)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new ao({...e,checks:[],...T.normalizeParams(n),entries:o})}});function Ye(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new ao({type:"enum",entries:r,...T.normalizeParams(e)})}function Px(t,e){return new ao({type:"enum",entries:t,...T.normalizeParams(e)})}var Gg=v("ZodLiteral",(t,e)=>{Ul.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Wh(t,r,i,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Z(t,e){return new Gg({type:"literal",values:Array.isArray(t)?t:[t],...T.normalizeParams(e)})}var Kg=v("ZodFile",(t,e)=>{Ll.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Gh(t,r,i,n),t.min=(r,i)=>t.check(fr(r,i)),t.max=(r,i)=>t.check(nn(r,i)),t.mime=(r,i)=>t.check(Yi(Array.isArray(r)?r:[r],i))});function zx(t){return Au(Kg,t)}var Xg=v("ZodTransform",(t,e)=>{Zl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Qh(t,r,i,n),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Jr(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(T.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(T.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function wd(t){return new Xg({type:"transform",transform:t})}var go=v("ZodOptional",(t,e)=>{Ts.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Fu(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function Ee(t){return new go({type:"optional",innerType:t})}var Yg=v("ZodExactOptional",(t,e)=>{Fl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Fu(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function Qg(t){return new Yg({type:"optional",innerType:t})}var ey=v("ZodNullable",(t,e)=>{ql.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ag(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function Ys(t){return new ey({type:"nullable",innerType:t})}function Cx(t){return Ee(Ys(t))}var ty=v("ZodDefault",(t,e)=>{Vl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>lg(t,r,i,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ry(t,e){return new ty({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():T.shallowClone(e)}})}var ny=v("ZodPrefault",(t,e)=>{Hl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ug(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function iy(t,e){return new ny({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():T.shallowClone(e)}})}var $d=v("ZodNonOptional",(t,e)=>{Wl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>cg(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function oy(t,e){return new $d({type:"nonoptional",innerType:t,...T.normalizeParams(e)})}var sy=v("ZodSuccess",(t,e)=>{Bl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Kh(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function Rx(t){return new sy({type:"success",innerType:t})}var ay=v("ZodCatch",(t,e)=>{Jl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>dg(t,r,i,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function cy(t,e){return new ay({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var ly=v("ZodNaN",(t,e)=>{Gl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Bh(t,r,i,n)});function Ex(t){return Tu(ly,t)}var oa=v("ZodPipe",(t,e)=>{Ps.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>pg(t,r,i,n),t.in=e.in,t.out=e.out});function Qu(t,e){return new oa({type:"pipe",in:t,out:e})}var sa=v("ZodCodec",(t,e)=>{oa.init(t,e),Zi.init(t,e)});function Ax(t,e,r){return new sa({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function Ox(t){let e=t._zod.def;return new sa({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}var uy=v("ZodPreprocess",(t,e)=>{oa.init(t,e),vh.init(t,e)}),dy=v("ZodReadonly",(t,e)=>{Kl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>fg(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function py(t){return new dy({type:"readonly",innerType:t})}var fy=v("ZodTemplateLiteral",(t,e)=>{Xl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Jh(t,r,i,n)});function Nx(t,e){return new fy({type:"template_literal",parts:t,...T.normalizeParams(e)})}var my=v("ZodLazy",(t,e)=>{eu.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>hg(t,r,i,n),t.unwrap=()=>t._zod.def.getter()});function hy(t){return new my({type:"lazy",getter:t})}var gy=v("ZodPromise",(t,e)=>{Ql.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>mg(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});function Mx(t){return new gy({type:"promise",innerType:t})}var yy=v("ZodFunction",(t,e)=>{Yl.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Yh(t,r,i,n)});function jx(t){return new yy({type:"function",input:Array.isArray(t?.input)?Wg(t?.input):t?.input??E(Te()),output:t?.output??Te()})}var aa=v("ZodCustom",(t,e)=>{tu.init(t,e),Y.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Xh(t,r,i,n)});function Dx(t){let e=new Se({check:"custom"});return e._zod.check=t,e}function kd(t,e){return Ou(aa,t??(()=>!0),e)}function vy(t,e={}){return Nu(aa,t,e)}function by(t,e){return Mu(t,e)}var Ux=ju,Lx=Du;function Zx(t,e={}){let r=new aa({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...T.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=i=>{i.value instanceof t||i.issues.push({code:"invalid_type",expected:t.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Fx=(...t)=>Uu({Codec:sa,Boolean:po,String:co},...t);function qx(t){let e=hy(()=>ke([g(t),pe(),_e(),mo(),E(e),Ce(g(),e)]));return e}function ca(t,e){return new uy({type:"pipe",in:wd(t),out:e})}var wy={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 GA(t){Ue({customError:t})}function KA(){return Ue().customError}var _y;_y||(_y={});var M={...Ks,...Bu,iso:cn},XA=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function YA(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function QA(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let i=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){let n=r[1];if(!n||!e.defs[n])throw new Error(`Reference not found: ${t}`);return e.defs[n]}throw new Error(`Reference not found: ${t}`)}function Vx(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return M.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let n=t.$ref;if(e.refs.has(n))return e.refs.get(n);if(e.processing.has(n))return M.lazy(()=>{if(!e.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return e.refs.get(n)});e.processing.add(n);let o=QA(n,e),s=at(o,e);return e.refs.set(n,s),e.processing.delete(n),s}if(t.enum!==void 0){let n=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&n.length===1&&n[0]===null)return M.null();if(n.length===0)return M.never();if(n.length===1)return M.literal(n[0]);if(n.every(s=>typeof s=="string"))return M.enum(n);let o=n.map(s=>M.literal(s));return o.length<2?o[0]:M.union([o[0],o[1],...o.slice(2)])}if(t.const!==void 0)return M.literal(t.const);let r=t.type;if(Array.isArray(r)){let n=r.map(o=>{let s={...t,type:o};return Vx(s,e)});return n.length===0?M.never():n.length===1?n[0]:M.union(n)}if(!r)return M.any();let i;switch(r){case"string":{let n=M.string();if(t.format){let o=t.format;o==="email"?n=n.check(M.email()):o==="uri"||o==="uri-reference"?n=n.check(M.url()):o==="uuid"||o==="guid"?n=n.check(M.uuid()):o==="date-time"?n=n.check(M.iso.datetime()):o==="date"?n=n.check(M.iso.date()):o==="time"?n=n.check(M.iso.time()):o==="duration"?n=n.check(M.iso.duration()):o==="ipv4"?n=n.check(M.ipv4()):o==="ipv6"?n=n.check(M.ipv6()):o==="mac"?n=n.check(M.mac()):o==="cidr"?n=n.check(M.cidrv4()):o==="cidr-v6"?n=n.check(M.cidrv6()):o==="base64"?n=n.check(M.base64()):o==="base64url"?n=n.check(M.base64url()):o==="e164"?n=n.check(M.e164()):o==="jwt"?n=n.check(M.jwt()):o==="emoji"?n=n.check(M.emoji()):o==="nanoid"?n=n.check(M.nanoid()):o==="cuid"?n=n.check(M.cuid()):o==="cuid2"?n=n.check(M.cuid2()):o==="ulid"?n=n.check(M.ulid()):o==="xid"?n=n.check(M.xid()):o==="ksuid"&&(n=n.check(M.ksuid()))}typeof t.minLength=="number"&&(n=n.min(t.minLength)),typeof t.maxLength=="number"&&(n=n.max(t.maxLength)),t.pattern&&(n=n.regex(new RegExp(t.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?M.number().int():M.number();typeof t.minimum=="number"&&(n=n.min(t.minimum)),typeof t.maximum=="number"&&(n=n.max(t.maximum)),typeof t.exclusiveMinimum=="number"?n=n.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n=n.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?n=n.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n=n.lt(t.maximum)),typeof t.multipleOf=="number"&&(n=n.multipleOf(t.multipleOf)),i=n;break}case"boolean":{i=M.boolean();break}case"null":{i=M.null();break}case"object":{let n={},o=t.properties||{},s=new Set(t.required||[]);for(let[c,l]of Object.entries(o)){let u=at(l,e);n[c]=s.has(c)?u:u.optional()}if(t.propertyNames){let c=at(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?at(t.additionalProperties,e):M.any();if(Object.keys(n).length===0){i=M.record(c,l);break}let u=M.object(n).passthrough(),d=M.looseRecord(c,l);i=M.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let p of l){let f=at(c[p],e),m=M.string().regex(new RegExp(p));u.push(M.looseRecord(m,f))}let d=[];if(Object.keys(n).length>0&&d.push(M.object(n).passthrough()),d.push(...u),d.length===0)i=M.object({}).passthrough();else if(d.length===1)i=d[0];else{let p=M.intersection(d[0],d[1]);for(let f=2;f<d.length;f++)p=M.intersection(p,d[f]);i=p}break}let a=M.object(n);t.additionalProperties===!1?i=a.strict():typeof t.additionalProperties=="object"?i=a.catchall(at(t.additionalProperties,e)):i=a.passthrough();break}case"array":{let n=t.prefixItems,o=t.items;if(n&&Array.isArray(n)){let s=n.map(c=>at(c,e)),a=o&&typeof o=="object"&&!Array.isArray(o)?at(o,e):void 0;a?i=M.tuple(s).rest(a):i=M.tuple(s),typeof t.minItems=="number"&&(i=i.check(M.minLength(t.minItems))),typeof t.maxItems=="number"&&(i=i.check(M.maxLength(t.maxItems)))}else if(Array.isArray(o)){let s=o.map(c=>at(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?at(t.additionalItems,e):void 0;a?i=M.tuple(s).rest(a):i=M.tuple(s),typeof t.minItems=="number"&&(i=i.check(M.minLength(t.minItems))),typeof t.maxItems=="number"&&(i=i.check(M.maxLength(t.maxItems)))}else if(o!==void 0){let s=at(o,e),a=M.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),i=a}else i=M.array(M.any());break}default:throw new Error(`Unsupported type: ${r}`)}return i}function at(t,e){if(typeof t=="boolean")return t?M.any():M.never();let r=Vx(t,e),i=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(l=>at(l,e)),c=M.union(a);r=i?M.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(l=>at(l,e)),c=M.xor(a);r=i?M.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=i?r:M.any();else{let a=i?r:at(t.allOf[0],e),c=i?0:1;for(let l=c;l<t.allOf.length;l++)a=M.intersection(a,at(t.allOf[l],e));r=a}t.nullable===!0&&e.version==="openapi-3.0"&&(r=M.nullable(r)),t.readOnly===!0&&(r=M.readonly(r)),t.default!==void 0&&(r=r.default(t.default));let n={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in t&&(n[a]=t[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in t&&(n[a]=t[a]);for(let a of Object.keys(t))XA.has(a)||(n[a]=t[a]);return Object.keys(n).length>0&&e.registry.add(r,n),t.description&&(r=r.describe(t.description)),r}function Hx(t,e){if(typeof t=="boolean")return t?M.any():M.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=YA(r,e?.defaultTarget),n=r.$defs||r.definitions||{},o={version:i,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??Xe};return at(r,o)}var la={};xr(la,{bigint:()=>n1,boolean:()=>r1,date:()=>i1,number:()=>t1,string:()=>e1});function e1(t){return wh(co,t)}function t1(t){return Th(uo,t)}function r1(t){return Ph(po,t)}function n1(t){return zh(fo,t)}function i1(t){return Ch(ta,t)}Ue(ru());var ln="2025-11-25";var Sd=[ln,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],un="io.modelcontextprotocol/related-task",Id="2.0",Qe=kd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Wx=ke([g(),pe().int()]),Bx=g(),lW=Le({ttl:ke([pe(),mo()]).optional(),pollInterval:pe().optional()}),s1=A({ttl:pe().optional()}),a1=A({taskId:g()}),ky=Le({progressToken:Wx.optional(),[un]:a1.optional()}),jt=A({_meta:ky.optional()}),ua=jt.extend({task:s1.optional()}),Jx=t=>ua.safeParse(t).success,et=A({method:g(),params:jt.loose().optional()}),Zt=A({_meta:ky.optional()}),Ft=A({method:g(),params:Zt.loose().optional()}),tt=Le({_meta:ky.optional()}),Td=ke([g(),pe().int()]),Gx=A({jsonrpc:Z(Id),id:Td,...et.shape}).strict(),da=t=>Gx.safeParse(t).success,Kx=A({jsonrpc:Z(Id),...Ft.shape}).strict(),Xx=t=>Kx.safeParse(t).success,xy=A({jsonrpc:Z(Id),id:Td,result:tt}).strict(),Fn=t=>xy.safeParse(t).success;var U;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(U||(U={}));var Sy=A({jsonrpc:Z(Id),id:Td.optional(),error:A({code:pe().int(),message:g(),data:Te().optional()})}).strict();var Yx=t=>Sy.safeParse(t).success;var vo=ke([Gx,Kx,xy,Sy]),uW=ke([xy,Sy]),Rr=tt.strict(),c1=Zt.extend({requestId:Td.optional(),reason:g().optional()}),Pd=Ft.extend({method:Z("notifications/cancelled"),params:c1}),l1=A({src:g(),mimeType:g().optional(),sizes:E(g()).optional(),theme:Ye(["light","dark"]).optional()}),pa=A({icons:E(l1).optional()}),yo=A({name:g(),title:g().optional()}),Qx=yo.extend({...yo.shape,...pa.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),u1=ho(A({applyDefaults:_e().optional()}),Ce(g(),Te())),d1=ca(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,ho(A({form:u1.optional(),url:Qe.optional()}),Ce(g(),Te()).optional())),p1=Le({list:Qe.optional(),cancel:Qe.optional(),requests:Le({sampling:Le({createMessage:Qe.optional()}).optional(),elicitation:Le({create:Qe.optional()}).optional()}).optional()}),f1=Le({list:Qe.optional(),cancel:Qe.optional(),requests:Le({tools:Le({call:Qe.optional()}).optional()}).optional()}),m1=A({experimental:Ce(g(),Qe).optional(),sampling:A({context:Qe.optional(),tools:Qe.optional()}).optional(),elicitation:d1.optional(),roots:A({listChanged:_e().optional()}).optional(),tasks:p1.optional()}),h1=jt.extend({protocolVersion:g(),capabilities:m1,clientInfo:Qx}),Iy=et.extend({method:Z("initialize"),params:h1});var g1=A({experimental:Ce(g(),Qe).optional(),logging:Qe.optional(),completions:Qe.optional(),prompts:A({listChanged:_e().optional()}).optional(),resources:A({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:A({listChanged:_e().optional()}).optional(),tasks:f1.optional()}),Ty=tt.extend({protocolVersion:g(),capabilities:g1,serverInfo:Qx,instructions:g().optional()}),zd=Ft.extend({method:Z("notifications/initialized"),params:Zt.optional()}),eS=t=>zd.safeParse(t).success,Cd=et.extend({method:Z("ping"),params:jt.optional()}),y1=A({progress:pe(),total:Ee(pe()),message:Ee(g())}),v1=A({...Zt.shape,...y1.shape,progressToken:Wx}),Rd=Ft.extend({method:Z("notifications/progress"),params:v1}),b1=jt.extend({cursor:Bx.optional()}),fa=et.extend({params:b1.optional()}),ma=tt.extend({nextCursor:Bx.optional()}),_1=Ye(["working","input_required","completed","failed","cancelled"]),ha=A({taskId:g(),status:_1,ttl:ke([pe(),mo()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:Ee(pe()),statusMessage:Ee(g())}),Er=tt.extend({task:ha}),w1=Zt.merge(ha),ga=Ft.extend({method:Z("notifications/tasks/status"),params:w1}),Ed=et.extend({method:Z("tasks/get"),params:jt.extend({taskId:g()})}),Ad=tt.merge(ha),Od=et.extend({method:Z("tasks/result"),params:jt.extend({taskId:g()})}),dW=tt.loose(),Nd=fa.extend({method:Z("tasks/list")}),Md=ma.extend({tasks:E(ha)}),jd=et.extend({method:Z("tasks/cancel"),params:jt.extend({taskId:g()})}),tS=tt.merge(ha),rS=A({uri:g(),mimeType:Ee(g()),_meta:Ce(g(),Te()).optional()}),nS=rS.extend({text:g()}),Py=g().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),iS=rS.extend({blob:Py}),ya=Ye(["user","assistant"]),bo=A({audience:E(ya).optional(),priority:pe().min(0).max(1).optional(),lastModified:cn.datetime({offset:!0}).optional()}),oS=A({...yo.shape,...pa.shape,uri:g(),description:Ee(g()),mimeType:Ee(g()),annotations:bo.optional(),_meta:Ee(Le({}))}),$1=A({...yo.shape,...pa.shape,uriTemplate:g(),description:Ee(g()),mimeType:Ee(g()),annotations:bo.optional(),_meta:Ee(Le({}))}),Dd=fa.extend({method:Z("resources/list")}),zy=ma.extend({resources:E(oS)}),Ud=fa.extend({method:Z("resources/templates/list")}),Cy=ma.extend({resourceTemplates:E($1)}),Ry=jt.extend({uri:g()}),k1=Ry,Ld=et.extend({method:Z("resources/read"),params:k1}),Ey=tt.extend({contents:E(ke([nS,iS]))}),Ay=Ft.extend({method:Z("notifications/resources/list_changed"),params:Zt.optional()}),x1=Ry,S1=et.extend({method:Z("resources/subscribe"),params:x1}),I1=Ry,T1=et.extend({method:Z("resources/unsubscribe"),params:I1}),P1=Zt.extend({uri:g()}),z1=Ft.extend({method:Z("notifications/resources/updated"),params:P1}),C1=A({name:g(),description:Ee(g()),required:Ee(_e())}),R1=A({...yo.shape,...pa.shape,description:Ee(g()),arguments:Ee(E(C1)),_meta:Ee(Le({}))}),Zd=fa.extend({method:Z("prompts/list")}),Oy=ma.extend({prompts:E(R1)}),E1=jt.extend({name:g(),arguments:Ce(g(),g()).optional()}),Fd=et.extend({method:Z("prompts/get"),params:E1}),Ny=A({type:Z("text"),text:g(),annotations:bo.optional(),_meta:Ce(g(),Te()).optional()}),My=A({type:Z("image"),data:Py,mimeType:g(),annotations:bo.optional(),_meta:Ce(g(),Te()).optional()}),jy=A({type:Z("audio"),data:Py,mimeType:g(),annotations:bo.optional(),_meta:Ce(g(),Te()).optional()}),A1=A({type:Z("tool_use"),name:g(),id:g(),input:Ce(g(),Te()),_meta:Ce(g(),Te()).optional()}),O1=A({type:Z("resource"),resource:ke([nS,iS]),annotations:bo.optional(),_meta:Ce(g(),Te()).optional()}),N1=oS.extend({type:Z("resource_link")}),Dy=ke([Ny,My,jy,N1,O1]),M1=A({role:ya,content:Dy}),Uy=tt.extend({description:g().optional(),messages:E(M1)}),Ly=Ft.extend({method:Z("notifications/prompts/list_changed"),params:Zt.optional()}),j1=A({title:g().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),D1=A({taskSupport:Ye(["required","optional","forbidden"]).optional()}),sS=A({...yo.shape,...pa.shape,description:g().optional(),inputSchema:A({type:Z("object"),properties:Ce(g(),Qe).optional(),required:E(g()).optional()}).catchall(Te()),outputSchema:A({type:Z("object"),properties:Ce(g(),Qe).optional(),required:E(g()).optional()}).catchall(Te()).optional(),annotations:j1.optional(),execution:D1.optional(),_meta:Ce(g(),Te()).optional()}),qd=fa.extend({method:Z("tools/list")}),Zy=ma.extend({tools:E(sS)}),dn=tt.extend({content:E(Dy).default([]),structuredContent:Ce(g(),Te()).optional(),isError:_e().optional()}),pW=dn.or(tt.extend({toolResult:Te()})),U1=ua.extend({name:g(),arguments:Ce(g(),Te()).optional()}),_o=et.extend({method:Z("tools/call"),params:U1}),va=Ft.extend({method:Z("notifications/tools/list_changed"),params:Zt.optional()}),aS=A({autoRefresh:_e().default(!0),debounceMs:pe().int().nonnegative().default(300)}),ba=Ye(["debug","info","notice","warning","error","critical","alert","emergency"]),L1=jt.extend({level:ba}),Fy=et.extend({method:Z("logging/setLevel"),params:L1}),Z1=Zt.extend({level:ba,logger:g().optional(),data:Te()}),F1=Ft.extend({method:Z("notifications/message"),params:Z1}),q1=A({name:g().optional()}),V1=A({hints:E(q1).optional(),costPriority:pe().min(0).max(1).optional(),speedPriority:pe().min(0).max(1).optional(),intelligencePriority:pe().min(0).max(1).optional()}),H1=A({mode:Ye(["auto","required","none"]).optional()}),W1=A({type:Z("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:E(Dy).default([]),structuredContent:A({}).loose().optional(),isError:_e().optional(),_meta:Ce(g(),Te()).optional()}),B1=ia("type",[Ny,My,jy]),xd=ia("type",[Ny,My,jy,A1,W1]),J1=A({role:ya,content:ke([xd,E(xd)]),_meta:Ce(g(),Te()).optional()}),G1=ua.extend({messages:E(J1),modelPreferences:V1.optional(),systemPrompt:g().optional(),includeContext:Ye(["none","thisServer","allServers"]).optional(),temperature:pe().optional(),maxTokens:pe().int(),stopSequences:E(g()).optional(),metadata:Qe.optional(),tools:E(sS).optional(),toolChoice:H1.optional()}),qy=et.extend({method:Z("sampling/createMessage"),params:G1}),qn=tt.extend({model:g(),stopReason:Ee(Ye(["endTurn","stopSequence","maxTokens"]).or(g())),role:ya,content:B1}),_a=tt.extend({model:g(),stopReason:Ee(Ye(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:ya,content:ke([xd,E(xd)])}),K1=A({type:Z("boolean"),title:g().optional(),description:g().optional(),default:_e().optional()}),X1=A({type:Z("string"),title:g().optional(),description:g().optional(),minLength:pe().optional(),maxLength:pe().optional(),format:Ye(["email","uri","date","date-time"]).optional(),default:g().optional()}),Y1=A({type:Ye(["number","integer"]),title:g().optional(),description:g().optional(),minimum:pe().optional(),maximum:pe().optional(),default:pe().optional()}),Q1=A({type:Z("string"),title:g().optional(),description:g().optional(),enum:E(g()),default:g().optional()}),eO=A({type:Z("string"),title:g().optional(),description:g().optional(),oneOf:E(A({const:g(),title:g()})),default:g().optional()}),tO=A({type:Z("string"),title:g().optional(),description:g().optional(),enum:E(g()),enumNames:E(g()).optional(),default:g().optional()}),rO=ke([Q1,eO]),nO=A({type:Z("array"),title:g().optional(),description:g().optional(),minItems:pe().optional(),maxItems:pe().optional(),items:A({type:Z("string"),enum:E(g())}),default:E(g()).optional()}),iO=A({type:Z("array"),title:g().optional(),description:g().optional(),minItems:pe().optional(),maxItems:pe().optional(),items:A({anyOf:E(A({const:g(),title:g()}))}),default:E(g()).optional()}),oO=ke([nO,iO]),sO=ke([tO,rO,oO]),aO=ke([sO,K1,X1,Y1]),cO=ua.extend({mode:Z("form").optional(),message:g(),requestedSchema:A({type:Z("object"),properties:Ce(g(),aO),required:E(g()).optional()})}),lO=ua.extend({mode:Z("url"),message:g(),elicitationId:g(),url:g().url()}),uO=ke([cO,lO]),Vy=et.extend({method:Z("elicitation/create"),params:uO}),dO=Zt.extend({elicitationId:g()}),pO=Ft.extend({method:Z("notifications/elicitation/complete"),params:dO}),pn=tt.extend({action:Ye(["accept","decline","cancel"]),content:ca(t=>t===null?void 0:t,Ce(g(),ke([g(),pe(),_e(),E(g())])).optional())}),fO=A({type:Z("ref/resource"),uri:g()});var mO=A({type:Z("ref/prompt"),name:g()}),hO=jt.extend({ref:ke([mO,fO]),argument:A({name:g(),value:g()}),context:A({arguments:Ce(g(),g()).optional()}).optional()}),Vd=et.extend({method:Z("completion/complete"),params:hO});function cS(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function lS(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Hy=tt.extend({completion:Le({values:E(g()).max(100),total:Ee(pe().int()),hasMore:Ee(_e())})}),gO=A({uri:g().startsWith("file://"),name:g().optional(),_meta:Ce(g(),Te()).optional()}),yO=et.extend({method:Z("roots/list"),params:jt.optional()}),Wy=tt.extend({roots:E(gO)}),vO=Ft.extend({method:Z("notifications/roots/list_changed"),params:Zt.optional()}),fW=ke([Cd,Iy,Vd,Fy,Fd,Zd,Dd,Ud,Ld,S1,T1,_o,qd,Ed,Od,Nd,jd]),mW=ke([Pd,Rd,zd,vO,ga]),hW=ke([Rr,qn,_a,pn,Wy,Ad,Md,Er]),gW=ke([Cd,qy,Vy,yO,Ed,Od,Nd,jd]),yW=ke([Pd,Rd,F1,z1,Ay,va,Ly,ga,pO]),vW=ke([Rr,Ty,Hy,Uy,Oy,zy,Cy,Ey,dn,Zy,Ad,Md,Er]),O=class t extends Error{constructor(e,r,i){super(`MCP error ${e}: ${r}`),this.code=e,this.data=i,this.name="McpError"}static fromError(e,r,i){if(e===U.UrlElicitationRequired&&i){let n=i;if(n.elicitations)return new $y(n.elicitations,r)}return new t(e,r,i)}},$y=class extends O{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(U.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function fn(t){return t==="completed"||t==="failed"||t==="cancelled"}var dS=Symbol("Let zodToJsonSchema decide on which parser to use");var uS={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"},pS=t=>typeof t=="string"?{...uS,name:t}:{...uS,...t};var fS=t=>{let e=pS(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,i],jsonSchema:void 0}]))}};function By(t,e,r,i){i?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function fe(t,e,r,i,n){t[e]=r,By(t,e,i,n)}var Hd=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function Ne(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Hd(e,t.currentPath):e.join("/")}}function mS(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==C.ZodAny&&(r.items=B(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&fe(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&fe(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(fe(r,"minItems",t.exactLength.value,t.exactLength.message,e),fe(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function hS(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let i of t.checks)switch(i.kind){case"min":e.target==="jsonSchema7"?i.inclusive?fe(r,"minimum",i.value,i.message,e):fe(r,"exclusiveMinimum",i.value,i.message,e):(i.inclusive||(r.exclusiveMinimum=!0),fe(r,"minimum",i.value,i.message,e));break;case"max":e.target==="jsonSchema7"?i.inclusive?fe(r,"maximum",i.value,i.message,e):fe(r,"exclusiveMaximum",i.value,i.message,e):(i.inclusive||(r.exclusiveMaximum=!0),fe(r,"maximum",i.value,i.message,e));break;case"multipleOf":fe(r,"multipleOf",i.value,i.message,e);break}return r}function gS(){return{type:"boolean"}}function Wd(t,e){return B(t.type._def,e)}var yS=(t,e)=>B(t.innerType._def,e);function Jy(t,e,r){let i=r??e.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>Jy(t,e,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return bO(t,e)}}var bO=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let i of t.checks)switch(i.kind){case"min":fe(r,"minimum",i.value,i.message,e);break;case"max":fe(r,"maximum",i.value,i.message,e);break}return r};function vS(t,e){return{...B(t.innerType._def,e),default:t.defaultValue()}}function bS(t,e){return e.effectStrategy==="input"?B(t.schema._def,e):Ne(e)}function _S(t){return{type:"string",enum:Array.from(t.values)}}var _O=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function wS(t,e){let r=[B(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),i=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(o=>{if(_O(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(i=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function $S(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Gy,Qt={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:()=>(Gy===void 0&&(Gy=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Gy),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 Bd(t,e){let r={type:"string"};if(t.checks)for(let i of t.checks)switch(i.kind){case"min":fe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,e);break;case"max":fe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,e);break;case"email":switch(e.emailStrategy){case"format:email":er(r,"email",i.message,e);break;case"format:idn-email":er(r,"idn-email",i.message,e);break;case"pattern:zod":yt(r,Qt.email,i.message,e);break}break;case"url":er(r,"uri",i.message,e);break;case"uuid":er(r,"uuid",i.message,e);break;case"regex":yt(r,i.regex,i.message,e);break;case"cuid":yt(r,Qt.cuid,i.message,e);break;case"cuid2":yt(r,Qt.cuid2,i.message,e);break;case"startsWith":yt(r,RegExp(`^${Ky(i.value,e)}`),i.message,e);break;case"endsWith":yt(r,RegExp(`${Ky(i.value,e)}$`),i.message,e);break;case"datetime":er(r,"date-time",i.message,e);break;case"date":er(r,"date",i.message,e);break;case"time":er(r,"time",i.message,e);break;case"duration":er(r,"duration",i.message,e);break;case"length":fe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,e),fe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,e);break;case"includes":{yt(r,RegExp(Ky(i.value,e)),i.message,e);break}case"ip":{i.version!=="v6"&&er(r,"ipv4",i.message,e),i.version!=="v4"&&er(r,"ipv6",i.message,e);break}case"base64url":yt(r,Qt.base64url,i.message,e);break;case"jwt":yt(r,Qt.jwt,i.message,e);break;case"cidr":{i.version!=="v6"&&yt(r,Qt.ipv4Cidr,i.message,e),i.version!=="v4"&&yt(r,Qt.ipv6Cidr,i.message,e);break}case"emoji":yt(r,Qt.emoji(),i.message,e);break;case"ulid":{yt(r,Qt.ulid,i.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(r,"binary",i.message,e);break}case"contentEncoding:base64":{fe(r,"contentEncoding","base64",i.message,e);break}case"pattern:zod":{yt(r,Qt.base64,i.message,e);break}}break}case"nanoid":yt(r,Qt.nanoid,i.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ky(t,e){return e.patternStrategy==="escape"?$O(t):t}var wO=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $O(t){let e="";for(let r=0;r<t.length;r++)wO.has(t[r])||(e+="\\"),e+=t[r];return e}function er(t,e,r,i){t.format||t.anyOf?.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&i.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&i.errorMessages&&{errorMessage:{format:r}}})):fe(t,"format",e,r,i)}function yt(t,e,r,i){t.pattern||t.allOf?.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&i.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:kS(e,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})):fe(t,"pattern",kS(e,i),r,i)}function kS(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source,n="",o=!1,s=!1,a=!1;for(let c=0;c<i.length;c++){if(o){n+=i[c],o=!1;continue}if(r.i){if(s){if(i[c].match(/[a-z]/)){a?(n+=i[c],n+=`${i[c-2]}-${i[c]}`.toUpperCase(),a=!1):i[c+1]==="-"&&i[c+2]?.match(/[a-z]/)?(n+=i[c],a=!0):n+=`${i[c]}${i[c].toUpperCase()}`;continue}}else if(i[c].match(/[a-z]/)){n+=`[${i[c]}${i[c].toUpperCase()}]`;continue}}if(r.m){if(i[c]==="^"){n+=`(^|(?<=[\r
|
|
96
|
+
]))`;continue}else if(i[c]==="$"){n+=`($|(?=[\r
|
|
97
|
+
]))`;continue}}if(r.s&&i[c]==="."){n+=s?`${i[c]}\r
|
|
98
|
+
`:`[${i[c]}\r
|
|
99
|
+
]`;continue}n+=i[c],i[c]==="\\"?o=!0:s&&i[c]==="]"?s=!1:!s&&i[c]==="["&&(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function Jd(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((i,n)=>({...i,[n]:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??Ne(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===C.ZodString&&t.keyType._def.checks?.length){let{type:i,...n}=Bd(t.keyType._def,e);return{...r,propertyNames:n}}else{if(t.keyType?._def.typeName===C.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===C.ZodBranded&&t.keyType._def.type._def.typeName===C.ZodString&&t.keyType._def.type._def.checks?.length){let{type:i,...n}=Wd(t.keyType._def,e);return{...r,propertyNames:n}}}return r}function xS(t,e){if(e.mapStrategy==="record")return Jd(t,e);let r=B(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ne(e),i=B(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ne(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function SS(t){let e=t.values,i=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),n=Array.from(new Set(i.map(o=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function IS(t){return t.target==="openAi"?void 0:{not:Ne({...t,currentPath:[...t.currentPath,"not"]})}}function TS(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var wa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function zS(t,e){if(e.target==="openApi3")return PS(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(i=>i._def.typeName in wa&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=wa[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,a)=>a.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter(o=>!i.includes(o))],[])};return PS(t,e)}var PS=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((i,n)=>B(i._def,{...e,currentPath:[...e.currentPath,"anyOf",`${n}`]})).filter(i=>!!i&&(!e.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function CS(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:wa[t.innerType._def.typeName],nullable:!0}:{type:[wa[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let i=B(t.innerType._def,{...e,currentPath:[...e.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let r=B(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function RS(t,e){let r={type:"number"};if(!t.checks)return r;for(let i of t.checks)switch(i.kind){case"int":r.type="integer",By(r,"type",i.message,e);break;case"min":e.target==="jsonSchema7"?i.inclusive?fe(r,"minimum",i.value,i.message,e):fe(r,"exclusiveMinimum",i.value,i.message,e):(i.inclusive||(r.exclusiveMinimum=!0),fe(r,"minimum",i.value,i.message,e));break;case"max":e.target==="jsonSchema7"?i.inclusive?fe(r,"maximum",i.value,i.message,e):fe(r,"exclusiveMaximum",i.value,i.message,e):(i.inclusive||(r.exclusiveMaximum=!0),fe(r,"maximum",i.value,i.message,e));break;case"multipleOf":fe(r,"multipleOf",i.value,i.message,e);break}return r}function ES(t,e){let r=e.target==="openAi",i={type:"object",properties:{}},n=[],o=t.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let l=xO(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let u=B(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});u!==void 0&&(i.properties[a]=u,l||n.push(a))}n.length&&(i.required=n);let s=kO(t,e);return s!==void 0&&(i.additionalProperties=s),i}function kO(t,e){if(t.catchall._def.typeName!=="ZodNever")return B(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function xO(t){try{return t.isOptional()}catch{return!0}}var AS=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(t.innerType._def,e);let r=B(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ne(e)},r]}:Ne(e)};var OS=(t,e)=>{if(e.pipeStrategy==="input")return B(t.in._def,e);if(e.pipeStrategy==="output")return B(t.out._def,e);let r=B(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),i=B(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter(n=>n!==void 0)}};function NS(t,e){return B(t.type._def,e)}function MS(t,e){let i={type:"array",uniqueItems:!0,items:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&fe(i,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&fe(i,"maxItems",t.maxSize.value,t.maxSize.message,e),i}function jS(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,i)=>B(r._def,{...e,currentPath:[...e.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:B(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,i)=>B(r._def,{...e,currentPath:[...e.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function DS(t){return{not:Ne(t)}}function US(t){return Ne(t)}var LS=(t,e)=>B(t.innerType._def,e);var ZS=(t,e,r)=>{switch(e){case C.ZodString:return Bd(t,r);case C.ZodNumber:return RS(t,r);case C.ZodObject:return ES(t,r);case C.ZodBigInt:return hS(t,r);case C.ZodBoolean:return gS();case C.ZodDate:return Jy(t,r);case C.ZodUndefined:return DS(r);case C.ZodNull:return TS(r);case C.ZodArray:return mS(t,r);case C.ZodUnion:case C.ZodDiscriminatedUnion:return zS(t,r);case C.ZodIntersection:return wS(t,r);case C.ZodTuple:return jS(t,r);case C.ZodRecord:return Jd(t,r);case C.ZodLiteral:return $S(t,r);case C.ZodEnum:return _S(t);case C.ZodNativeEnum:return SS(t);case C.ZodNullable:return CS(t,r);case C.ZodOptional:return AS(t,r);case C.ZodMap:return xS(t,r);case C.ZodSet:return MS(t,r);case C.ZodLazy:return()=>t.getter()._def;case C.ZodPromise:return NS(t,r);case C.ZodNaN:case C.ZodNever:return IS(r);case C.ZodEffects:return bS(t,r);case C.ZodAny:return Ne(r);case C.ZodUnknown:return US(r);case C.ZodDefault:return vS(t,r);case C.ZodBranded:return Wd(t,r);case C.ZodReadonly:return LS(t,r);case C.ZodCatch:return yS(t,r);case C.ZodPipeline:return OS(t,r);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return(i=>{})(e)}};function B(t,e,r=!1){let i=e.seen.get(t);if(e.override){let a=e.override?.(t,e,i,r);if(a!==dS)return a}if(i&&!r){let a=SO(i,e);if(a!==void 0)return a}let n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);let o=ZS(t,t.typeName,e),s=typeof o=="function"?B(o(),e):o;if(s&&IO(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var SO=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Hd(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,i)=>e.currentPath[i]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Ne(e)):e.$refStrategy==="seen"?Ne(e):void 0}},IO=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var Xy=(t,e)=>{let r=fS(e),i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:B(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Ne(r)}),{}):void 0,n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=B(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Ne(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(o.title=s),r.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[r.openAiAnyTypeName]||(i[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?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),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."),a};function TO(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Yy(t,e){return St(t)?Un(t,{target:TO(e?.target),io:e?.pipeStrategy??"input"}):Xy(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function Qy(t){let r=mr(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=Wu(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function ev(t,e){let r=gt(t,e);if(!r.success)throw r.error;return r.data}var PO=6e4,wo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Pd,r=>{this._oncancel(r)}),this.setNotificationHandler(Rd,r=>{this._onprogress(r)}),this.setRequestHandler(Cd,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ed,async(r,i)=>{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new O(U.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Od,async(r,i)=>{let n=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let d=c,p=new O(d.error.code,d.error.message,d.error.data);u(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:i.requestId})}}let s=await this._taskStore.getTask(o,i.sessionId);if(!s)throw new O(U.InvalidParams,`Task not found: ${o}`);if(!fn(s.status))return await this._waitForTaskUpdate(o,i.signal),await n();if(fn(s.status)){let a=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[un]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Nd,async(r,i)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,i.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new O(U.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(jd,async(r,i)=>{try{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new O(U.InvalidParams,`Task not found: ${r.params.taskId}`);if(fn(n.status))throw new O(U.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new O(U.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(n){throw n instanceof O?n:new O(U.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,i,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),O.fromError(U.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{n?.(o,s),Fn(o)||Yx(o)?this._onresponse(o):da(o)?this._onrequest(o,s):Xx(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let r=O.fromError(U.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of e.values())i(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){let i=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[un]?.taskId;if(i===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:U.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=Jx(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,l={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(s.signal.aborted)throw new O(U.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(u,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>i(e,l)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:U.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...i}=e.params,n=Number(r),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(c);return}o(i)}_onresponse(e){let r=Number(e.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),Fn(e))i(e);else{let s=new O(e.error.code,e.error.message,e.error.data);i(s)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Fn(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),Fn(e))n(e);else{let s=O.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,i){let{task:n}=i??{};if(!n){try{yield{type:"result",result:await this.request(e,r,i)}}catch(s){yield{type:"error",error:s instanceof O?s:new O(U.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Er,i);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new O(U.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:a},fn(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)}:a.status==="failed"?yield{type:"error",error:new O(U.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new O(U.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),i?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof O?s:new O(U.InternalError,String(s))}}}request(e,r,i){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:c}=i??{};return new Promise((l,u)=>{let d=$=>{u($)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch($){d($);return}i?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};i?.onprogress&&(this._progressHandlers.set(p,i.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[un]:c}});let m=$=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String($)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let w=$ instanceof O?$:new O(U.RequestTimeout,String($));u(w)};this._responseHandlers.set(p,$=>{if(!i?.signal?.aborted){if($ instanceof Error)return u($);try{let w=gt(r,$.result);w.success?l(w.data):u(w.error)}catch(w){u(w)}}}),i?.signal?.addEventListener("abort",()=>{m(i?.signal?.reason)});let h=i?.timeout??PO,y=()=>m(O.fromError(U.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,i?.maxTotalTimeout,y,i?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let $=w=>{let k=this._responseHandlers.get(p);k?k(w):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,$),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(p),u(w)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch($=>{this._cleanupTimeout(p),u($)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ad,r)}async getTaskResult(e,r,i){return this.request({method:"tasks/result",params:e},r,i)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Md,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},tS,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let i=r?.relatedTask?.taskId;if(i){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[un]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.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 a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[un]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[un]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let i=Qy(e);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(n,o)=>{let s=ev(e,n);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let i=Qy(e);this._notificationHandlers.set(i,n=>{let o=ev(e,n);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,i){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,i,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(e,r);for(let n of i)if(n.type==="request"&&da(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);s?(s(new O(U.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let i=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(i=n.pollInterval)}catch{}return new Promise((n,o)=>{if(r.aborted){o(new O(U.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,i);r.addEventListener("abort",()=>{clearTimeout(s),o(new O(U.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await i.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let o=await i.getTask(n,r);if(!o)throw new O(U.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await i.storeTaskResult(n,o,s,r);let a=await i.getTask(n,r);if(a){let c=ga.parse({method:"notifications/tasks/status",params:a});await this.notification(c),fn(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>i.getTaskResult(n,r),updateTaskStatus:async(n,o,s)=>{let a=await i.getTask(n,r);if(!a)throw new O(U.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(fn(a.status))throw new O(U.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(n,o,s,r);let c=await i.getTask(n,r);if(c){let l=ga.parse({method:"notifications/tasks/status",params:c});await this.notification(l),fn(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>i.listTasks(n,r)}}};function FS(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Gd(t,e){let r={...t};for(let i in e){let n=i,o=e[n];if(o===void 0)continue;let s=r[n];FS(s)&&FS(o)?r[n]={...s,...o}:r[n]=o}return r}var PT=zc(Ub(),1),zT=zc(TT(),1);function b4(){let t=new PT.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,zT.default)(t),t}var Uo=class{constructor(e){this._ajv=e??b4()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return i=>r(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Rp=class{constructor(e){this._client=e}async*callToolStream(e,r=dn,i){let n=this._client,o={...i,task:i?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},r,o),a=n.getToolOutputValidator(e.name);for await(let c of s){if(c.type==="result"&&a){let l=c.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new O(U.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let u=a(l.structuredContent);if(!u.valid){yield{type:"error",error:new O(U.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof O){yield{type:"error",error:u};return}yield{type:"error",error:new O(U.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,i){return this._client.getTaskResult({taskId:e},r,i)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,i){return this._client.requestStream(e,r,i)}};function Ep(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Ap(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Op(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,i=t.properties;for(let n of Object.keys(i)){let o=i[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[n]=o.default),r[n]!==void 0&&Op(o,r[n])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&Op(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&Op(r,e)}}function _4(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Np=class extends wo{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new Uo,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",va,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Ly,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ay,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Rp(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Gd(this._capabilities,e)}setRequestHandler(e,r){let n=mr(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let o;if(St(n)){let a=n;o=a._zod?.def?.value??a.value}else{let a=n;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(c,l)=>{let u=gt(Vy,c);if(!u.success){let $=u.error instanceof Error?u.error.message:String(u.error);throw new O(U.InvalidParams,`Invalid elicitation request: ${$}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=_4(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new O(U.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new O(U.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(c,l));if(d.task){let $=gt(Er,m);if(!$.success){let w=$.error instanceof Error?$.error.message:String($.error);throw new O(U.InvalidParams,`Invalid task creation result: ${w}`)}return $.data}let h=gt(pn,m);if(!h.success){let $=h.error instanceof Error?h.error.message:String(h.error);throw new O(U.InvalidParams,`Invalid elicitation result: ${$}`)}let y=h.data,_=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&_&&this._capabilities.elicitation?.form?.applyDefaults)try{Op(_,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(c,l)=>{let u=gt(qy,c);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new O(U.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,p=await Promise.resolve(r(c,l));if(d.task){let y=gt(Er,p);if(!y.success){let _=y.error instanceof Error?y.error.message:String(y.error);throw new O(U.InvalidParams,`Invalid task creation result: ${_}`)}return y.data}let m=d.tools||d.toolChoice?_a:qn,h=gt(m,p);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new O(U.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let i=await this.request({method:"initialize",params:{protocolVersion:ln,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ty,r);if(i===void 0)throw new Error(`Server sent invalid initialize result: ${i}`);if(!Sd.includes(i.protocolVersion))throw new Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(i.protocolVersion),this._instructions=i.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(i){throw this.close(),i}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Ep(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Ap(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Rr,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Hy,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Rr,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Uy,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Oy,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},zy,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Cy,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Ey,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Rr,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Rr,r)}async callTool(e,r=dn,i){if(this.isToolTaskRequired(e.name))throw new O(U.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},r,i),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new O(U.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let s=o(n.structuredContent);if(!s.valid)throw new O(U.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof O?s:new O(U.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let i=r.execution?.taskSupport;(i==="required"||i==="optional")&&this._cachedKnownTaskTools.add(r.name),i==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let i=await this.request({method:"tools/list",params:e},Zy,r);return this.cacheToolMetadata(i.tools),i}_setupListChangedHandler(e,r,i,n){let o=aS.safeParse(i);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof i.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:c}=i,l=async()=>{if(!s){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(l,a);this._listChangedDebounceTimers.set(e,p)}else l()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function Mp(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function CT(t=fetch,e){return e?async(r,i)=>{let n={...e,...i,headers:i?.headers?{...Mp(e.headers),...Mp(i.headers)}:e.headers};return t(r,n)}:t}var Bb;Bb=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto);async function w4(t){return(await Bb).getRandomValues(new Uint8Array(t))}async function $4(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,i="";for(;i.length<t;){let n=await w4(t-i.length);for(let o of n)o<r&&(i+=e[o%e.length])}return i}async function k4(t){return await $4(t)}async function x4(t){let e=await(await Bb).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Jb(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await k4(t),r=await x4(e);return{code_verifier:e,code_challenge:r}}var it=rd().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:wy.custom,message:"URL must be parseable",fatal:!0}),ds}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ET=Le({resource:g().url(),authorization_servers:E(it).optional(),jwks_uri:g().url().optional(),scopes_supported:E(g()).optional(),bearer_methods_supported:E(g()).optional(),resource_signing_alg_values_supported:E(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:_e().optional(),authorization_details_types_supported:E(g()).optional(),dpop_signing_alg_values_supported:E(g()).optional(),dpop_bound_access_tokens_required:_e().optional()}),Gb=Le({issuer:g(),authorization_endpoint:it,token_endpoint:it,registration_endpoint:it.optional(),scopes_supported:E(g()).optional(),response_types_supported:E(g()),response_modes_supported:E(g()).optional(),grant_types_supported:E(g()).optional(),token_endpoint_auth_methods_supported:E(g()).optional(),token_endpoint_auth_signing_alg_values_supported:E(g()).optional(),service_documentation:it.optional(),revocation_endpoint:it.optional(),revocation_endpoint_auth_methods_supported:E(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:E(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:E(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:E(g()).optional(),code_challenge_methods_supported:E(g()).optional(),client_id_metadata_document_supported:_e().optional()}),S4=Le({issuer:g(),authorization_endpoint:it,token_endpoint:it,userinfo_endpoint:it.optional(),jwks_uri:it,registration_endpoint:it.optional(),scopes_supported:E(g()).optional(),response_types_supported:E(g()),response_modes_supported:E(g()).optional(),grant_types_supported:E(g()).optional(),acr_values_supported:E(g()).optional(),subject_types_supported:E(g()),id_token_signing_alg_values_supported:E(g()),id_token_encryption_alg_values_supported:E(g()).optional(),id_token_encryption_enc_values_supported:E(g()).optional(),userinfo_signing_alg_values_supported:E(g()).optional(),userinfo_encryption_alg_values_supported:E(g()).optional(),userinfo_encryption_enc_values_supported:E(g()).optional(),request_object_signing_alg_values_supported:E(g()).optional(),request_object_encryption_alg_values_supported:E(g()).optional(),request_object_encryption_enc_values_supported:E(g()).optional(),token_endpoint_auth_methods_supported:E(g()).optional(),token_endpoint_auth_signing_alg_values_supported:E(g()).optional(),display_values_supported:E(g()).optional(),claim_types_supported:E(g()).optional(),claims_supported:E(g()).optional(),service_documentation:g().optional(),claims_locales_supported:E(g()).optional(),ui_locales_supported:E(g()).optional(),claims_parameter_supported:_e().optional(),request_parameter_supported:_e().optional(),request_uri_parameter_supported:_e().optional(),require_request_uri_registration:_e().optional(),op_policy_uri:it.optional(),op_tos_uri:it.optional(),client_id_metadata_document_supported:_e().optional()}),AT=A({...S4.shape,...Gb.pick({code_challenge_methods_supported:!0}).shape}),OT=A({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:la.number().optional(),scope:g().optional(),refresh_token:g().optional()}).strip(),NT=A({error:g(),error_description:g().optional(),error_uri:g().optional()}),RT=it.optional().or(Z("").transform(()=>{})),I4=A({redirect_uris:E(it),token_endpoint_auth_method:g().optional(),grant_types:E(g()).optional(),response_types:E(g()).optional(),client_name:g().optional(),client_uri:it.optional(),logo_uri:RT,scope:g().optional(),contacts:E(g()).optional(),tos_uri:RT,policy_uri:g().optional(),jwks_uri:it.optional(),jwks:bd().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),T4=A({client_id:g(),client_secret:g().optional(),client_id_issued_at:pe().optional(),client_secret_expires_at:pe().optional()}).strip(),MT=I4.merge(T4),JG=A({error:g(),error_description:g().optional()}).strip(),GG=A({token:g(),token_type_hint:g().optional()}).strip();function jT(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function DT({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),i=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==i.origin||r.pathname.length<i.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=i.pathname.endsWith("/")?i.pathname:i.pathname+"/";return n.startsWith(o)}var Fe=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Xa=class extends Fe{};Xa.errorCode="invalid_request";var ei=class extends Fe{};ei.errorCode="invalid_client";var ti=class extends Fe{};ti.errorCode="invalid_grant";var ri=class extends Fe{};ri.errorCode="unauthorized_client";var Ya=class extends Fe{};Ya.errorCode="unsupported_grant_type";var Qa=class extends Fe{};Qa.errorCode="invalid_scope";var ec=class extends Fe{};ec.errorCode="access_denied";var Dr=class extends Fe{};Dr.errorCode="server_error";var tc=class extends Fe{};tc.errorCode="temporarily_unavailable";var rc=class extends Fe{};rc.errorCode="unsupported_response_type";var nc=class extends Fe{};nc.errorCode="unsupported_token_type";var ic=class extends Fe{};ic.errorCode="invalid_token";var oc=class extends Fe{};oc.errorCode="method_not_allowed";var sc=class extends Fe{};sc.errorCode="too_many_requests";var ni=class extends Fe{};ni.errorCode="invalid_client_metadata";var ac=class extends Fe{};ac.errorCode="insufficient_scope";var cc=class extends Fe{};cc.errorCode="invalid_target";var UT={[Xa.errorCode]:Xa,[ei.errorCode]:ei,[ti.errorCode]:ti,[ri.errorCode]:ri,[Ya.errorCode]:Ya,[Qa.errorCode]:Qa,[ec.errorCode]:ec,[Dr.errorCode]:Dr,[tc.errorCode]:tc,[rc.errorCode]:rc,[nc.errorCode]:nc,[ic.errorCode]:ic,[oc.errorCode]:oc,[sc.errorCode]:sc,[ni.errorCode]:ni,[ac.errorCode]:ac,[cc.errorCode]:cc};var Ur=class extends Error{constructor(e){super(e??"Unauthorized")}};function P4(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var Kb="code",Xb="S256";function z4(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&P4(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function C4(t,e,r,i){let{client_id:n,client_secret:o}=e;switch(t){case"client_secret_basic":R4(n,o,r);return;case"client_secret_post":E4(n,o,i);return;case"none":A4(n,i);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function R4(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let i=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${i}`)}function E4(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function A4(t,e){e.set("client_id",t)}async function ZT(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let i=NT.parse(JSON.parse(r)),{error:n,error_description:o,error_uri:s}=i,a=UT[n]||Dr;return new a(o||"",s)}catch(i){let n=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${i}. Raw body: ${r}`;return new Dr(n)}}async function lc(t,e){try{return await Yb(t,e)}catch(r){if(r instanceof ei||r instanceof ri)return await t.invalidateCredentials?.("all"),await Yb(t,e);if(r instanceof ti)return await t.invalidateCredentials?.("tokens"),await Yb(t,e);throw r}}async function Yb(t,{serverUrl:e,authorizationCode:r,scope:i,resourceMetadataUrl:n,fetchFn:o}){let s=await t.discoveryState?.(),a,c,l,u=n;if(!u&&s?.resourceMetadataUrl&&(u=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(c=s.authorizationServerUrl,a=s.resourceMetadata,l=s.authorizationServerMetadata??await qT(c,{fetchFn:o}),!a)try{a=await FT(e,{resourceMetadataUrl:u},o)}catch{}(l!==s.authorizationServerMetadata||a!==s.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}else{let $=await L4(e,{resourceMetadataUrl:u,fetchFn:o});c=$.authorizationServerUrl,l=$.authorizationServerMetadata,a=$.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}let d=await N4(e,t,a),p=await Promise.resolve(t.clientInformation());if(!p){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let $=l?.client_id_metadata_document_supported===!0,w=t.clientMetadataUrl;if(w&&!O4(w))throw new ni(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${w}`);if($&&w)p={client_id:w},await t.saveClientInformation?.(p);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let S=await H4(c,{metadata:l,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(S),p=S}}let f=!t.redirectUrl;if(r!==void 0||f){let $=await V4(t,c,{metadata:l,resource:d,authorizationCode:r,fetchFn:o});return await t.saveTokens($),"AUTHORIZED"}let m=await t.tokens();if(m?.refresh_token)try{let $=await q4(c,{metadata:l,clientInformation:p,refreshToken:m.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens($),"AUTHORIZED"}catch($){if(!(!($ instanceof Fe)||$ instanceof Dr))throw $}let h=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:_}=await Z4(c,{metadata:l,clientInformation:p,state:h,redirectUrl:t.redirectUrl,scope:i||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(_),await t.redirectToAuthorization(y),"REDIRECT"}function O4(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function N4(t,e,r){let i=jT(t);if(e.validateResourceURL)return await e.validateResourceURL(i,r?.resource);if(r){if(!DT({requestedResource:i,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${i} (or origin)`);return new URL(r.resource)}}function e_(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,i]=e.split(" ");if(r.toLowerCase()!=="bearer"||!i)return{};let n=Qb(t,"resource_metadata")||void 0,o;if(n)try{o=new URL(n)}catch{}let s=Qb(t,"scope")||void 0,a=Qb(t,"error")||void 0;return{resourceMetadataUrl:o,scope:s,error:a}}function Qb(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let i=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(i);return n?n[1]||n[2]:null}async function FT(t,e,r=fetch){let i=await D4(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!i||i.status===404)throw await i?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return ET.parse(await i.json())}async function t_(t,e,r=fetch){try{return await r(t,{headers:e})}catch(i){if(i instanceof TypeError)return e?t_(t,void 0,r):void 0;throw i}}function M4(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function LT(t,e,r=fetch){return await t_(t,{"MCP-Protocol-Version":e},r)}function j4(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function D4(t,e,r,i){let n=new URL(t),o=i?.protocolVersion??ln,s;if(i?.metadataUrl)s=new URL(i.metadataUrl);else{let c=M4(e,n.pathname);s=new URL(c,i?.metadataServerUrl??n),s.search=n.search}let a=await LT(s,o,r);if(!i?.metadataUrl&&j4(a,n.pathname)){let c=new URL(`/.well-known/${e}`,n);a=await LT(c,o,r)}return a}function U4(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",i=[];if(!r)return i.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),i.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),i;let n=e.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),i.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,e.origin),type:"oauth"}),i.push({url:new URL(`/.well-known/openid-configuration${n}`,e.origin),type:"oidc"}),i.push({url:new URL(`${n}/.well-known/openid-configuration`,e.origin),type:"oidc"}),i}async function qT(t,{fetchFn:e=fetch,protocolVersion:r=ln}={}){let i={"MCP-Protocol-Version":r,Accept:"application/json"},n=U4(t);for(let{url:o,type:s}of n){let a=await t_(o,i,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?Gb.parse(await a.json()):AT.parse(await a.json())}}}async function L4(t,e){let r,i;try{r=await FT(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(i=r.authorization_servers[0])}catch{}i||(i=String(new URL("/",t)));let n=await qT(i,{fetchFn:e?.fetchFn});return{authorizationServerUrl:i,authorizationServerMetadata:n,resourceMetadata:r}}async function Z4(t,{metadata:e,clientInformation:r,redirectUrl:i,scope:n,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(Kb))throw new Error(`Incompatible auth server: does not support response type ${Kb}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(Xb))throw new Error(`Incompatible auth server: does not support code challenge method ${Xb}`)}else a=new URL("/authorize",t);let c=await Jb(),l=c.code_verifier,u=c.code_challenge;return a.searchParams.set("response_type",Kb),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",Xb),a.searchParams.set("redirect_uri",String(i)),o&&a.searchParams.set("state",o),n&&a.searchParams.set("scope",n),n?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:l}}function F4(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function VT(t,{metadata:e,tokenRequestParams:r,clientInformation:i,addClientAuthentication:n,resource:o,fetchFn:s}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),n)await n(c,r,a,e);else if(i){let u=e?.token_endpoint_auth_methods_supported??[],d=z4(i,u);C4(d,i,c,r)}let l=await(s??fetch)(a,{method:"POST",headers:c,body:r});if(!l.ok)throw await ZT(l);return OT.parse(await l.json())}async function q4(t,{metadata:e,clientInformation:r,refreshToken:i,resource:n,addClientAuthentication:o,fetchFn:s}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:i}),c=await VT(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:n,fetchFn:s});return{refresh_token:i,...c}}async function V4(t,e,{metadata:r,resource:i,authorizationCode:n,fetchFn:o}={}){let s=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(s)),!a){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await t.codeVerifier();a=F4(n,l,t.redirectUrl)}let c=await t.clientInformation();return VT(e,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:t.addClientAuthentication,resource:i,fetchFn:o})}async function H4(t,{metadata:e,clientMetadata:r,fetchFn:i}){let n;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(e.registration_endpoint)}else n=new URL("/register",t);let o=await(i??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await ZT(o);return MT.parse(await o.json())}var jp=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function r_(t){}function HT(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=r_,onError:r=r_,onRetry:i=r_,onComment:n}=t,o="",s=!0,a,c="",l="";function u(h){let y=s?h.replace(/^\xEF\xBB\xBF/,""):h,[_,$]=W4(`${o}${y}`);for(let w of _)d(w);o=$,s=!1}function d(h){if(h===""){f();return}if(h.startsWith(":")){n&&n(h.slice(h.startsWith(": ")?2:1));return}let y=h.indexOf(":");if(y!==-1){let _=h.slice(0,y),$=h[y+1]===" "?2:1,w=h.slice(y+$);p(_,w,h);return}p(h,"",h)}function p(h,y,_){switch(h){case"event":l=y;break;case"data":c=`${c}${y}
|
|
100
|
+
`;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?i(parseInt(y,10)):r(new jp(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:_}));break;default:r(new jp(`Unknown field "${h.length>20?`${h.slice(0,20)}\u2026`:h}"`,{type:"unknown-field",field:h,value:y,line:_}));break}}function f(){c.length>0&&e({id:a,event:l||void 0,data:c.endsWith(`
|
|
101
|
+
`)?c.slice(0,-1):c}),a=void 0,c="",l=""}function m(h={}){o&&h.consume&&d(o),s=!0,a=void 0,c="",l="",o=""}return{feed:u,reset:m}}function W4(t){let e=[],r="",i=0;for(;i<t.length;){let n=t.indexOf("\r",i),o=t.indexOf(`
|
|
102
|
+
`,i),s=-1;if(n!==-1&&o!==-1?s=Math.min(n,o):n!==-1?n===t.length-1?s=-1:s=n:o!==-1&&(s=o),s===-1){r=t.slice(i);break}else{let a=t.slice(i,s);e.push(a),i=s+1,t[i-1]==="\r"&&t[i]===`
|
|
103
|
+
`&&i++}}return[e,r]}var Dp=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:i}={}){let n;super({start(o){n=HT({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:i})},transform(o){n.feed(o)}})}};var B4={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},$n=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Up=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=CT(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??B4}async _authThenStart(){if(!this._authProvider)throw new Ur("No auth provider");let e;try{e=await lc(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Ur;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(e.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Mp(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),r&&i.set("last-event-id",r);let n=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:this._abortController?.signal});if(!n.ok){if(await n.body?.cancel(),n.status===401&&this._authProvider)return await this._authThenStart();if(n.status===405)return;throw new $n(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,e,!0)}catch(i){throw this.onerror?.(i),i}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,i=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(i,e),n)}_scheduleReconnection(e,r=0){let i=this._reconnectionOptions.maxRetries;if(r>=i){this.onerror?.(new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let n=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},n)}_handleSseStream(e,r,i){if(!e)return;let{onresumptiontoken:n,replayMessageId:o}=r,s,a=!1,c=!1;(async()=>{try{let u=e.pipeThrough(new TextDecoderStream).pipeThrough(new Dp({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:m}=await u.read();if(m)break;if(f.id&&(s=f.id,a=!0,n?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=vo.parse(JSON.parse(f.data));Fn(h)&&(c=!0,o!==void 0&&(h.id=o)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(i||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(i||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Ur("No auth provider");if(await lc(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ur("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:i,onresumptiontoken:n}=r||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:da(e)?e.id:void 0}).catch(p=>this.onerror?.(p));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,s),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let p=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $n(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=e_(a);if(this._resourceMetadataUrl=f,this._scope=m,await lc(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ur;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=e_(a);if(h==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new $n(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),f&&(this._resourceMetadataUrl=f),this._lastUpscopingHeader=y??void 0,await lc(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ur;return this.send(e)}}throw new $n(a.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),eS(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let u=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,d=a.headers.get("content-type");if(u)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:n},!1);else if(d?.includes("application/json")){let p=await a.json(),f=Array.isArray(p)?p.map(m=>vo.parse(m)):[vo.parse(p)];for(let m of f)this.onmessage?.(m)}else throw await a.body?.cancel(),new $n(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(i){throw this.onerror?.(i),i}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,r);if(await i.body?.cancel(),!i.ok&&i.status!==405)throw new $n(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var Lp=class{options;client=null;connecting=null;constructor(e){this.options=e}async connect(){await this.ensureClient()}async listTools(){return(await this.ensureClient()).listTools()}async callTool(e,r={}){return await(await this.ensureClient()).callTool({name:e,arguments:r})}async close(){let e=this.client;this.client=null,this.connecting=null,e&&await e.close()}async ensureClient(){return this.client?this.client:this.connecting?this.connecting:(this.connecting=this.doConnect().finally(()=>{this.connecting=null}),this.connecting)}async doConnect(){let{url:e,getToken:r,clientInfo:i,onToolsChanged:n,fetchImpl:o}=this.options,s=o??fetch,a=async(u,d)=>{let p=await r(),f=new Headers(d?.headers);return f.set("Authorization",`Bearer ${p}`),s(u,{...d,headers:f})},c=new Up(new URL(e),{fetch:a}),l=new Np(i??{name:"gigabuddy-door-client",version:"0.0.1"});return n&&l.setNotificationHandler(va,async()=>n()),c.onclose=()=>{this.client===l&&(this.client=null)},await l.connect(c),this.client=l,l}};async function uc(t){let{exec:e}=await import("node:child_process"),{promisify:r}=await import("node:util"),i=r(e),n=process.platform,o=n==="darwin"?`open "${t}"`:n==="win32"?`start "" "${t}"`:`xdg-open "${t}"`;await i(o)}function WT(t){return new Promise(e=>setTimeout(e,t))}function J4(t){try{let e=t.split(".")[1];if(!e)return;let r=JSON.parse(Buffer.from(e,"base64url").toString("utf-8"));return typeof r.email=="string"?r.email:void 0}catch{return}}async function BT(t){let e=t.fetchImpl??fetch,r={clientId:t.clientId??"gigabuddy-cli"};t.productId!==void 0&&(r.productId=t.productId),t.scopes!==void 0&&(r.scopes=t.scopes);let i=await e(`${t.authUrl}/api/auth/device/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to start device flow: ${await i.text()}`);let{deviceCode:n,userCode:o,verificationUrl:s,expiresIn:a,interval:c}=await i.json();return{deviceCode:n,userCode:o,verificationUrl:s,expiresIn:a,interval:c}}async function JT(t,e,r={}){let i=r.fetchImpl??fetch,n=Date.now()+e.expiresIn*1e3,o=(e.interval||5)*1e3;for(;Date.now()<n;){await WT(o);let s=await i(`${t}/api/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e.deviceCode})});if(s.status===429){await WT(o);continue}if(!s.ok)continue;let a=await s.json();if(a.status==="complete"&&a.platformToken&&a.refreshToken&&a.userId)return{refreshToken:a.refreshToken,platformToken:a.platformToken,userId:a.userId,userEmail:a.userEmail??J4(a.platformToken)};if(a.status==="expired")throw new Error("Device code expired. Please try again.");r.onPending?.()}throw new Error("Authentication timed out. Please try again.")}var Zp=class{refreshToken;authUrl;platformToken=null;tokenExpiresAt=0;refreshPromise=null;onRefreshTokenRotated;reloginHint;fetchImpl;constructor(e){this.refreshToken=e.refreshToken,this.authUrl=e.authUrl,this.onRefreshTokenRotated=e.onRefreshTokenRotated,this.reloginHint=e.reloginHint??"Sign in again with 'gigabuddy login'.",this.fetchImpl=e.fetchImpl??fetch}async getToken(){return this.platformToken&&Date.now()<this.tokenExpiresAt-6e4?this.platformToken:this.refresh()}invalidate(){this.platformToken=null,this.tokenExpiresAt=0}async refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=this.doRefresh().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async doRefresh(){let e=await this.fetchImpl(`${this.authUrl}/api/token/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this.refreshToken})});if(!e.ok){let i=await e.text();throw new Error(`Token refresh failed (${e.status}): ${i}. ${this.reloginHint}`)}let r=await e.json();return this.platformToken=r.token,this.tokenExpiresAt=Date.now()+r.expiresIn*1e3,r.refreshToken&&r.refreshToken!==this.refreshToken&&(this.refreshToken=r.refreshToken,this.onRefreshTokenRotated?.(r.refreshToken)),r.token}};var GT={mycelium:{scratchDirName:".mycelium",scratchEnvVar:"MYCELIUM_SCRATCH_DIR",harnessSessionEnvVar:"MYCELIUM_HARNESS_SESSION_ID",serverName:"mycelium",chatSenderId:"mycelium-agent",hostDirPrefix:"mycelium-host-",bridgeSocketPrefix:"mycelium-bridge-",treeIdFileName:"mycelium-tree-id",webAppKey:"mycelium"},gigabuddy:{scratchDirName:".gigabuddy",scratchEnvVar:"GIGABUDDY_SCRATCH_DIR",harnessSessionEnvVar:"GIGABUDDY_HARNESS_SESSION_ID",serverName:"gigabuddy",chatSenderId:"gigabuddy-agent",hostDirPrefix:"gigabuddy-host-",bridgeSocketPrefix:"gigabuddy-bridge-",treeIdFileName:"gigabuddy-tree-id",webAppKey:"gigabuddy"}},Fp="mycelium";function KT(t){Fp=t}function qp(){return Fp}function ot(){return GT[Fp]}function XT(){return GT[Fp==="mycelium"?"gigabuddy":"mycelium"]}function YT(t){return{fileId:t.id,url:t.publicUrl??t.signedUrl??null,publicUrl:t.publicUrl??null,expiresAt:t.signedUrlExpiresAt??null,name:t.originalName,contentType:t.contentType,size:t.size}}var G4=6e4;function QT(t){let e=new URLSearchParams;return e.set("limit",String(t?.limit??50)),t?.after&&e.set("after",t.after),t?.before&&e.set("before",t.before),t?.senderId&&e.set("senderId",t.senderId),t?.senderType&&e.set("senderType",t.senderType),t?.sponsorId&&e.set("sponsorId",t.sponsorId),t?.activityId&&e.set("activityId",t.activityId),t?.activityKind&&e.set("activityKind",t.activityKind),t?.since&&e.set("since",t.since),t?.until&&e.set("until",t.until),e}function K4(t){if(t!=null){if(typeof t=="string"){let e=Date.parse(t);return Number.isNaN(e)?void 0:new Date(e).toISOString()}if(typeof t=="number"){let e=t<1e12?t*1e3:t;return new Date(e).toISOString()}if(typeof t=="object"){let e=t,r=e._seconds??e.seconds;if(typeof r=="number"){let i=e._nanoseconds??e.nanoseconds,n=r*1e3+(typeof i=="number"?Math.floor(i/1e6):0);return new Date(n).toISOString()}}}}function Hp(t){let e=t??{};return{...e,id:e.id??"",content:e.content??"",createdAt:K4(e.createdAt)??""}}function Vp(t){let e=t??{},r=e.data??{},i=e.full??{},n=e.metadata??{},o=s=>e[s]??i[s]??n[s]??r[s];return{...r,...i,...e,id:e.id??"",label:o("label")??"",status:o("status")??"",visibility:o("visibility")??"",kind:o("kind"),conversationId:o("conversationId"),participants:o("participants"),attachments:o("attachments"),statusText:o("statusText")}}var Wp=class{getToken;apiUrl;authUrl;onTokenExpired=null;fileUrlCache=new Map;constructor(e){this.getToken=e.getToken,this.apiUrl=e.apiUrl,this.authUrl=e.authUrl}setTokenProvider(e){this.getToken=e}currentToken(){return this.getToken()}async withTokenProvider(e,r){let i=this.getToken;this.getToken=e;try{return await r()}finally{this.getToken=i}}setOnTokenExpired(e){this.onTokenExpired=e}async fetchRaw(e,r){let i=await this.getToken(),n=await fetch(e,{...r,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",...r?.headers}});if(n.status===401&&this.onTokenExpired){await this.onTokenExpired();let s=await this.getToken(),a=await fetch(e,{...r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json",...r?.headers}});if(!a.ok){let l=await a.text();throw new Error(`API error (${a.status}): ${l}`)}return a.headers.get("content-type")?.includes("application/json")?await a.json():void 0}if(!n.ok){let s=await n.text();throw new Error(`API error (${n.status}): ${s}`)}if(n.headers.get("content-type")?.includes("application/json"))return await n.json()}async fetchPlace(e,r){return this.fetchRaw(`${this.apiUrl}${e}`,r)}async listTenancies(){return((await this.fetchRaw(`${this.apiUrl}/api/installations/mine`)).installations??[]).map(r=>({id:r.installationId,name:r.installation?.name??r.org?.name??r.installationId,productId:r.productId}))}async listPlaces(e){return(await this.fetchRaw(`${this.apiUrl}/ext/places/boot?tenancyId=${encodeURIComponent(e)}`)).places}async getPlace(e){let i=(await this.fetchPlace(`/places/${encodeURIComponent(e)}`)).place,n=i.data??i;return{id:i.id??e,name:n.name??i.name??"Unknown",description:n.description??void 0,conversationId:n.conversationId??void 0,visibility:n.visibility??void 0,memberCount:i.memberCount??n.memberCount??void 0,tenancyId:i.tenancyId??i.installationId??i.orgId??void 0,orgId:i.orgId??void 0}}async sendMessage(e,r){return this.fetchPlace(`/places/${encodeURIComponent(e)}/messages`,{method:"POST",headers:{"X-Chat-User-Id":`${qp()}-agent`,"X-Chat-Display-Name":r.senderName??"Gigabuddy Agent"},body:JSON.stringify(r)})}async getMessages(e,r){let i=QT(r),n=await this.fetchPlace(`/places/${encodeURIComponent(e)}/messages?${i.toString()}`);return{...n,messages:(n.messages??[]).map(Hp)}}async markPlaceRead(e,r){await this.fetchPlace(`/places/${encodeURIComponent(e)}/messages/read`,{method:"POST",body:JSON.stringify({messageId:r})})}async markThreadRead(e,r,i){await this.fetchPlace(`/places/${encodeURIComponent(e)}/messages/${encodeURIComponent(r)}/read`,{method:"POST",body:JSON.stringify({messageId:i})})}async getReplies(e,r,i){let n=QT(i),o=await this.fetchPlace(`/places/${encodeURIComponent(e)}/messages/${encodeURIComponent(r)}/replies?${n.toString()}`);return{...o,messages:(o.messages??[]).map(Hp)}}async sendContentCard(e,r,i,n){let o=[];n?.text&&o.push({type:"text",text:n.text,format:"markdown"});let s={type:"content_card",instanceId:r,contextType:i};n?.contextSchemaId&&(s.contextSchemaId=n.contextSchemaId),n?.view&&(s.view=n.view),n?.snapshot&&(s.snapshot=n.snapshot),o.push(s);let a=o.length===1&&!n?.text?s:{type:"composite",blocks:o};return this.sendMessage(e,{content:a,senderName:n?.senderName,parentMessageId:n?.parentMessageId})}async uploadFile(e,r,i){let n=new FormData,o=new Uint8Array(r.data).buffer,s=r.contentType?new Blob([o],{type:r.contentType}):new Blob([o]);n.append("file",s,r.filename),n.append("placeIds",JSON.stringify([e])),n.append("category",i?.category??"chat-attachment"),i?.visibility&&n.append("visibility",i.visibility);let a=async()=>{let u=await this.getToken();return fetch(`${this.apiUrl}/files/upload`,{method:"POST",headers:{Authorization:`Bearer ${u}`},body:n})},c=await a();if(c.status===401&&this.onTokenExpired&&(await this.onTokenExpired(),c=await a()),!c.ok){let u=await c.text();throw new Error(`Upload error (${c.status}): ${u}`)}let l=await c.json();return YT(l.file)}async getFileUrl(e){let r=this.fileUrlCache.get(e);if(r&&(r.publicUrl||r.expiresAt&&new Date(r.expiresAt).getTime()-Date.now()>G4))return r;let i=await this.fetchRaw(`${this.apiUrl}/files/${encodeURIComponent(e)}?download=true`),n=YT(i.file);return this.fileUrlCache.set(e,n),n}async downloadFile(e){let r=async()=>{let n=await this.getToken();return fetch(`${this.apiUrl}/files/${encodeURIComponent(e)}/download`,{headers:{Authorization:`Bearer ${n}`}})},i=await r();if(i.status===401&&this.onTokenExpired&&(await this.onTokenExpired(),i=await r()),!i.ok){let n=await i.text();throw new Error(`Download error (${i.status}): ${n}`)}return{data:new Uint8Array(await i.arrayBuffer()),contentType:i.headers.get("content-type")??"application/octet-stream"}}async getActivity(e,r){let i=await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities/${encodeURIComponent(r)}`);return Vp(i.activity)}async listActivities(e,r){let i=new URLSearchParams;r?.status&&i.set("status",r.status);let n=i.toString();return((await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities${n?`?${n}`:""}`)).activities??[]).map(Vp)}async completeActivity(e,r){await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities/${encodeURIComponent(r)}`,{method:"DELETE"})}async setMyStatus(e,r,i){let n=await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities/${encodeURIComponent(r)}/my-status`,{method:"PUT",body:JSON.stringify(i)});return Vp(n.activity)}async setStakeholder(e,r,i,n){let o=await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities/${encodeURIComponent(r)}/stakeholders/${encodeURIComponent(i)}`,{method:"PUT",body:JSON.stringify(n)});return Vp(o.activity)}async attachToActivity(e,r,i){return(await this.fetchPlace(`/places/${encodeURIComponent(e)}/activities/${encodeURIComponent(r)}/attachments`,{method:"POST",body:JSON.stringify(i)}))?.attachments??[]}async requestAgentToken(e){let r=await this.getToken(),i=await fetch(`${this.authUrl}/api/token/agent`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok){let n=await i.text();throw new Error(`Agent token request failed (${i.status}): ${n}`)}return await i.json()}async requestBrowserSession(e,r){let i=await fetch(`${this.authUrl}/api/auth/agent-session`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){let n=await i.text();throw new Error(`Browser session request failed (${i.status}): ${n}`)}return await i.json()}async updateAgentProfile(e,r){let i=await this.getToken(),n=await fetch(`${this.authUrl}/api/identity/agent-profile/${encodeURIComponent(e)}`,{method:"PATCH",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let o=await n.text();throw new Error(`Agent profile update failed (${n.status}): ${o}`)}}async createPlaceContent(e,r,i,n){return this.fetchPlace(`/places/${encodeURIComponent(e)}/content`,{method:"POST",body:JSON.stringify({...r?{contextType:r}:{},...n?.contextSchemaId?{contextSchemaId:n.contextSchemaId}:{},...n?.relationships?{relationships:n.relationships}:{},...n?.derivedFrom?{derivedFrom:n.derivedFrom}:{},...n?.mintDecisionDiscussion?{mintDecisionDiscussion:!0}:{},data:i})})}async listMyAsks(e){let r=new URLSearchParams;return e.placeId&&r.set("placeId",e.placeId),e.status&&r.set("status",e.status),e.limit&&r.set("limit",String(e.limit)),this.fetchRaw(`${this.apiUrl}/me/asks?${r.toString()}`)}async getPlaceContent(e,r){return this.fetchPlace(`/places/${encodeURIComponent(e)}/content/${encodeURIComponent(r)}`)}async updatePlaceContent(e,r,i,n){return this.fetchPlace(`/places/${encodeURIComponent(e)}/content/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify({data:i,...n?.relationships?{relationships:n.relationships}:{}})})}async claimWork(e,r,i){return this.fetchPlace(`/places/${encodeURIComponent(e)}/content/${encodeURIComponent(r)}/claim`,{method:"POST",body:JSON.stringify({from:i?.from??"open",to:i?.to??"active",...i?.extraData?{extraData:i.extraData}:{}})})}async listPlaceContent(e,r){let i=new URLSearchParams;r?.contextSchemaId&&i.set("contextSchemaId",r.contextSchemaId),r?.extendsSchemaId&&i.set("extendsSchemaId",r.extendsSchemaId),r?.contextType&&i.set("contextType",r.contextType),r?.limit&&i.set("limit",String(r.limit)),r?.before&&i.set("before",r.before);let n=i.toString();return this.fetchPlace(`/places/${encodeURIComponent(e)}/content${n?`?${n}`:""}`)}async listPlaceRules(e){return this.fetchPlace(`/places/${encodeURIComponent(e)}/rules`)}async resolvePlaceRules(e,r){let i=new URLSearchParams;r.audienceIds?.length&&i.set("audience",r.audienceIds.join(",")),r.builtIns?.length&&i.set("builtIns",r.builtIns.join(",")),r.descriptor&&i.set("descriptor",r.descriptor),r.repo&&i.set("repo",r.repo),r.path&&i.set("path",r.path),r.mode&&i.set("mode",r.mode);let n=i.toString();return this.fetchPlace(`/places/${encodeURIComponent(e)}/rules/resolve${n?`?${n}`:""}`)}async getChangedContent(e,r){let i=new URLSearchParams({since:r});return((await this.fetchPlace(`/places/${encodeURIComponent(e)}/content/index?${i.toString()}`)).items??[]).map(o=>({instanceId:o.id,updatedAt:o.updatedAt??null,contextType:o.contextType}))}async*streamWork(e,r){let n=`${this.apiUrl.replace("api.","stream.")}/places/${encodeURIComponent(e)}/work/stream`;yield*this.streamSSE(n,r)}async*streamSSE(e,r){let i=await this.getToken(),n=await fetch(e,{headers:{Authorization:`Bearer ${i}`,Accept:"text/event-stream","Cache-Control":"no-cache"},signal:r?.signal});if(!n.ok){let u=await n.text();throw new Error(`SSE stream failed (${n.status}): ${u}`)}if(!n.body)throw new Error("SSE response has no body");let o=n.body.getReader(),s=new TextDecoder,a="",c="",l=[];try{for(;;){let{done:u,value:d}=await o.read();if(u)break;a+=s.decode(d,{stream:!0});let p=a.split(`
|
|
104
|
+
`);a=p.pop();for(let f of p)if(!f.startsWith(":")){if(f.startsWith("event:"))c=f.slice(6).trim();else if(f.startsWith("data:"))l.push(f.slice(5).trim());else if(f===""){if(c&&l.length>0){let m=l.join(`
|
|
105
|
+
`);try{yield{event:c,data:JSON.parse(m)}}catch{yield{event:c,data:m}}}c="",l=[]}}}}finally{o.releaseLock()}}buildAwarenessWsUrl(e){let r=this.apiUrl.replace("api.","stream.").replace(/^http/,"ws"),i=new URLSearchParams({token:e});return`${r}/ws/awareness-v2?${i.toString()}`}};import{readdir as Y_,readFile as Yz,stat as x2}from"node:fs/promises";import{join as xc}from"node:path";var Bp=class{constructor(e){this._server=e}requestStream(e,r,i){return this._server.requestStream(e,r,i)}createMessageStream(e,r){let i=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!i?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==d.size||![...u].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},qn,r)}elicitInputStream(e,r){let i=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!i?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},pn,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,i){return this._server.getTaskResult({taskId:e},r,i)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};var Jp=class extends wo{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ba.options.map((i,n)=>[i,n])),this.isMessageIgnored=(i,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Uo,this.setRequestHandler(Iy,i=>this._oninitialize(i)),this.setNotificationHandler(zd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Fy,async(i,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=i.params,a=ba.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Bp(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Gd(this._capabilities,e)}setRequestHandler(e,r){let n=mr(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let o;if(St(n)){let a=n;o=a._zod?.def?.value??a.value}else{let a=n;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,l)=>{let u=gt(_o,c);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new O(U.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,p=await Promise.resolve(r(c,l));if(d.task){let m=gt(Er,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new O(U.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=gt(dn,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new O(U.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new 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 new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new 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 new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new 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 new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Ap(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Ep(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Sd.includes(r)?r:ln,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"},Rr)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some(l=>l.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(l=>l.type==="tool_use");if(o){if(n.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},_a,r):this.request({method:"sampling/createMessage",params:e},qn,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},pn,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},pn,r);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!a.valid)throw new O(U.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof O?s:new O(U.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Wy,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))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 tP=Symbol.for("mcp.completable");function n_(t){return!!t&&typeof t=="object"&&tP in t}function rP(t){return t[tP]?.complete}var eP;(function(t){t.Completable="McpCompletable"})(eP||(eP={}));var X4=/^[A-Za-z0-9._-]{1,128}$/;function Y4(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!X4.test(t)){let r=t.split("").filter(i=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return e.push(`Tool name contains invalid characters: ${r.map(i=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Q4(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)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 i_(t){let e=Y4(t);return Q4(t,e.warnings),e.isValid}var Gp=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,i){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,i)}};var Kp=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Jp(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Gp(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(kn(qd)),this.server.assertCanSetRequestHandler(kn(_o)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(qd,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let i={name:e,title:r.title,description:r.description,inputSchema:(()=>{let n=oo(r.inputSchema);return n?Yy(n,{strictUnions:!0,pipeStrategy:"input"}):eL})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=oo(r.outputSchema);n&&(i.outputSchema=Yy(n,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(_o,async(e,r)=>{try{let i=this._registeredTools[e.params.name];if(!i)throw new O(U.InvalidParams,`Tool ${e.params.name} not found`);if(!i.enabled)throw new O(U.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,o=i.execution?.taskSupport,s="createTask"in i.handler;if((o==="required"||o==="optional")&&!s)throw new O(U.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new O(U.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(i,e,r);let a=await this.validateToolInput(i,e.params.arguments,e.params.name),c=await this.executeToolHandler(i,a,r);return n||await this.validateToolOutput(i,c,e.params.name),c}catch(i){if(i instanceof O&&i.code===U.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,i){if(!e.inputSchema)return;let o=oo(e.inputSchema)??e.inputSchema,s=await Vu(o,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=Hu(a);throw new O(U.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${c}`)}return s.data}async validateToolOutput(e,r,i){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new O(U.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let n=oo(e.outputSchema),o=await Vu(n,r.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",a=Hu(s);throw new O(U.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${a}`)}}async executeToolHandler(e,r,i){let n=e.handler;if("createTask"in n){if(!i.taskStore)throw new Error("No task store provided.");let s={...i,taskStore:i.taskStore};if(e.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,s))}else{let a=n;return await Promise.resolve(a.createTask(s))}}if(e.inputSchema){let s=n;return await Promise.resolve(s(r,i))}else{let s=n;return await Promise.resolve(s(i))}}async handleAutomaticTaskPolling(e,r,i){if(!i.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,s={...i,taskStore:i.taskStore},a=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),c=a.task.taskId,l=a.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(p=>setTimeout(p,u));let d=await i.taskStore.getTask(c);if(!d)throw new O(U.InternalError,`Task ${c} not found during polling`);l=d}return await i.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(kn(Vd)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Vd,async e=>{switch(e.params.ref.type){case"ref/prompt":return cS(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return lS(e),this.handleResourceCompletion(e,e.params.ref);default:throw new O(U.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let i=this._registeredPrompts[r.name];if(!i)throw new O(U.InvalidParams,`Prompt ${r.name} not found`);if(!i.enabled)throw new O(U.InvalidParams,`Prompt ${r.name} disabled`);if(!i.argsSchema)return dc;let o=mr(i.argsSchema)?.[e.params.argument.name];if(!n_(o))return dc;let s=rP(o);if(!s)return dc;let a=await s(e.params.argument.value,e.params.context);return iP(a)}async handleResourceCompletion(e,r){let i=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!i){if(this._registeredResources[r.uri])return dc;throw new O(U.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=i.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return dc;let o=await n(e.params.argument.value,e.params.context);return iP(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(kn(Dd)),this.server.assertCanSetRequestHandler(kn(Ud)),this.server.assertCanSetRequestHandler(kn(Ld)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Dd,async(e,r)=>{let i=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(r);for(let a of s.resources)n.push({...o.metadata,...a})}return{resources:[...i,...n]}}),this.server.setRequestHandler(Ud,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,i])=>({name:r,uriTemplate:i.resourceTemplate.uriTemplate.toString(),...i.metadata}))})),this.server.setRequestHandler(Ld,async(e,r)=>{let i=new URL(e.params.uri),n=this._registeredResources[i.toString()];if(n){if(!n.enabled)throw new O(U.InvalidParams,`Resource ${i} disabled`);return n.readCallback(i,r)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(i.toString());if(s)return o.readCallback(i,s,r)}throw new O(U.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(kn(Zd)),this.server.assertCanSetRequestHandler(kn(Fd)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Zd,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?rL(r.argsSchema):void 0}))})),this.server.setRequestHandler(Fd,async(e,r)=>{let i=this._registeredPrompts[e.params.name];if(!i)throw new O(U.InvalidParams,`Prompt ${e.params.name} not found`);if(!i.enabled)throw new O(U.InvalidParams,`Prompt ${e.params.name} disabled`);if(i.argsSchema){let n=oo(i.argsSchema),o=await Vu(n,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",l=Hu(c);throw new O(U.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}let s=o.data,a=i.callback;return await Promise.resolve(a(s,r))}else{let n=i.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...i){let n;typeof i[0]=="object"&&(n=i.shift());let o=i[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,r,i,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,i,n,o){let s={name:e,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==i&&(delete this._registeredResources[i],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=s,s}_createRegisteredResourceTemplate(e,r,i,n,o){let s={resourceTemplate:i,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredResourceTemplates[e],l.name&&(this._registeredResourceTemplates[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.template<"u"&&(s.resourceTemplate=l.template),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let a=i.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!i.completeCallback(l))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,r,i,n,o){let s={title:r,description:i,argsSchema:n===void 0?void 0:Ln(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Ln(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,n&&Object.values(n).some(c=>{let l=c instanceof go?c._def?.innerType:c;return n_(l)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,r,i,n,o,s,a,c,l){i_(e);let u={title:r,description:i,inputSchema:nP(n),outputSchema:nP(o),annotations:s,execution:a,_meta:c,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&i_(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=u)),typeof d.title<"u"&&(u.title=d.title),typeof d.description<"u"&&(u.description=d.description),typeof d.paramsSchema<"u"&&(u.inputSchema=Ln(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=Ln(d.outputSchema)),typeof d.callback<"u"&&(u.handler=d.callback),typeof d.annotations<"u"&&(u.annotations=d.annotations),typeof d._meta<"u"&&(u._meta=d._meta),typeof d.enabled<"u"&&(u.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let i,n,o,s;if(typeof r[0]=="string"&&(i=r.shift()),r.length>1){let c=r[0];o_(c)?(n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!o_(r[0])&&(s=r.shift())):typeof c=="object"&&c!==null&&(s=r.shift())}let a=r[0];return this._createRegisteredTool(e,void 0,i,n,o,s,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,i){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:a,annotations:c,_meta:l}=r;return this._createRegisteredTool(e,n,o,s,a,c,{taskSupport:"forbidden"},l,i)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let i;typeof r[0]=="string"&&(i=r.shift());let n;r.length>1&&(n=r.shift());let o=r[0],s=this._createRegisteredPrompt(e,void 0,i,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,r,i){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s}=r,a=this._createRegisteredPrompt(e,n,o,s,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var eL={type:"object",properties:{}};function oP(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function tL(t){return"_def"in t||"_zod"in t||oP(t)}function o_(t){return typeof t!="object"||t===null||tL(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(oP)}function nP(t){if(t)return o_(t)?Ln(t):t}function rL(t){let e=mr(t);return e?Object.entries(e).map(([r,i])=>{let n=Ak(i),o=Ok(i);return{name:r,description:n,required:!o}}):[]}function kn(t){let r=mr(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=Wu(r);if(typeof i=="string")return i;throw new Error("Schema method literal must be a string")}function iP(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var dc={completion:{values:[],hasMore:!1}};import aP from"node:process";var Xp=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
106
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),nL(r)}clear(){this._buffer=void 0}};function nL(t){return vo.parse(JSON.parse(t))}function sP(t){return JSON.stringify(t)+`
|
|
107
|
+
`}var Yp=class{constructor(e=aP.stdin,r=aP.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Xp,this._started=!1,this._ondata=i=>{this._readBuffer.append(i),this.processReadBuffer()},this._onerror=i=>{this.onerror?.(i)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let i=sP(e);this._stdout.write(i)?r():this._stdout.once("drain",r)})}};function ii(t,e){for(;e>127;)t.push(128|e&127),e>>>=7;t.push(e&127)}function oi(t,e){let r=0,i=0,n=e;for(;;){let o=t[n++];if(r|=(o&127)<<i,o<128)return{value:r>>>0,bytesRead:n-e};i+=7}}function Qp(t,e,r){let i=r===null?"null":JSON.stringify(r),n=new TextEncoder().encode(i),o=[];ii(o,1);let s=[];ii(s,1),ii(s,t),ii(s,e),ii(s,n.length);for(let a=0;a<n.length;a++)s.push(n[a]);ii(o,s.length);for(let a=0;a<s.length;a++)o.push(s[a]);return new Uint8Array(o)}function ef(t){let e=0,r=oi(t,e);if(e+=r.bytesRead,r.value!==1)return[];let i=oi(t,e);e+=i.bytesRead;let n=e+i.value,o=oi(t,e);e+=o.bytesRead;let s=o.value,a=[];for(let c=0;c<s&&e<n;c++){let l=oi(t,e);e+=l.bytesRead;let u=oi(t,e);e+=u.bytesRead;let d=oi(t,e);e+=d.bytesRead;let p=t.slice(e,e+d.value);e+=d.value;try{let f=JSON.parse(new TextDecoder().decode(p));a.push({clientId:l.value,clock:u.value,state:f===null||typeof f=="object"&&Object.keys(f).length===0?null:f})}catch{}}return a}function tf(t,e){let r=new TextEncoder().encode(t),i=[];ii(i,r.length);let n=new Uint8Array(i.length+r.length+e.length);return n.set(i,0),n.set(r,i.length),n.set(e,i.length+r.length),n}function s_(t){let e=oi(t,0),r=t.slice(e.bytesRead,e.bytesRead+e.value),i=new TextDecoder().decode(r),n=t.slice(e.bytesRead+e.value);return{topic:i,awarenessBytes:n}}var cP=15,iL=1e3,oL=3e4,sL=6e4,aL=5e3,cL=3e4,lL=3,Lo=class{config;ws=null;topics=new Map;seq=0;pendingSubscribes=new Map;graceTimers=new Map;reconnectAttempt=0;reconnectTimer=null;connecting=!1;intentionalClose=!1;connectGeneration=0;_connected=!1;rawHandlers=new Map;rawReconnectHandlers=new Map;connectionListeners=new Set;placeEventListeners=new Set;_diag={binaryIn:0,binaryOut:0,topicMatch:0,topicMiss:0,peersDecoded:0,controlIn:0,selfSkip:0,nullState:0,kept:0,lastPeers:[],missedTopics:[]};constructor(e){this.config=e}get connected(){return this._connected}onConnectionChange(e){return this.connectionListeners.add(e),()=>this.connectionListeners.delete(e)}onPlaceEvent(e){return this.placeEventListeners.add(e),()=>this.placeEventListeners.delete(e)}setConnected(e){if(this._connected!==e){this._connected=e;for(let r of this.connectionListeners)r(e)}}async connect(){this.intentionalClose=!1,this.reconnectAttempt=0;let e=++this.connectGeneration,r=await this.config.getToken();if(e===this.connectGeneration)return this.doConnect(this.config.buildWsUrl(r),e)}doConnect(e,r){let i=r??this.connectGeneration;return new Promise((n,o)=>{if(i!==this.connectGeneration)return n();this.connecting=!0,this.ws=new WebSocket(e),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{if(this.connecting=!1,i!==this.connectGeneration)return this.ws?.close(),n();this.reconnectAttempt=0,this.setConnected(!0),this.flushSubscriptions(),n()},this.ws.onerror=()=>{this.connecting=!1,this.reconnectAttempt===0&&o(new Error("WebSocket error"))},this.ws.onclose=()=>{if(this.connecting=!1,this.setConnected(!1),this.intentionalClose||i!==this.connectGeneration){this.clearAllPeers();return}this.scheduleReconnect()},this.ws.onmessage=s=>{typeof s.data=="string"?(this._diag.controlIn++,this.handleControlMessage(s.data)):(this._diag.binaryIn++,this.handleBinaryMessage(new Uint8Array(s.data)))}})}disconnect(){this.intentionalClose=!0,this.connectGeneration++,this.setConnected(!1),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let[,e]of this.graceTimers)clearTimeout(e);this.graceTimers.clear();for(let[,e]of this.topics)e.typingExpiryTimer&&clearTimeout(e.typingExpiryTimer);this.ws&&(this.ws.close(),this.ws=null),this.clearAllPeers(),this.topics.clear(),this.rawHandlers.clear(),this.rawReconnectHandlers.clear(),this.connectionListeners.clear()}scheduleReconnect(){if(this.intentionalClose)return;let e=this.reconnectAttempt>=cP;e&&this.reconnectAttempt===cP&&(console.error("[AwarenessManager] Max reconnect attempts reached, entering slow-poll mode (every 60s)"),this.clearAllPeers());let r=e?sL:Math.min(iL*Math.pow(2,this.reconnectAttempt),oL)*(1+Math.random()*.25);this.reconnectAttempt++;let i=this.connectGeneration;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,!(this.intentionalClose||i!==this.connectGeneration)&&(this.connecting||this._connected||this.config.getToken().then(n=>{if(i===this.connectGeneration)return this.doConnect(this.config.buildWsUrl(n),i)}).catch(n=>{e?console.error("[AwarenessManager] Slow-poll reconnect failed, will retry"):console.error("[AwarenessManager] Reconnect failed:",n),i===this.connectGeneration&&this.scheduleReconnect()}))},r)}async ensureConnected(){if(this._connected)return!0;if(this.intentionalClose||this.reconnectTimer||this.connecting)return!1;try{let e=await this.config.getToken();return this.intentionalClose?!1:(await this.doConnect(this.config.buildWsUrl(e)),this._connected)}catch(e){return console.error("[AwarenessManager] ensureConnected failed:",e),this.scheduleReconnect(),!1}}flushSubscriptions(){for(let[e,r]of this.topics){r.subscribed=!1;let i=++this.seq;this.sendControl({type:"subscribe",topic:e,seq:i}),this.pendingSubscribes.set(i,{topic:e,resolve:()=>{r.subscribed=!0,r.localState&&(r.clock++,this.sendTopicAwareness(e,r));let n=this.rawReconnectHandlers.get(e);n&&n()},reject:()=>{}})}}subscribe(e){let r=this.graceTimers.get(e);if(r&&(clearTimeout(r),this.graceTimers.delete(e),this.topics.get(e)?.subscribed))return Promise.resolve();let i=this.topics.get(e);return i?.subscribed||(i||this.topics.set(e,{clientId:this.config.clientId??Math.random()*1073741823>>>0,clock:0,localState:null,peers:new Map,subscribers:new Set,typingExpiryTimer:null,subscribed:!1}),!this._connected)?Promise.resolve():new Promise((n,o)=>{let s=++this.seq;this.sendControl({type:"subscribe",topic:e,seq:s}),this.pendingSubscribes.set(s,{topic:e,resolve:n,reject:o})})}unsubscribe(e){let r=this.topics.get(e);if(r&&!(r.subscribers.size>0)){if(this.graceTimers.size>=lL){let i=this.graceTimers.keys().next().value,n=this.graceTimers.get(i);n&&clearTimeout(n),this.graceTimers.delete(i),this.doUnsubscribe(i)}this.graceTimers.set(e,setTimeout(()=>{this.graceTimers.delete(e),this.doUnsubscribe(e)},cL))}}doUnsubscribe(e){let r=this.topics.get(e);if(r){if(r.typingExpiryTimer&&clearTimeout(r.typingExpiryTimer),r.subscribed&&this._connected){let i=++this.seq;this.sendControl({type:"unsubscribe",topic:e,seq:i})}this.topics.delete(e)}}setTopicState(e,r){let i=this.topics.get(e);i&&(i.localState=r,i.clock++,this.sendTopicAwareness(e,i))}updateTopicState(e,r){let i=this.topics.get(e);i&&this.setTopicState(e,{...i.localState,...r})}getTopicPeers(e){let r=this.topics.get(e);if(!r)return[];let i=[];for(let[n,{state:o,clock:s}]of r.peers)n!==r.clientId&&i.push({clientId:n,state:o,clock:s});return i}onTopicUpdate(e,r){let i=this.topics.get(e);return i?(i.subscribers.add(r),()=>{i.subscribers.delete(r)}):()=>{}}signalTyping(e,r=aL){let i=this.topics.get(e);i&&(i.typingExpiryTimer&&clearTimeout(i.typingExpiryTimer),i.localState?.typing||this.updateTopicState(e,{typing:!0}),i.typingExpiryTimer=setTimeout(()=>{i.typingExpiryTimer=null,i.localState?.typing&&this.updateTopicState(e,{typing:!1})},r))}stopTyping(e){let r=this.topics.get(e);r&&(r.typingExpiryTimer&&(clearTimeout(r.typingExpiryTimer),r.typingExpiryTimer=null),r.localState?.typing&&this.updateTopicState(e,{typing:!1}))}async subscribeRaw(e,r,i){this.rawHandlers.set(e,r),i&&this.rawReconnectHandlers.set(e,i),await this.subscribe(e)}sendRaw(e,r){!this.ws||this.ws.readyState!==WebSocket.OPEN||this.ws.send(tf(e,r))}unsubscribeRaw(e){this.rawHandlers.delete(e),this.rawReconnectHandlers.delete(e),this.unsubscribe(e)}async refreshToken(){if(!this._connected||!this.ws)return;let e=await this.config.getToken(),r=++this.seq;this.sendControl({type:"token",token:e,seq:r})}handleControlMessage(e){let r;try{r=JSON.parse(e)}catch{return}let i=r.type,n=r.seq,o=r.topic;switch(i){case"subscribed":{if(n!=null){let s=this.pendingSubscribes.get(n);if(s){this.pendingSubscribes.delete(n);let a=this.topics.get(s.topic);if(a){a.subscribed=!0;let c=r.state;if(c){for(let l of c)l.clientId!==a.clientId&&a.peers.set(l.clientId,{state:l.state,clock:0});this.notifySubscribers(a)}}s.resolve()}}break}case"subscribe_error":{if(n!=null){let s=this.pendingSubscribes.get(n);s&&(this.pendingSubscribes.delete(n),s.reject(new Error(r.reason??"Subscribe failed")))}break}case"unsubscribed":{if(!o)break;if(n==null){let s=this.topics.get(o);s&&(s.subscribed=!1,s.peers.clear(),this.notifySubscribers(s),s.typingExpiryTimer&&clearTimeout(s.typingExpiryTimer),this.topics.delete(o))}break}case"token_ok":break;case"content_changed":case"activity_changed":case"message_created":case"garden_tended":case"ask_created":{if(this.placeEventListeners.size>0){let s=r;for(let a of this.placeEventListeners)try{a(s)}catch(c){console.error("[AwarenessManager] place event listener error:",c)}}break}case"error":console.error("[AwarenessManager] Server error:",r.reason);break}}handleBinaryMessage(e){let{topic:r,awarenessBytes:i}=s_(e),n=this.rawHandlers.get(r);if(n){try{n(i)}catch{}return}let o=this.topics.get(r);if(!o){this._diag.topicMiss++,this._diag.missedTopics.length<5&&this._diag.missedTopics.push(r.slice(0,60));return}this._diag.topicMatch++;let s=ef(i);this._diag.peersDecoded+=s.length,this._diag.lastPeers=s.map(c=>{let l=c.clientId===o.clientId?"self":c.state===null?"null-state":"kept";return{clientId:c.clientId,clock:c.clock,stateKeys:c.state?Object.keys(c.state).join(","):"null",skip:l}});let a=!1;for(let c of s){if(c.clientId===o.clientId){this._diag.selfSkip++;continue}if(c.state===null)this._diag.nullState++,o.peers.has(c.clientId)&&(o.peers.delete(c.clientId),a=!0);else{this._diag.kept++;let l=o.peers.get(c.clientId);(!l||l.clock<c.clock)&&(o.peers.set(c.clientId,{state:c.state,clock:c.clock}),a=!0)}}a&&this.notifySubscribers(o)}sendControl(e){!this.ws||this.ws.readyState!==WebSocket.OPEN||this.ws.send(JSON.stringify(e))}sendTopicAwareness(e,r){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return;this._diag.binaryOut++;let i=Qp(r.clientId,r.clock,r.localState),n=tf(e,i);this.config.debug&&console.error(`[AwarenessManager] sending awareness for "${e}" clientId=${r.clientId} clock=${r.clock} (${n.length} bytes)`),this.ws.send(n)}notifySubscribers(e){for(let r of e.subscribers)try{r()}catch{}}clearAllPeers(){for(let[,e]of this.topics)e.peers.clear(),this.notifySubscribers(e)}};import{readFile as fL}from"node:fs/promises";import{basename as mL}from"node:path";var hL={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",mp4:"video/mp4",mov:"video/quicktime",webm:"video/webm",pdf:"application/pdf",txt:"text/plain",md:"text/markdown",json:"application/json",csv:"text/csv",html:"text/html",zip:"application/zip"};function gL(t){let e=t.split(".").pop()?.toLowerCase()??"";return hL[e]??"application/octet-stream"}function yL(t){return t.startsWith("image/")}var a_=new Set(["image/png","image/jpeg","image/gif","image/webp"]),vL=new Set(["application/json","application/ld+json","application/xml","application/csv","application/yaml","application/x-yaml","application/javascript","application/x-ndjson","application/x-sh","application/toml"]);function dP(t){let e=t.split(";")[0].trim().toLowerCase();return e.startsWith("text/")||vL.has(e)}var c_=512*1024;function xn(t){return t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function pP(t){return t.startsWith("file:")?t.slice(5):t}function bL(t){if(t.length<30)return null;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return{width:lP(t,16),height:lP(t,20)};if(t[0]===71&&t[1]===73&&t[2]===70&&t[3]===56)return{width:t[6]|t[7]<<8,height:t[8]|t[9]<<8};if(t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80){let e=String.fromCharCode(t[12],t[13],t[14],t[15]);if(e==="VP8 ")return{width:(t[26]|t[27]<<8)&16383,height:(t[28]|t[29]<<8)&16383};if(e==="VP8L"){let r=t[21]|t[22]<<8|t[23]<<16|t[24]<<24;return{width:(r&16383)+1,height:(r>>14&16383)+1}}return e==="VP8X"?{width:1+(t[24]|t[25]<<8|t[26]<<16),height:1+(t[27]|t[28]<<8|t[29]<<16)}:null}if(t[0]===255&&t[1]===216){let e=2;for(;e+9<t.length;){if(t[e]!==255)return null;let r=t[e+1];for(;r===255&&e+2<t.length;)e++,r=t[e+1];if(r===1||r>=208&&r<=217){e+=2;continue}let i=t[e+2]<<8|t[e+3];if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{width:t[e+7]<<8|t[e+8],height:t[e+5]<<8|t[e+6]};if(i<2)return null;e+=2+i}return null}return null}function lP(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}var uP=100*1024*1024;async function rf(t,e,r){let i=await Promise.all(r.map(async n=>{let o;try{o=new Uint8Array(await fL(n))}catch(a){throw new Error(`Cannot read attachment "${n}": ${a instanceof Error?a.message:String(a)}`)}if(o.length>uP)throw new Error(`Attachment "${n}" is ${xn(o.length)} \u2014 over the ${xn(uP)} upload limit.`);let s=gL(n);return{path:n,data:o,contentType:s}}));return Promise.all(i.map(async n=>{let o=await t.uploadFile(e,{data:n.data,filename:mL(n.path),contentType:n.contentType});return{info:o,dims:yL(o.contentType)?bL(n.data):null}}))}function _L(t){let e=t.name||"file",r=t.contentType||"unknown type",i=typeof t.size=="number"?`, ${xn(t.size)}`:"",n=t.fileId,o=n?` \u2014 file:${n} (use view_file to look at it)`:"";return`\u{1F4CE} ${e} (${r}${i})${o}`}function wL(t,e){let r=t.caption||"",i=Array.isArray(t.images)?t.images:[],n=i.map(c=>c.fileId?`file:${c.fileId}`:null).filter(Boolean).join(", "),o=`\u{1F5BC} ${i.length} image(s)${r?`: ${r}`:""}`,s=n?` \u2014 ${n} (use view_file to look at them)`:"",a=e?` [gallery ${e}]`:"";return`${o}${s}${a}`}function $L(t){let e=t.contextType||"content",r=t.instanceId,i=t.snapshot;if(e==="photo_gallery"&&i)return wL(i,r);let n=i?.title||i?.name||"";return`[${e} card${n?` "${n}"`:""}${r?` ${r}`:""}]`}function Lr(t){if(t==null)return"";if(typeof t=="string")return t;let e=t.type;if(e==="file")return _L(t);if(e==="content_card")return $L(t);if(e==="text")return t.text??"";if(e==="composite")return(Array.isArray(t.blocks)?t.blocks:[]).map(n=>Lr(n)).filter(Boolean).join(`
|
|
108
|
+
`);let r=JSON.stringify(t);return r.length>300?`${r.slice(0,300)}\u2026`:r}function kL(t){return t??""}function nf(t,e,r,i){let n=t.placeId;if(!n||!i)return;let o=kL(r);if(t.serverReadCursors.get(o)===i)return;t.serverReadCursors.set(o,i);let s=()=>{t.serverReadCursors.get(o)===i&&t.serverReadCursors.delete(o)};try{let a=r?e.markThreadRead(n,r,i):e.markPlaceRead(n,i);Promise.resolve(a).catch(s)}catch{s()}}function xL(t){let e=new Map;for(let s of t.activeActivities.values())e.set(s.activityId,s.conversationId);let r=[];for(let s of t.officeHours.values())r.push({activityId:s.activityId,pageId:s.pageId,role:s.role,until:s.until}),e.has(s.activityId)||e.set(s.activityId,t.conversationIdForActivity(s.activityId)??"");let i=[...e.keys()],n=t.narrowWaitConvId,o=n?i.filter(s=>e.get(s)===n):i;return{stakeholderOf:i,availableFor:o,officeHours:r}}function sr(t){let{placeId:e,awarenessManager:r}=t;!e||!r||r.updateTopicState(e,{availability:xL(t),beatAt:Date.now()})}function fP(t,e=Date.now()){return typeof t!="number"?!0:e-t<55e3}function mP(t){let e=t.availability;if(!e||typeof e!="object")return null;let r=e;return{stakeholderOf:Array.isArray(r.stakeholderOf)?r.stakeholderOf:[],availableFor:Array.isArray(r.availableFor)?r.availableFor:[],officeHours:Array.isArray(r.officeHours)?r.officeHours:[]}}var of=class{connected=!1;placeId=null;tenancyId=null;placeConversationId=null;houseRuleHeadlines=null;agentId=null;agentMeta=null;awarenessManager=null;livePageManager=null;livePageManagerFactory=null;workRanker=null;inboxWriter=null;statuslineRenderer=null;bridge=null;currentActivity=null;activeActivities=new Map;lastMessageCursor=null;readCursors=new Map;serverReadCursors=new Map;workspaceInstanceId=null;sponsorTopic=null;watchedPages=new Map;subscribedThreads=new Set;narrowWaitConvId=null;autoConnectSuppressed=!1;autoConnectAmbiguity=null;officeHours=new Map;getReadCursor(e){return e?this.readCursors.get(e)??null:this.lastMessageCursor}setReadCursor(e,r){e?this.readCursors.set(e,r):this.lastMessageCursor=r}watchPage(e,r,i,n){this.watchedPages.set(e,{instanceId:e,title:r,lastKnownUpdatedAt:i??null,lastKnownDocument:n})}subscribeToThread(e){this.subscribedThreads.has(e)||(this.subscribedThreads.add(e),sr(this))}unsubscribeFromThread(e){let r=this.subscribedThreads.delete(e);return r&&sr(this),r}setNarrowWait(e){this.narrowWaitConvId!==e&&(this.narrowWaitConvId=e,sr(this))}trackActivity(e,r){r?.focus!==!1&&(this.currentActivity=e),this.activeActivities.set(e.activityId,e),e.conversationId&&this.subscribeToThread(e.conversationId),this.inboxWriter?.notePosition(),sr(this)}clearCurrentActivity(){this.currentActivity=null,this.inboxWriter?.notePosition()}setOfficeHours(e){this.officeHours.set(e.pageId,e),this.inboxWriter?.noteSelfChanged?.(),sr(this)}clearOfficeHours(e){this.officeHours.delete(e)&&(this.inboxWriter?.noteSelfChanged?.(),sr(this))}clearOfficeHoursForActivity(e){let r=!1;for(let[i,n]of this.officeHours)n.activityId===e&&(this.officeHours.delete(i),r=!0);r&&(this.inboxWriter?.noteSelfChanged?.(),sr(this))}conversationIdForActivity(e){return(this.activeActivities.get(e)??(this.currentActivity?.activityId===e?this.currentActivity:void 0))?.conversationId||void 0}reset(){this.connected=!1,this.statuslineRenderer?.setPlaceConnected(!1),this.placeId=null,this.tenancyId=null,this.placeConversationId=null,this.houseRuleHeadlines=null,this.agentId=null,this.agentMeta=null,this.awarenessManager=null,this.livePageManager?.closeAll(),this.livePageManager=null,this.bridge?.dispose(),this.bridge=null,this.inboxWriter=null,this.currentActivity=null,this.activeActivities.clear(),this.lastMessageCursor=null,this.readCursors.clear(),this.serverReadCursors.clear(),this.workspaceInstanceId=null,this.sponsorTopic=null,this.watchedPages.clear(),this.subscribedThreads.clear(),this.officeHours.clear(),this.narrowWaitConvId=null}};function _t(t){if(!t.connected||!t.agentMeta||!t.placeId)throw new Error("Not connected. Call 'connect' first to join a place.")}async function Zo(t){if(!t.connected||!t.awarenessManager||!t.placeId)return!1;if(t.awarenessManager.connected)return!0;console.error("[gigabuddy] WebSocket dead, attempting reconnect...");let e=await t.awarenessManager.ensureConnected();if(e){console.error("[gigabuddy] WebSocket reconnected, resubscribing...");try{await t.awarenessManager.subscribe(t.placeId),t.agentMeta&&t.awarenessManager.updateTopicState(t.placeId,{displayName:t.agentMeta.displayName,status:"active"})}catch(r){return console.error("[gigabuddy] Resubscribe failed:",r),!1}}return e}var hP=new Map,SL=5*6e4;async function si(t,e,r){if(!r||r.startsWith("conv"))return r;if(r.startsWith("activity:")){let i=t.conversationIdForActivity(r);if(i)return i;let n=hP.get(r);if(n)return n;if(t.placeId)try{let o=await e.getActivity(t.placeId,r);if(o.conversationId)return hP.set(r,o.conversationId),o.conversationId}catch{}}return r}async function sf(t,e,r){let{threadKeys:i,afterMessageId:n,timeoutSec:o,format:s}=r,a=r.noun??"reply",c=t.agentId,l=t.placeId;if(i&&i.size===0)return{content:[{type:"text",text:"You aren't subscribed to any threads yet \u2014 reply in a thread, pick up a handover, or pass parentMessageId to wait on a specific one."}]};let u=P=>i===null?!0:!!P.parentMessageId&&i.has(P.parentMessageId),d=P=>P.senderCanonicalId!==c&&(P.contentType??"text")!=="system"&&u(P),p=P=>i===null?void 0:P.parentMessageId,f=(P,se)=>{t.setReadCursor(P,se),t.inboxWriter?.notePosition(),nf(t,e,P,se)},m=async P=>{if(i===null){let se=P??t.getReadCursor(void 0)??void 0;if(!se)return null;let ue=await e.getMessages(l,{after:se,limit:50}),ae=ue.messages.find(d);return ae||(ue.messages.length>0&&f(void 0,ue.messages[ue.messages.length-1].id),null)}for(let se of i){let ue=(i.size===1?P:void 0)??t.getReadCursor(se)??void 0,ae=await e.getReplies(l,se,{after:ue,limit:50}),Me=ae.messages.find(d);if(Me)return Me;ae.messages.length>0&&f(se,ae.messages[ae.messages.length-1].id)}return null},h=await m(n);if(h)return f(p(h),h.id),{content:[{type:"text",text:`${IL(a)} found:
|
|
109
|
+
|
|
110
|
+
${s(h)}`}]};let y=i&&i.size===1?[...i][0]:void 0;y&&(t.awarenessManager?.updateTopicState(l,{waitingOnThread:{parentMessageId:y,since:Date.now()}}),t.setNarrowWait(y));let _,$=new Promise(P=>_=P),w=!1,k=async()=>{if(!w){w=!0;try{let P=await m();P&&_(P)}catch{}finally{w=!1}}},S=null,J=null,F=[];try{S=setTimeout(()=>_(null),o*1e3);let P=t.awarenessManager;P&&(await Zo(t).catch(()=>!1),F.push(P.onPlaceEvent(ue=>{if(ue.type!=="message_created"||(ue.placeId??ue.topic)!==l)return;let ae=ue.message;if(!ae||typeof ae!="object")return;let Me=Hp(ae);Me.id&&d(Me)&&_(Me)})),F.push(P.onConnectionChange(ue=>{ue&&k()}))),J=setInterval(()=>void k(),SL);let se=await $;return se?(f(p(se),se.id),{content:[{type:"text",text:`New message received:
|
|
111
|
+
|
|
112
|
+
${s(se)}`}]}):{content:[{type:"text",text:`No ${a} received within ${o}s timeout.`}]}}finally{S&&clearTimeout(S),J&&clearInterval(J);for(let P of F)P();y&&(t.awarenessManager?.updateTopicState(l,{waitingOnThread:null}),t.setNarrowWait(null))}}function IL(t){return t.charAt(0).toUpperCase()+t.slice(1)}async function gP(t,e,r,i){let n=new AbortController,o=setTimeout(()=>n.abort(),r*1e3);try{for await(let s of t.streamWork(e,{signal:n.signal})){if(s.event!=="work")continue;let a=i(s.data);if(a)return clearTimeout(o),a}return null}catch(s){if(s instanceof Error&&s.name==="AbortError")return null;throw s}finally{clearTimeout(o)}}var Fo=(t,e=!1)=>({content:[{type:"text",text:t}],...e?{isError:!0}:{}});function l_(t){let e=(t.content??[]).map(r=>r.type==="text"?r.text:"").join(`
|
|
113
|
+
`).trim();try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:null}catch{return null}}var Be=t=>typeof t=="string"&&t?t:void 0;function qo(t){if(!t.placeId)throw new Error("Not connected to a place. Use the connect tool first.");return t.placeId}async function yP(t,e){return(await rf(t.client,qo(t.state),e)).map(i=>({fileId:i.info.fileId,...i.dims?{width:i.dims.width,height:i.dims.height}:{}}))}var TL=6*60*60*1e3,u_={send_message:{async pre(t,e){let r=Array.isArray(t.attachments)?t.attachments:[],{attachments:i,...n}=t;return{args:{...n,placeId:qo(e.state),...r.length?{attachments:await yP(e,r)}:{}}}},async post(t,e,r,i,n){if(!t)return e;let o=Be(t.messageId),s=Be(t.threadId);return s&&o&&(n.state.subscribeToThread(s),n.state.setReadCursor(s,o),n.state.inboxWriter?.notePosition()),Fo(Be(t.message)??`Message sent (${o??"unknown"})`)}},log:{async pre(t,e){let r=Be(t.activityId)??e.state.currentActivity?.activityId;if(!r)return{refuse:Fo("No active activity. Start one with start_activity, or pass an explicit activityId.",!0)};let i=Array.isArray(t.attachments)?t.attachments:[],{attachments:n,...o}=t;return{args:{...o,activityId:r,placeId:qo(e.state),...i.length?{attachments:await yP(e,i)}:{}}}},async post(t,e){return t?Fo(Be(t.message)??"Logged."):e}},decide:{async pre(t,e){let r=e.state.currentActivity?.activityId;return{args:{...t,placeId:qo(e.state),...r&&!t.activityId?{activityId:r}:{}}}},async post(t,e){return t?Fo(Be(t.message)??"Decided."):e}},get_messages:{async pre(t,e){if(Be(t.messageId))return{args:{messageId:t.messageId,placeId:e.state.placeId},meta:{pointRead:!0}};let r=t.reset===!0,i=Be(t.before),n=Be(t.after),o=!!i,s;Be(t.parentMessageId)&&(s=await si(e.state,e.client,t.parentMessageId));let a=r?void 0:s?e.state.getReadCursor(s)??void 0:e.state.lastMessageCursor??void 0,c=i??n??a,l=!i&&!n&&a!=null;return{args:{placeId:qo(e.state),...s?{parentMessageId:s}:{},...t.limit!=null?{limit:t.limit}:{},...i?{before:i}:c?{after:c}:{}},meta:{convId:s,isHistoryRead:o,usedStoredCursor:l,storedCursor:a,limit:t.limit,localParent:Be(t.parentMessageId)}}},async post(t,e,r,i,n){if(!t||r.pointRead)return t?Fo(Be(t.message)??""):e;let o=r.convId,s=o?`thread ${r.localParent??o}`:"the place chat",a=t,c;if(r.usedStoredCursor){let d=typeof a.count=="number"?a.count:0,p={placeId:qo(n.state),...o?{parentMessageId:o}:{}},f=async m=>l_(await n.callDoor({...p,limit:m}));if(d===0){let m=await f(1),h=m&&Be(m.lastId);if(h&&h!==r.storedCursor){let y=await f(Number(r.limit??50));y&&(a=y,c=`\u26A0 Your saved read position in ${s} (${r.storedCursor}) no longer resolves \u2014 it likely points at a deleted message, so "no new messages" would have been wrong. Reset to the latest window; your actual gap may be larger.`)}}else if(a.hasMore===!0){let m=Be(a.lastCreatedAt),h=m?Date.now()-new Date(m).getTime():NaN;if(Number.isFinite(h)&&h>TL){let y=h>=1728e5?`${Math.round(h/864e5)} days`:`${Math.round(h/36e5)}h`,_=Be(a.firstId)??"(unknown)",$=await f(Number(r.limit??50));if($){let w=Be($.firstId)??"";a=$,c=`\u26A0 Your read position in ${s} was far behind: the next-unread window ended ~${y} ago with more backlog after it. Clamped to the latest ${$.count} message(s); the skipped gap starts at ${_} \u2014 pass before: "${w}" to scroll back into it.`}}}}let l=Be(a.lastId);!r.isHistoryRead&&l&&(o?(n.state.setReadCursor(o,l),n.state.inboxWriter?.notePosition()):(n.state.lastMessageCursor=l,nf(n.state,n.client,void 0,l)));let u=Be(a.message)??"";return Fo(c?`${c}
|
|
114
|
+
|
|
115
|
+
${u}`:u)}}};var PL=["raise","read_work","read_page","search","send_message","get_messages","decide","log"],zL={read_page:"get_page"},vP=new Set(["await_work","wait_for_reply","listen","subscribe","unsubscribe","connect","disconnect","login","session_status","host_status","recovery_status","upload_file","view_file","set_my_status","set_intent"]);function CL(){let t=process.env.GIGABUDDY_REMOTE_TOOLS;return t!==void 0?t.trim()===""||t.trim()==="none"?new Set:new Set(t.split(",").map(e=>e.trim()).filter(Boolean)):new Set(PL)}function d_(t){let e={},r=t?.properties??{},i=new Set(t?.required??[]);for(let[n,o]of Object.entries(r)){let s;Array.isArray(o.enum)&&o.enum.length>0?s=H.enum(o.enum):o.anyOf?s=H.string():o.type==="string"?s=H.string():o.type==="number"||o.type==="integer"?s=H.number():o.type==="boolean"?s=H.boolean():o.type==="array"?s=H.array(H.any()):s=H.any(),o.description&&(s=s.describe(o.description)),i.has(n)||(s=s.optional()),e[n]=s}return e}var af=class{constructor(e,r,i,n={}){this.server=e;this.client=r;this.state=i;this.options=n}door=null;flipped=new Set;registeredDoorOnly=new Set;refreshing=null;activate(){if(!this.door&&this.options.doorClient&&(this.door=this.options.doorClient),!this.door){let e=this.options.doorUrl??process.env.GIGABUDDY_DOOR_URL??"https://mcp.gigabuddy.com";this.door=new Lp({url:e,getToken:()=>this.client.currentToken(),clientInfo:{name:"gigabuddy-agent",version:this.options.version??"0.0.0"},onToolsChanged:()=>void this.refresh()})}this.refresh()}async close(){let e=this.door;this.door=null,e&&await e.close().catch(()=>{})}async refresh(){return this.refreshing?this.refreshing:(this.refreshing=this.doRefresh().finally(()=>{this.refreshing=null}),this.refreshing)}async doRefresh(){let e=this.door;if(!e)return;let r;try{r=(await e.listTools()).tools}catch(o){console.error(`[gigabuddy] door proxy: tools/list failed (${o instanceof Error?o.message:o}) \u2014 local only`);return}let i=CL(),n=this.server._registeredTools;for(let o of r){let s=zL[o.name];if(s&&n[s]){let c=n[s];if(i.has(o.name)&&!vP.has(s)&&!this.flipped.has(o.name)){let l=c.handler;c.update({description:o.description,paramsSchema:d_(o.inputSchema),callback:this.doorCallback(o.name,l)}),this.flipped.add(o.name),console.error(`[gigabuddy] door proxy: '${s}' now remote-preferred via door '${o.name}' (local fallback armed)`)}continue}let a=n[o.name];if(a&&i.has(o.name)&&!vP.has(o.name)&&!this.flipped.has(o.name)){if(u_[o.name]){let u=a.handler;a.update({callback:this.wrappedCallback(o.name,u)}),this.flipped.add(o.name),console.error(`[${ot().serverName}] door proxy: '${o.name}' now remote-preferred (wrapped; local fallback armed)`);continue}let l=a.handler;a.update({description:o.description,paramsSchema:d_(o.inputSchema),callback:this.doorCallback(o.name,l)}),this.flipped.add(o.name),console.error(`[gigabuddy] door proxy: '${o.name}' now remote-preferred (local fallback armed)`);continue}!a&&!this.registeredDoorOnly.has(o.name)&&(this.server.tool(o.name,o.description??"",d_(o.inputSchema),this.doorCallback(o.name,null)),this.registeredDoorOnly.add(o.name),console.error(`[gigabuddy] door proxy: registered door tool '${o.name}'`))}}wrappedCallback(e,r){return async(i,n)=>{let o=this.door;if(!o)return r(i,n);let s=u_[e],a={client:this.client,state:this.state,callDoor:l=>o.callTool(e,l)},c;try{c=await s.pre(i,a)}catch(l){return{content:[{type:"text",text:`Failed to ${e.replace(/_/g," ")}: ${l instanceof Error?l.message:String(l)}`}],isError:!0}}if("refuse"in c)return c.refuse;try{let l=await o.callTool(e,c.args);return l.isError||!s.post?l:await s.post(l_(l),l,c.meta??{},i,a)}catch(l){return console.error(`[${ot().serverName}] door proxy: '${e}' remote call failed (${l instanceof Error?l.message:l}) \u2014 falling back to local`),r(i,n)}}}doorCallback(e,r){return async(i,n)=>{let o=this.door;if(o)try{return await o.callTool(e,i)}catch(s){console.error(`[gigabuddy] door proxy: '${e}' remote call failed (${s instanceof Error?s.message:s})`+(r?" \u2014 falling back to local":""))}return r?r(i,n):{content:[{type:"text",text:`The '${e}' tool is served by the Gigabuddy door and it could not be reached. Try again shortly.`}],isError:!0}}}};import{readdir as HL,readFile as WL,stat as xP,unlink as y_,writeFile as BL}from"node:fs/promises";import{join as fc}from"node:path";import{execFile as RL}from"node:child_process";import{readdir as EL,readFile as bP}from"node:fs/promises";import{homedir as AL}from"node:os";import{join as lf}from"node:path";var cf=lf(AL(),".claude","sessions");async function pc(t){try{let e=await EL(cf),r=null;for(let i of e)if(i.endsWith(".json"))try{let n=await bP(lf(cf,i),"utf-8"),o=JSON.parse(n);if(o.sessionId!==t||!o.name)continue;let s=o.updatedAt??0;(!r||s>r.updatedAt)&&(r={name:o.name,updatedAt:s})}catch{}return r?.name??null}catch{return null}}function _P(t){return lf(cf,`${t}.json`)}async function p_(t){try{let e=await bP(lf(cf,`${t}.json`),"utf-8"),r=JSON.parse(e);return r.sessionId?{claudePid:t,sessionId:r.sessionId,name:r.name}:null}catch{return null}}function OL(t){return new Promise(e=>{RL("ps",["-o","ppid=","-p",String(t)],{timeout:2e3},(r,i)=>{if(r)return e(null);let n=Number.parseInt(i.trim(),10);e(Number.isFinite(n)&&n>1?n:null)})})}async function Vo(t=8){let e=process.ppid;for(let r=0;r<t&&e&&e>1;r++){let i=await p_(e);if(i)return i;e=await OL(e)}return null}import{existsSync as NL,readFileSync as ML,statSync as jL}from"node:fs";import{access as DL,mkdir as $P,readdir as f_,rm as UL,stat as m_,unlink as wP,writeFile as LL}from"node:fs/promises";import{dirname as ZL,join as Sn,sep as h_}from"node:path";function FL(t){let e=t;for(;;){let r=Sn(e,".git");if(NL(r))try{if(jL(r).isDirectory())return e;let n=/^gitdir:\s*(.+)$/m.exec(ML(r,"utf-8")),o=`${h_}.git${h_}worktrees${h_}`,s=n?.[1]?n[1].indexOf(o):-1;return s===-1?e:n[1].slice(0,s)}catch{return e}let i=ZL(e);if(i===e)return null;e=i}}function qL(t=process.cwd()){let{scratchEnvVar:e,scratchDirName:r}=ot(),i=process.env[e];return i||Sn(FL(t)??t,r)}var uf=null;function Rt(){let t=qp();return(!uf||uf.brand!==t)&&(uf={brand:t,dir:qL()}),uf.dir}function ar(){return Sn(Rt(),"sessions")}function Je(t){return Sn(ar(),t)}async function Zr(t){await g_();let e=Je(t);return await $P(e,{recursive:!0}),e}async function g_(t=Rt()){await $P(t,{recursive:!0});let e=Sn(t,".gitignore");try{await DL(e)}catch{await LL(e,`*
|
|
116
|
+
`)}}var VL=3*24*60*60*1e3;async function kP(t){let e=Date.now(),r=0,i=o=>e-o>VL;await(async o=>{let s;try{s=await f_(o)}catch{return}for(let a of s){if(a===".gitignore"||a==="sessions"||t&&a.includes(t))continue;let c=Sn(o,a);try{let l=await m_(c);if(l.isDirectory())continue;i(l.mtimeMs)&&(await wP(c),r++)}catch{}}})(Rt());try{let o=await f_(ar());for(let s of o){if(t&&s.includes(t))continue;let a=Sn(ar(),s);try{let c=await m_(a);if(!c.isDirectory()){i(c.mtimeMs)&&(await wP(a),r++);continue}let l=await f_(a),u=c.mtimeMs;for(let d of l)try{let p=await m_(Sn(a,d));p.mtimeMs>u&&(u=p.mtimeMs)}catch{}i(u)&&(await UL(a,{recursive:!0,force:!0}),r++)}catch{}}}catch{}return r}var df=class{clientLabel="claude-code";defaultDisplayName="Claude Code Agent";async resolveSession(){let e=await Vo().catch(()=>null);return e?(this.lastPid=e.claudePid,{sessionId:`cc_${e.sessionId}`,hostSessionId:e.sessionId}):null}lastPid=null;async readSessionName(e){return e.hostSessionId?pc(e.hostSessionId):null}statuslineRef(e){return this.lastPid!==null&&e.hostSessionId?{kind:"claude",pid:this.lastPid,sessionId:e.hostSessionId}:{kind:"external",sessionId:e.sessionId}}async consumeConnectTrigger(e){if(!e.hostSessionId)return!1;let r=fc(Je(e.sessionId),"pending-connect.json");try{await xP(r)}catch{return!1}return await y_(r).catch(()=>{}),!0}async markConnected(e){e.hostSessionId&&(await Zr(e.sessionId).catch(()=>{}),await BL(fc(Je(e.sessionId),"active"),e.sessionId).catch(()=>{}),await y_(fc(Je(e.sessionId),"pending-connect.json")).catch(()=>{}))}async fallbackSession(){try{let e=await HL(ar()),r=[];for(let i of e)try{let n=await WL(fc(ar(),i,"pending-connect.json"),"utf-8"),o=JSON.parse(n);o.claudeSessionId&&r.push(o.claudeSessionId)}catch{}if(r.length===1&&r[0])return{sessionId:`cc_${r[0]}`,hostSessionId:r[0]}}catch{}return null}},pf=class{constructor(e,r="external"){this.sessionId=e;this.clientLabel=r}clientLabel;defaultDisplayName="Agent";async resolveSession(){return{sessionId:this.sessionId}}async readSessionName(){return null}statuslineRef(e){return{kind:"external",sessionId:e.sessionId}}async consumeConnectTrigger(e){let r=fc(Je(e.sessionId),"pending-connect.json");try{await xP(r)}catch{return!1}return await y_(r).catch(()=>{}),!0}async markConnected(){}async fallbackSession(){return null}};import{watch as hc}from"node:fs";import{mkdir as VZ,readFile as T_,rename as HZ,stat as KP,unlink as BP,writeFile as WZ}from"node:fs/promises";import{basename as JP,dirname as BZ,isAbsolute as JZ,join as li,resolve as GP}from"node:path";import{open as JL,readFile as IP,readdir as GL,rename as KL,stat as XL,writeFile as YL}from"node:fs/promises";import{homedir as QL}from"node:os";import{join as ff}from"node:path";var SP=ff(QL(),".claude","projects"),eZ=2e5,tZ=1e6,rZ=.85,TP=512*1024;function ai(){return process.env.CLAUDE_CODE_SESSION_ID||void 0}async function mf(t){let e;try{e=await GL(SP)}catch{return null}let r=null;for(let i of e){let n=ff(SP,i,`${t}.jsonl`);try{let o=await XL(n);if(!o.isFile())continue;(!r||o.mtimeMs>r.mtime)&&(r={path:n,mtime:o.mtimeMs})}catch{}}return r?.path??null}async function PP(t,e){let r=await JL(t,"r");try{let{size:i}=await r.stat(),n=Math.max(0,i-e),o=i-n,s=Buffer.alloc(o);return await r.read(s,0,o,n),s.toString("utf-8")}finally{await r.close()}}function nZ(t){let e=t.split(`
|
|
117
|
+
`);for(let r=e.length-1;r>=0;r--){let i=e[r]?.trim();if(!(!i||!i.includes('"usage"')))try{let n=JSON.parse(i),o=n.message?.usage;if(!o)continue;if((o.input_tokens??0)+(o.cache_read_input_tokens??0)+(o.cache_creation_input_tokens??0)>0)return n}catch{}}return null}function v_(t){return ff(Je(t),"window.json")}async function zP(t,e,r){await Zr(t);let i={model:r??null,contextWindow:e,savedAt:new Date().toISOString()},n=v_(t)+".tmp";await YL(n,JSON.stringify(i,null,2)),await KL(n,v_(t))}async function iZ(t){try{let e=await IP(v_(t),"utf-8"),r=JSON.parse(e);return typeof r.contextWindow=="number"&&r.contextWindow>0?r:null}catch{return null}}function oZ(t){return ff(Je(`cc_${t}`),"ctxwin.txt")}async function sZ(t){try{let e=await IP(oZ(t),"utf-8"),[r,i]=e.trim().split(/\s+/);if(r!=="v1")return null;let n=Number.parseInt(i??"",10);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function aZ(){let t=process.env.GIGABUDDY_CONTEXT_WINDOW;if(!t)return null;let e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:null}function cZ(){let t=process.env.GIGABUDDY_COMPACTION_FRACTION;if(t){let e=Number.parseFloat(t);if(Number.isFinite(e)&&e>0&&e<=1)return e}return rZ}function lZ(t,e,r){let i=aZ();return i?{window:i,source:"env"}:r&&r>0&&t<=r?{window:r,source:"harness"}:e&&e>0&&t<=e?{window:e,source:"recorded"}:t>eZ?{window:tZ,source:"observed"}:{window:null,source:"unknown"}}function uZ(t,e,r,i){let n=e.message?.usage??{},o=(n.input_tokens??0)+(n.cache_read_input_tokens??0)+(n.cache_creation_input_tokens??0),{window:s,source:a}=lZ(o,r,i);if(s==null)return{sessionId:t,model:e.message?.model??null,usedTokens:o,windowTokens:null,windowSource:a,pct:null,compactionTokens:null,pctOfCompaction:null,shouldHandoff:!1};let c=Math.round(s*cZ());return{sessionId:t,model:e.message?.model??null,usedTokens:o,windowTokens:s,windowSource:a,pct:Math.min(100,Math.round(o/s*1e3)/10),compactionTokens:c,pctOfCompaction:Math.round(o/c*1e3)/10,shouldHandoff:o>=c}}async function Fr(t){let e=t||ai();if(!e)return null;try{let r=await mf(e);if(!r)return null;let i=await PP(r,TP),n=nZ(i);if(!n)return null;let[o,s]=await Promise.all([iZ(e),sZ(e)]);return uZ(e,n,o?.contextWindow??null,s)}catch{return null}}function dZ(t){let e=t.split(`
|
|
118
|
+
`);for(let r=e.length-1;r>=0;r--){let i=e[r]?.trim();if(!(!i||!i.includes('"cwd"')))try{let n=JSON.parse(i).cwd;if(typeof n=="string"&&n)return n}catch{}}return null}async function CP(t){let e=t||ai();if(!e)return null;try{let r=await mf(e);return r?dZ(await PP(r,TP)):null}catch{return null}}function RP(t){let e=n=>`${Math.round(n/1e3)}k`;if(t.windowTokens==null||t.pct==null)return`Context: ~${e(t.usedTokens)} tokens used (window unknown \u2014 declare it with session_status contextWindow=<200000|1000000> to show %)`;let r=t.windowSource==="observed"?" (1M, inferred from observed usage)":t.windowSource==="env"?" (from GIGABUDDY_CONTEXT_WINDOW)":t.windowSource==="recorded"?" (declared)":"",i=t.shouldHandoff?" \u26A0 at compaction threshold \u2014 hand off":"";return`Context: ${t.pct}% of ${e(t.windowTokens)} window${r} \u2014 ${e(t.usedTokens)} used, compaction ~${e(t.compactionTokens??0)} (${t.pctOfCompaction}% there)${i}`}import{randomUUID as SZ}from"node:crypto";import{watch as IZ}from"node:fs";import{mkdir as TZ,readFile as gf,rename as FP,stat as PZ,unlink as zZ,writeFile as k_}from"node:fs/promises";import{tmpdir as CZ}from"node:os";import{join as Wo}from"node:path";import{execFile as pZ}from"node:child_process";import{readFile as ci,readdir as fZ}from"node:fs/promises";import{homedir as mZ,hostname as hZ}from"node:os";import{join as OP}from"node:path";var EP=OP(mZ(),".claude","sessions"),gZ=1024*1024;function AP(t){return Math.round(t/gZ)}function yZ(t){let e=new Map;for(let r of t.split(`
|
|
119
|
+
`)){let i=/^(\w+):\s+(\d+)\s*kB/.exec(r);i&&e.set(i[1],Number(i[2]))}return e}async function mc(t){try{return(await ci(t,"utf-8")).split(`
|
|
120
|
+
`)[0].trim()}catch{return null}}async function vZ(){let t=await mc("/sys/fs/cgroup/memory.max");if(t!==null){let r=await mc("/sys/fs/cgroup/memory.current"),i=t==="max"?null:Number(t);return{limit:Number.isFinite(i)?i:null,current:r!=null&&Number.isFinite(Number(r))?Number(r):null}}let e=await mc("/sys/fs/cgroup/memory/memory.limit_in_bytes");if(e!==null){let r=await mc("/sys/fs/cgroup/memory/memory.usage_in_bytes"),i=Number(e);return{limit:!Number.isFinite(i)||i>1<<62||i>=Number.MAX_SAFE_INTEGER?null:i,current:r!=null&&Number.isFinite(Number(r))?Number(r):null}}return null}function bZ(t,e,r,i,n=null,o=null){let s=r!=null&&i!=null&&i>0&&r<256,a=t!=null&&t<512,c=e!=null&&e>=95,l=n!=null&&n>=15;if(a||c||l)return"critical";let u=e!=null&&e>=85,d=o!=null&&o>=10,p=s&&t!=null&&t<2048;return u||d||p?"warn":"ok"}var NP=100;function b_(t,e){let r=t.split(`
|
|
121
|
+
`).find(a=>a.startsWith(e));if(!r)return null;let i=a=>{let c=new RegExp(`${a}=([0-9.]+)`).exec(r);return c?Number(c[1]):NaN},n=i("avg10"),o=i("avg60"),s=i("avg300");return[n,o,s].every(Number.isFinite)?{avg10:n,avg60:o,avg300:s}:null}async function _Z(){for(let t of["/sys/fs/cgroup/cpu.pressure","/proc/pressure/cpu"]){let e=await ci(t,"utf-8").catch(()=>null);if(!e)continue;let r=b_(e,"some ");if(r)return r}return null}async function wZ(){for(let t of["/sys/fs/cgroup/memory.pressure","/proc/pressure/memory"]){let e=await ci(t,"utf-8").catch(()=>null);if(!e)continue;let r=b_(e,"some "),i=b_(e,"full ");if(r&&i)return{someAvg60:r.avg60,fullAvg10:i.avg10,fullAvg60:i.avg60}}return null}function $Z(t,e){return t!=null?t>=50?{pressure:"critical",source:"psi"}:t>=20?{pressure:"warn",source:"psi"}:{pressure:"ok",source:"psi"}:e!=null?e>=4?{pressure:"critical",source:"load"}:e>=1.5?{pressure:"warn",source:"load"}:{pressure:"ok",source:"load"}:{pressure:"ok",source:"unknown"}}var MP=NP;async function hf(t){let e=await ci(`/proc/${t}/stat`,"utf-8").catch(()=>null);if(!e)return null;let r=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(r[11]),n=Number(r[12]);return!Number.isFinite(i)||!Number.isFinite(n)?null:i+n}async function jP(t,e=500){let r=new Map;if(process.platform!=="linux"||t.length===0)return r;let i=Date.now(),n=new Map;for(let s of t){let a=await hf(s);a!=null&&n.set(s,a)}await new Promise(s=>setTimeout(s,e));let o=(Date.now()-i)/1e3;for(let s of t){let a=n.get(s),c=await hf(s);if(a==null||c==null)continue;let l=(c-a)/NP/o;r.set(s,Math.max(0,Math.round(l*100)/100))}return r}async function Ho(){if(process.platform!=="linux")return null;let t=await ci("/proc/meminfo","utf-8").catch(()=>null);if(!t)return null;let e=yZ(t),r=e.get("MemTotal")??null,i=e.get("MemAvailable")??null,n=e.get("SwapTotal")??null,o=e.get("SwapFree")??null,s=await vZ(),a=r!=null?Math.round(r/1024):null,c=s?.limit!=null?AP(s.limit):null,l="unknown",u=null;c!=null&&(a==null||c<a)?(u=c,l="cgroup"):a!=null&&(u=a,l="host");let d=null,p=null;l==="cgroup"&&s?.current!=null&&u!=null?(d=AP(s.current),p=Math.max(0,u-d)):a!=null&&i!=null&&(p=Math.round(i/1024),d=Math.max(0,a-p));let f=u&&d!=null?Math.round(d/u*100):null,m=n!=null?Math.round(n/1024):null,h=o!=null?Math.round(o/1024):null,y=m!=null&&h!=null?m-h:null,_=m&&y!=null?Math.round(y/m*100):null,$=await mc("/proc/loadavg"),w=$?$.split(/\s+/).map(Number):[],k=ie=>Number.isFinite(w[ie])?w[ie]:null,S=k(0),J=k(1),F=k(2),P=null;try{let{availableParallelism:ie}=await import("node:os");P=ie()}catch{P=null}let se=S!=null&&P?Math.round(S/P*100)/100:null,ue=F!=null&&P?F/P:null,ae=await _Z(),Me=$Z(ae?.avg60??null,ue),je=await wZ();return{memLimitMb:u,memUsedMb:d,memAvailMb:p,memPct:f,swapTotalMb:m,swapUsedMb:y,swapFreeMb:h,swapPct:_,load1:S,load5:J,load15:F,nproc:P,loadPerCore:se,cpuSomeAvg10:ae?.avg10??null,cpuSomeAvg60:ae?.avg60??null,cpuSomeAvg300:ae?.avg300??null,memPsiSomeAvg60:je?.someAvg60??null,memPsiFullAvg10:je?.fullAvg10??null,memPsiFullAvg60:je?.fullAvg60??null,cpuPressure:Me.pressure,cpuPressureSource:Me.source,limitSource:l,pressure:bZ(p,f,h,_,je?.fullAvg10??null,je?.someAvg60??null)}}function $_(t){return new Promise(e=>{pZ("ps",["-o","rss=","-p",String(t)],{timeout:2e3},(r,i)=>{if(r)return e(null);let n=Number.parseInt(i.trim(),10);e(Number.isFinite(n)?Math.round(n/1024):null)})})}async function DP(){let t;try{t=await fZ(EP)}catch{return[]}let e=[];for(let r of t){if(!r.endsWith(".json"))continue;let i=Number.parseInt(r.replace(/\.json$/,""),10);if(!Number.isFinite(i))continue;let n={};try{n=JSON.parse(await ci(OP(EP,r),"utf-8"))}catch{}let o=await $_(i);e.push({pid:i,sessionId:n.sessionId??null,name:n.name??null,cwd:n.cwd??null,status:n.status??null,rssMb:o,cpuCores:null,dead:o==null})}return e.sort((r,i)=>(i.rssMb??-1)-(r.rssMb??-1)),e}async function kZ(){if(process.env.REMOTE_CONTAINERS||process.env.CODESPACES||process.env.DEVCONTAINER)return!0;try{return await ci("/.dockerenv"),!0}catch{return!1}}async function UP(t){return{machineId:t,hostname:hZ(),container:await kZ()}}var __={ok:"\u{1F7E2}",warn:"\u{1F7E1}",critical:"\u{1F534}"};function In(t){return t==null?"?":`${(t/1024).toFixed(1)}Gi`}function w_(t){return t.swapFreeMb!=null&&t.swapPct!=null&&t.swapPct>0&&t.swapFreeMb<256}function xZ(t){let e=`mem ${t.memPct??"?"}% (${In(t.memAvailMb)} free)`,r=w_(t)?", swap exhausted":"",i=t.memPsiSomeAvg60!=null&&t.memPsiSomeAvg60>=1?`, mem-stall ${t.memPsiSomeAvg60}%`:"",n=t.loadPerCore!=null?`, load ${t.loadPerCore}\xD7/core`:"",o=t.cpuPressure!=="ok"?` \xB7 cpu ${__[t.cpuPressure]}`:"";return`${__[t.pressure]} ${t.pressure.toUpperCase()} \u2014 ${e}${r}${i}${n}${o}`}function LP(t){let e=[`Host: ${xZ(t)}`],r=t.limitSource==="cgroup"?"cgroup cap":t.limitSource==="host"?"host RAM":"unknown";if(e.push(` memory: ${In(t.memUsedMb)} / ${In(t.memLimitMb)} (${r}), ${In(t.memAvailMb)} free`),t.swapTotalMb){let o=w_(t)?t.memAvailMb!=null&&t.memAvailMb<2048?" \u2014 exhausted, no OOM buffer left":" \u2014 exhausted (cold residue; harmless while RAM is free)":"";e.push(` swap: ${In(t.swapUsedMb)} / ${In(t.swapTotalMb)} used (${In(t.swapFreeMb)} free)${o}`)}t.memPsiSomeAvg60!=null&&e.push(` mem-psi: some ${t.memPsiSomeAvg60}%/60s \xB7 full ${t.memPsiFullAvg10??"?"}%/10s \xB7 ${t.memPsiFullAvg60??"?"}%/60s (time stalled on memory; 0 = healthy)`);let i=t.load1!=null?`${t.load1}/${t.load5??"?"}/${t.load15??"?"} (1/5/15m)`:"?",n=t.cpuSomeAvg60!=null?`, PSI stall ${t.cpuSomeAvg60}%/60s \xB7 ${t.cpuSomeAvg300??"?"}%/5m`:"";return e.push(` cpu: ${__[t.cpuPressure]} load ${i} on ${t.nproc??"?"} cores${n}`),t.pressure==="critical"?e.push(" \u26A0 near OOM \u2014 the kernel will kill the largest process. Free memory now (close idle sessions)."):t.pressure==="warn"&&e.push(w_(t)&&t.memPsiSomeAvg60!=null&&t.memPsiSomeAvg60<10&&(t.memPct??0)<85?" \u26A0 swap exhausted with headroom thinning \u2014 the next memory spike OOMs directly. Shed idle sessions.":" \u26A0 memory headroom thin \u2014 shed idle sessions before it tips into critical."),t.cpuPressure==="critical"?e.push(" \u26A0 CPU sustained-contended \u2014 everyone on this box is being slowed. Find the hog below."):t.cpuPressure==="warn"&&e.push(" \u26A0 CPU contention building (sustained, not a spike) \u2014 watch the heaviest session below."),e.join(`
|
|
122
|
+
`)}function ZP(t,e){if(t.length===0)return"No Claude sessions registered on this host.";let r=t.filter(o=>!o.dead),i=r.reduce((o,s)=>o+(s.rssMb??0),0),n=[`${r.length} Claude session(s) on this host, ~${In(i)} total:`];for(let o of t){let s=o.pid===e?" \u2190 you":"";if(o.dead){n.push(` pid ${o.pid} [dead/stale registry entry] ${o.name??o.sessionId??""}`.trimEnd());continue}let a=o.name??o.sessionId?.slice(0,8)??"(unnamed)",c=o.status?` ${o.status}`:"",l=o.cwd?` ${o.cwd.split("/").pop()}`:"",u=o.cpuCores!=null?` ${o.cpuCores>=1?"\u{1F525}":""}${o.cpuCores.toFixed(1)}c`.padStart(8):"";n.push(` ${String(o.rssMb).padStart(5)}MB${u} pid ${o.pid} ${a}${c}${l}${s}`)}return n.join(`
|
|
123
|
+
`)}var RZ=1e4,EZ=45e3,AZ=2e4,OZ=250,x_="host-status.json",S_="lease";function NZ(t){let e=null;if(t.pressure!=="ok"){let n=t.pressure==="critical"?"\u{1F534}":"\u{1F7E1}",o=t.memAvailMb!=null&&t.memAvailMb<512||t.memPct!=null&&t.memPct>=95,s=t.memPct!=null&&t.memPct>=85,a=t.pressure==="critical"?o:s,c=t.pressure==="critical"?t.memPsiFullAvg10:t.memPsiSomeAvg60,l=t.pressure==="critical"?(c??0)>=15:(c??0)>=10;e=a?`${n} mem ${t.memPct??"?"}%`:l?`${n} mem-stall ${Math.round(c??0)}%`:`${n} swap exhausted`}let r=null;if(t.cpuPressure!=="ok"){let n=t.cpuPressure==="critical"?"\u{1F534}":"\u{1F7E1}";t.cpuPressureSource==="psi"&&t.cpuSomeAvg60!=null?r=`${n} cpu ${Math.round(t.cpuSomeAvg60)}%`:t.load15!=null&&t.nproc?r=`${n} cpu ${(t.load15/t.nproc).toFixed(1)}\xD7`:r=`${n} cpu`}let i=t.memPct!=null?`\u{1F7E2} mem ${t.memPct}%`:null;return{memSeg:e,cpuSeg:r,okSeg:i}}async function MZ(){try{let e=(await gf("/proc/sys/kernel/random/boot_id","utf-8")).trim().replace(/[^a-f0-9-]/gi,"").slice(0,8);if(e)return e}catch{}return"local"}async function jZ(){return Wo(CZ(),`${ot().hostDirPrefix}${await MZ()}`)}var yf=class{constructor(e){this.onChange=e}token=`${process.pid}-${SZ().slice(0,8)}`;dir=null;watcher=null;watchDebounce=null;takeoverTimer=null;sampleTimer=null;isLeader=!1;lastWritten=null;stopped=!1;async start(){this.dir=await jZ();try{await TZ(this.dir,{recursive:!0})}catch{return}await this.readAndEmit();try{this.watcher=IZ(this.dir,{persistent:!1},(e,r)=>{r===x_&&(this.watchDebounce&&clearTimeout(this.watchDebounce),this.watchDebounce=setTimeout(()=>{this.watchDebounce=null,this.readAndEmit()},OZ),this.watchDebounce.unref?.())})}catch{}await this.maybeTakeOver(),this.takeoverTimer=setInterval(()=>void this.maybeTakeOver(),AZ),this.takeoverTimer.unref?.()}stop(){this.stopped=!0,this.watcher?.close(),this.watcher=null,this.watchDebounce&&clearTimeout(this.watchDebounce),this.takeoverTimer&&clearInterval(this.takeoverTimer),this.sampleTimer&&clearInterval(this.sampleTimer),this.takeoverTimer=null,this.sampleTimer=null,this.isLeader&&this.dir&&(zZ(Wo(this.dir,S_)).catch(()=>{}),this.isLeader=!1)}async readAndEmit(){if(this.dir)try{let e=await gf(Wo(this.dir,x_),"utf-8"),r=JSON.parse(e);this.onChange({memSeg:r.memSeg??null,cpuSeg:r.cpuSeg??null,okSeg:r.okSeg??null})}catch{this.onChange(null)}}async maybeTakeOver(){if(!this.dir||this.stopped)return;let e=Wo(this.dir,S_);if(this.isLeader){let r=await gf(e,"utf-8").catch(()=>null);r!==null&&r.trim()!==this.token&&this.demote();return}try{let r=await PZ(e);if(Date.now()-r.mtimeMs<EZ)return}catch{}try{let r=`${e}.claim-${this.token}`;await k_(r,this.token),await FP(r,e),(await gf(e,"utf-8")).trim()===this.token&&this.promote()}catch{}}promote(){this.isLeader||this.stopped||(this.isLeader=!0,this.sample(),this.sampleTimer=setInterval(()=>void this.sample(),RZ),this.sampleTimer.unref?.())}demote(){this.isLeader=!1,this.sampleTimer&&clearInterval(this.sampleTimer),this.sampleTimer=null}async sample(){if(!this.dir||!this.isLeader)return;await k_(Wo(this.dir,S_),this.token).catch(()=>{});let e=await Ho(),i={...e?NZ(e):{memSeg:null,cpuSeg:null,okSeg:null},at:Math.floor(Date.now()/1e3)},n=JSON.stringify({memSeg:i.memSeg,cpuSeg:i.cpuSeg,okSeg:i.okSeg});if(n===this.lastWritten)return;this.lastWritten=n;let o=Wo(this.dir,x_),s=`${o}.tmp-${this.token}`;try{await k_(s,JSON.stringify(i)),await FP(s,o)}catch{this.lastWritten=null}}};function HP(){return{displayName:null,signedIn:!0,connected:!1,placeName:null,pendingPlaceName:null,wsDown:!1,peers:[],worktreeId:null,contextTokensK:null,contextWindowK:null,shouldHandoff:!1,host:null,hostMode:"warn",lastTurnEpoch:null,coldSecs:3600,officeHours:[],conflictFile:null,messageCount:0,repo:null,branch:null,activityLabel:null}}var DZ=28,UZ=36,I_=14;function qP(t,e){return t.length>e?t.slice(0,e-1)+"\u2026":t}function VP(t){if(t.length<=I_)return t;let e=t.slice(0,I_-1),r=e.lastIndexOf(" ");return(r>=I_/2?e.slice(0,r):e)+"\u2026"}function LZ(t){if(t.contextTokensK==null)return null;let e=`\u{1F9E0} ${t.contextTokensK}k`;return t.contextWindowK!=null&&t.contextWindowK>0&&(e+=t.contextWindowK>=1e3?`/${Math.round(t.contextWindowK/1e3)}m`:`/${t.contextWindowK}k`,t.shouldHandoff&&(e+=" \u26A0")),e}function ZZ(t){if(t.hostMode==="off"||!t.host)return null;let e=[];return t.host.memSeg?e.push(t.host.memSeg):t.hostMode==="always"&&t.host.okSeg&&e.push(t.host.okSeg),t.host.cpuSeg&&e.push(t.host.cpuSeg),e.length>0?e.join(" \xB7 "):null}function FZ(t,e){let r=t.filter(n=>n.role==="origin"&&n.until!=null&&Date.parse(n.until)/1e3>e).sort((n,o)=>Date.parse(n.until)-Date.parse(o.until));if(r.length>0){let n=r.length>1?` (+${r.length-1})`:"";return{seg:`\u{1F91D} /pickup ${r[0].pageId} \xB7 {{OHMIN}}m left${n}`,untilEpoch:Math.floor(Date.parse(r[0].until)/1e3)}}let i=t.filter(n=>n.role==="picker");if(i.length>0){let n=i.length>1?` (+${i.length-1})`:"";return{seg:`\u{1F91D} working ${i[0].pageId}${n}`,untilEpoch:0}}return{seg:null,untilEpoch:0}}function qZ(t){if(!t.worktreeId)return null;let e=t.peers.filter(i=>i.worktreeId===t.worktreeId).map(i=>i.displayName);return e.length===0?null:`\u26A0 same checkout as ${e.length>2?`${e.slice(0,2).join(", ")} (+${e.length-2} more)`:e.join(", ")}`}function WP(t,e){let r=t.connected?FZ(t.officeHours,e):{seg:null,untilEpoch:0},i;t.connected?i=`\u{1F344} ${t.displayName??"agent"}${t.placeName?` @ ${VP(t.placeName)}`:""}`:t.signedIn?t.pendingPlaceName?i=`\u{1F344} ${t.displayName?`${t.displayName} \xB7 `:""}\u23F8 joins ${VP(t.pendingPlaceName)} on first message`:i=t.displayName?`\u{1F344} ${t.displayName} (offline)`:"\u{1F344} offline":i='\u{1F344} not signed in \u2014 say "log in to gigabuddy"';let n=[i,r.seg,t.connected&&t.wsDown?"\u26A1 disconnected":null,null,LZ(t),ZZ(t)];if(t.connected&&t.peers.length>0){let p=new Set(t.peers.map(f=>f.owner).filter(Boolean)).size;n[3]=`\u{1F916}${t.peers.length}${p>0?` \u{1F9D1}${p}`:""}`}let o=t.connected?[t.conflictFile?`\u26A0 ${t.conflictFile}`:null,t.messageCount>0?`\u{1F4AC} ${t.messageCount}`:null]:[],s=n.filter(p=>p!=null).join(" \xB7 "),a=o.filter(p=>p!=null).join(" \xB7 "),c=s+"{{IDLE}}"+(a?` \xB7 ${a}`:""),l=[t.repo?`\u{1F4C1} ${t.repo}${t.branch?` (${qP(t.branch,DZ)})`:""}`:null];t.connected&&(l.push(qZ(t)),l.push(t.activityLabel?`\u25C6 ${qP(t.activityLabel,UZ)}`:"\u25C7 no activity"));let u=l.filter(p=>p!=null).join(" \xB7 ");return`${`v1 ${e} ${t.lastTurnEpoch??0} ${t.coldSecs} ${r.untilEpoch}`}
|
|
124
|
+
${c}
|
|
125
|
+
${u}
|
|
126
|
+
`}var GZ=300,KZ=3e4,XZ=1e4,YZ=750;function QZ(){let t=process.env.GIGABUDDY_CACHE_COLD_SECS,e=t?Number.parseInt(t,10):NaN;return Number.isFinite(e)&&e>0?e:3600}function e6(){let t=process.env.GIGABUDDY_STATUSLINE_HOST;return t==="always"||t==="off"?t:"warn"}async function t6(t){let e=GP(t);for(;;){let r=li(e,".git");try{if((await KP(r)).isDirectory())return{headPath:li(r,"HEAD"),repo:JP(e)};let o=await T_(r,"utf-8"),s=/^gitdir:\s*(.+)\s*$/m.exec(o);if(s){let a=JZ(s[1])?s[1]:GP(e,s[1]);return{headPath:li(a,"HEAD"),repo:JP(e)}}return null}catch{}let i=BZ(e);if(i===e)return null;e=i}}function r6(t){let e=/^ref:\s*refs\/heads\/(.+)\s*$/.exec(t.trim());return e?e[1]:null}var vf=class{constructor(e,r=Rt()){this.dir=r;this.ref=e,this.model.coldSecs=QZ(),this.model.hostMode=e6()}model=HP();ref;writeTimer=null;aliveTimer=null;ohTimer=null;transcriptWatcher=null;transcriptRetryTimer=null;transcriptDebounce=null;ctxwinWatcher=null;lastTranscriptPath=null;headWatcher=null;headPath=null;registryWatcher=null;hostService=null;stopped=!1;waitStampCleared=!1;get sessionKey(){return this.ref.kind==="claude"?`cc_${this.ref.sessionId}`:this.ref.sessionId}get sessionDirPath(){return li(this.dir,"sessions",this.sessionKey)}get filePath(){return li(this.sessionDirPath,"statusline.txt")}async start(){await VZ(this.sessionDirPath,{recursive:!0});try{let e=await T_(li(this.sessionDirPath,"session.json"),"utf-8"),r=JSON.parse(e);r.displayName&&(this.model.displayName=r.displayName)}catch{}this.watchGit().catch(()=>{}),this.ref.kind==="claude"&&(this.watchTranscript().catch(()=>{}),this.watchRegistry(),this.watchCtxWindow()),this.hostService=new yf(e=>{let r=JSON.stringify(this.model.host);this.model.host=e,JSON.stringify(e)!==r&&this.scheduleWrite()}),this.hostService.start().catch(()=>{}),this.aliveTimer=setInterval(()=>this.writeNow().catch(()=>{}),KZ),this.aliveTimer.unref?.(),this.scheduleWrite()}stop(){this.stopped=!0;for(let e of[this.writeTimer,this.ohTimer,this.transcriptRetryTimer,this.transcriptDebounce])e&&clearTimeout(e);this.aliveTimer&&clearInterval(this.aliveTimer),this.transcriptWatcher?.close(),this.headWatcher?.close(),this.registryWatcher?.close(),this.ctxwinWatcher?.close(),this.hostService?.stop()}onInbox(e){this.model.connected=!0,this.model.pendingPlaceName=null,this.model.placeName=e.placeName??this.model.placeName,this.model.displayName=e.displayName??this.model.displayName,this.model.peers=e.peers,this.model.worktreeId=e.worktreeId,this.model.officeHours=e.officeHours,this.model.activityLabel=e.activityLabel,this.model.conflictFile=e.conflictFile,this.model.messageCount=e.messageCount,this.armOfficeHoursAlarm(),this.scheduleWrite()}setWsConnected(e){this.model.wsDown!==!e&&(this.model.wsDown=!e,this.scheduleWrite())}setSignedIn(e){this.model.signedIn!==e&&(this.model.signedIn=e,this.scheduleWrite())}setPlaceConnected(e){this.model.connected!==e&&(this.model.connected=e,e||(this.model.pendingPlaceName=null),this.scheduleWrite())}setPendingPlace(e){this.model.connected||this.model.pendingPlaceName===e||(this.model.pendingPlaceName=e,this.scheduleWrite())}async watchGit(){let e=await t6(process.cwd());if(e){this.model.repo=e.repo,this.headPath=e.headPath,await this.readBranch();try{this.headWatcher=hc(e.headPath,{persistent:!1},()=>{this.headWatcher?.close(),this.headWatcher=null,this.readBranch().then(()=>{if(!(this.stopped||!this.headPath))try{this.headWatcher=hc(this.headPath,{persistent:!1},()=>void this.readBranch())}catch{}})})}catch{}}}async readBranch(){if(this.headPath)try{let e=r6(await T_(this.headPath,"utf-8"));e!==this.model.branch&&(this.model.branch=e,this.scheduleWrite())}catch{}}watchCtxWindow(){try{this.ctxwinWatcher=hc(this.sessionDirPath,{persistent:!1},(e,r)=>{r==="ctxwin.txt"&&this.lastTranscriptPath&&this.refreshFromTranscript(this.lastTranscriptPath)})}catch{}}async watchTranscript(){if(this.stopped||this.ref.kind!=="claude")return;let e=await mf(this.ref.sessionId);if(!e){this.transcriptRetryTimer=setTimeout(()=>void this.watchTranscript(),XZ),this.transcriptRetryTimer.unref?.();return}this.lastTranscriptPath=e,await this.refreshFromTranscript(e);try{this.transcriptWatcher=hc(e,{persistent:!1},()=>{this.transcriptDebounce&&clearTimeout(this.transcriptDebounce),this.transcriptDebounce=setTimeout(()=>{this.transcriptDebounce=null,this.refreshFromTranscript(e)},YZ),this.transcriptDebounce.unref?.()})}catch{}}async refreshFromTranscript(e){try{let i=await KP(e);this.model.lastTurnEpoch=Math.floor(i.mtimeMs/1e3)}catch{return}if(this.ref.kind!=="claude")return;let r=await Fr(this.ref.sessionId);r&&(this.model.contextTokensK=Math.round((r.usedTokens+500)/1e3),this.model.contextWindowK=r.windowTokens==null?null:Math.round(r.windowTokens/1e3),this.model.shouldHandoff=r.shouldHandoff),this.scheduleWrite()}watchRegistry(){if(this.ref.kind==="claude")try{this.registryWatcher=hc(_P(this.ref.pid),{persistent:!1},()=>{this.onRegistryChange()})}catch{}}async onRegistryChange(){if(this.ref.kind!=="claude")return;let e=await p_(this.ref.pid);if(!e||e.sessionId===this.ref.sessionId)return;let r=this.filePath;this.ref={kind:"claude",pid:this.ref.pid,sessionId:e.sessionId},this.waitStampCleared=!1,BP(r).catch(()=>{}),this.transcriptWatcher?.close(),this.transcriptWatcher=null,this.lastTranscriptPath=null,this.model.lastTurnEpoch=null,this.model.contextTokensK=null,this.model.contextWindowK=null,this.model.shouldHandoff=!1,this.watchTranscript(),this.scheduleWrite()}armOfficeHoursAlarm(){this.ohTimer&&clearTimeout(this.ohTimer),this.ohTimer=null;let e=Date.now(),r=this.model.officeHours.filter(i=>i.role==="origin"&&i.until!=null).map(i=>Date.parse(i.until)).filter(i=>Number.isFinite(i)&&i>e);r.length!==0&&(this.ohTimer=setTimeout(()=>this.scheduleWrite(),Math.min(...r)-e+1e3),this.ohTimer.unref?.())}scheduleWrite(){this.writeTimer||this.stopped||(this.writeTimer=setTimeout(()=>{this.writeTimer=null,this.writeNow().catch(e=>console.error("[gigabuddy-statusline] write failed:",e))},GZ),this.writeTimer.unref?.())}async writeNow(){if(this.stopped)return;let e=WP(this.model,Math.floor(Date.now()/1e3)),r=`${this.filePath}.tmp`;await WZ(r,e),await HZ(r,this.filePath),this.waitStampCleared||(this.waitStampCleared=!0,await BP(li(this.sessionDirPath,"statusline-wait")).catch(()=>{}))}};import{readFile as Ef,writeFile as kc}from"node:fs/promises";import{homedir as p2}from"node:os";import{join as qr}from"node:path";import*as Bo from"node:fs";import*as _f from"node:net";var bf=class{server;socket;handlers=[];buffer="";socketPath="";disposed=!1;started=!1;reconnectTimer;onMessage(e){this.handlers.push(e)}get connected(){return!!this.socket&&!this.socket.destroyed}start(e){this.started||(this.started=!0,this.socketPath=n6(e),this.disposed=!1,this.connectOrListen())}send(e){if(!(!this.socket||this.socket.destroyed))try{this.socket.write(JSON.stringify(e)+`
|
|
127
|
+
`)}catch(r){this.log(`send failed: ${r}`)}}dispose(){if(this.disposed=!0,this.started=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.socket?.destroy(),this.server?.close(),this.server)try{this.socketPath&&Bo.existsSync(this.socketPath)&&Bo.unlinkSync(this.socketPath)}catch{}}connectOrListen(){if(this.disposed)return;let e=_f.createConnection(this.socketPath);e.once("connect",()=>{this.log(`connected as client \u2192 ${this.socketPath}`),this.attachSocket(e,!1)}),e.once("error",r=>{e.destroy(),r.code==="ENOENT"||r.code==="ECONNREFUSED"?this.listen():(this.log(`client error (${r.code}): ${r.message}`),this.scheduleReconnect())})}listen(){if(this.disposed)return;try{Bo.existsSync(this.socketPath)&&Bo.unlinkSync(this.socketPath)}catch{}let e=_f.createServer(r=>{this.log("peer connected (we are server)"),this.attachSocket(r,!0)});e.on("error",r=>{this.log(`server error (${r.code}): ${r.message}`),this.server=void 0,this.scheduleReconnect()}),e.listen(this.socketPath,()=>{this.log(`listening as server on ${this.socketPath}`)}),this.server=e}attachSocket(e,r){this.socket=e,this.buffer="",e.setEncoding("utf8"),e.on("data",i=>this.onData(i)),e.on("error",i=>this.log(`socket error: ${i.message}`)),e.on("close",()=>{this.log("connection closed"),this.socket=void 0,r||this.scheduleReconnect()})}onData(e){this.buffer+=e;let r;for(;(r=this.buffer.indexOf(`
|
|
128
|
+
`))>=0;){let i=this.buffer.slice(0,r).trim();if(this.buffer=this.buffer.slice(r+1),!!i)try{let n=JSON.parse(i);this.log(`recv ${n.type}${n.pageId?` ${n.pageId}`:""}`);for(let o of this.handlers)o(n)}catch{this.log(`ignoring malformed message: ${i.slice(0,120)}`)}}}scheduleReconnect(){this.disposed||this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.connectOrListen()},1500))}log(e){console.error(`[gigabuddy-bridge] ${e}`)}};function n6(t){let e=t.replace(/[^a-zA-Z0-9]/g,"_");return`/tmp/${ot().bridgeSocketPrefix}${e}.sock`}var i6="Sq3Ys1hq5bhtyGqkumZt7",YP="session";async function QP(t,e){try{let n=await t.listPlaceRules(e);if(Array.isArray(n.audiences)){let o=n.audiences.find(a=>String(a.slug)===YP&&String(a.id).startsWith("audience:base_")),s=await t.resolvePlaceRules(e,{audienceIds:o?[String(o.id)]:[],mode:"eligible"});return s.storeReadOk?{rules:o6(s.matched??[]),unreadable:!1}:{rules:[],unreadable:!0}}if(Array.isArray(n.rules))return n.storeReadOk?{rules:XP(n.rules),unreadable:!1}:{rules:[],unreadable:!0}}catch{}let r=[];try{let n;for(let o=0;o<25;o++){let s=await t.listPlaceContent(e,{contextSchemaId:i6,limit:200,before:n});if(r.push(...s.instances??[]),n=s.cursor,!s.hasMore||!n)break}}catch{return{rules:[],unreadable:!0}}let i=r.filter(n=>(n.data??{}).status==="active");return{rules:XP(i.map(n=>n.data??{})),unreadable:!1}}function o6(t){let e=[];for(let r of t){let i=String(r.title??"").trim();i&&e.push({title:i,firmness:String(r.firmness??"rule"),pageRefs:Array.isArray(r.pageRefs)?r.pageRefs.map(String).filter(Boolean):[]})}return e}function XP(t){let e=[];for(let r of t){let i=Array.isArray(r.audience)?r.audience.map(String):[];if(i.length>0&&!i.includes(YP))continue;let n=String(r.title??"").trim();n&&e.push({title:n,firmness:String(r.firmness??"rule"),pageRefs:Array.isArray(r.pageRefs)?r.pageRefs.map(String).filter(Boolean):[]})}return e.sort((r,i)=>(r.firmness==="rule"?0:1)-(i.firmness==="rule"?0:1)),e}function ez(t){if(t.unreadable)return["\u26A0 house rules unreadable this session \u2014 do not assume there are none"];let e=t.rules.filter(i=>i.firmness==="rule"),r=e.slice(0,5).map(i=>i.title);return e.length>5&&r.push(`(+${e.length-5} more \u2014 the connect briefing has all)`),r}import{writeFile as jz,readFile as Dz,rename as Uz}from"node:fs/promises";import{join as W_}from"node:path";import{execFile as g6}from"node:child_process";import{createHash as a6,randomUUID as c6}from"node:crypto";import{readFile as $f,stat as l6,writeFile as u6}from"node:fs/promises";import{hostname as d6}from"node:os";import{join as z_}from"node:path";import{readFile as az}from"node:fs/promises";import{isAbsolute as cz,join as lz,resolve as uz}from"node:path";var s6=["page","activity","work_object"],tz=["idea","issue","decision","task"];var i7=`(?<![A-Za-z0-9_])(${[...s6,...tz].join("|")}):([A-Za-z0-9_-]{8,})`;var o7=new Set(tz);function rz(t,e){let r=t.includes(":")?t.slice(t.indexOf(":")+1):t;return`${e}:${r}`}var wf="ZUoOR73z9HL2FKgbVjKZM",nz="handover",iz="f09hDI0_RdJEroyITyGr6",Jo={issue:"z7ghJbwTsvJlhkF69FEnW",idea:"K8XpLh9bt_Je9sowH254Y",task:"Lsr4bZmnv-Aig_vpiWzzm",decision:"SEbdpkneopdrFXeeNuEQG"};var oz={[wf]:"work_object",[Jo.issue]:"issue",[Jo.idea]:"idea",[Jo.task]:"task",[Jo.decision]:"decision"};function P_(t,e){let r=oz[t??""];if(r)return r;let i=t?e?.get(t):void 0;return i?i.trim().toLowerCase().replace(/\s+/g,"_"):"work_object"}function sz(t,e){return rz(t,P_(e))}async function dz(t){let e=lz(t,".git");try{let r=await az(e,"utf-8"),i=/^gitdir:\s*(.+)$/m.exec(r);if(i){let n=i[1].trim();return cz(n)?n:uz(t,n)}}catch{}return e}async function pz(t){try{let e=(await az(lz(t,"commondir"),"utf-8")).trim();return cz(e)?e:uz(t,e)}catch{return t}}async function mz(t){try{let e=await dz(t);await $f(z_(e,"HEAD"),"utf-8");let r=await pz(e),i=e!==r,n=await m6(e),o=h6(n,await p6(),await f6(e));return{worktree:t,worktreeId:o,isolated:i}}catch{return null}}async function p6(){let t=await $f("/proc/sys/kernel/random/boot_id","utf-8").then(e=>e.trim()).catch(()=>"");return`${d6()}:${t}`}async function f6(t){try{let e=await l6(t);return`${e.dev}:${e.ino}`}catch{return""}}async function m6(t){let e=z_(t,ot().treeIdFileName),r=z_(t,XT().treeIdFileName);for(let n of[e,r])try{let o=(await $f(n,"utf-8")).trim();if(o)return o}catch{}let i=c6();try{return await u6(e,`${i}
|
|
129
|
+
`,{flag:"wx"}),i}catch{return await $f(e,"utf-8").then(o=>o.trim()).catch(()=>"")||i}}function h6(t,e,r=""){return a6("sha256").update(`${t}
|
|
130
|
+
${e}
|
|
131
|
+
${r}`).digest("hex").slice(0,24)}function hz(t,e){let r=[];for(let{agent:i,dims:n}of e){let o=!!t.worktreeId&&!!n.worktreeId&&t.worktreeId===n.worktreeId,s=!!t.branch&&!!n.branch&&t.branch===n.branch;if(!o&&!s)continue;let a=!!t.activityId&&!!n.activityId&&t.activityId===n.activityId,c;o?c=a?"tree-shared":"tree-collision":c=a?"collaborating":"branch-overlap",r.push({agent:i,level:c,branch:n.branch??null,worktree:n.worktree??null,activityId:n.activityId??null,sharedTree:o,sharedActivity:a})}return r}var fz={"tree-collision":0,"tree-shared":1,"branch-overlap":2,collaborating:3};function gz(t){if(t.length===0)return[];let e=[...t].sort((i,n)=>fz[i.level]-fz[n.level]),r=[];for(let i of e){let n=i.worktree?` (${i.worktree})`:"";switch(i.level){case"tree-collision":r.push(`\u26D4 ${i.agent} is in the SAME working tree${n} as you, with no shared activity \u2014 two HEADs in one checkout will thrash on branch switch. Coordinate, or move to an isolated worktree.`);break;case"tree-shared":r.push(`\u26A0 ${i.agent} shares your working tree${n} (same activity) \u2014 even collaborating, a branch switch yanks the floor out from under one of you. Prefer separate worktrees.`);break;case"branch-overlap":r.push(`\u26A0 ${i.agent} is also on ${i.branch??"your branch"} (separate checkout, no shared activity) \u2014 coordinate so you don't clobber each other?`);break;case"collaborating":r.push(`\u{1F91D} ${i.agent} is on ${i.branch??"your branch"} working the same activity \u2014 they're live, reach them on it${i.activityId?`: send_message(activityId: "${i.activityId}", \u2026)`:""}.`);break}}return r}function C_(t,e){return new Promise(r=>{g6("git",["-C",t,...e],{timeout:2e3},(i,n)=>{r(i?null:n.trim()||null)})})}async function kf(t){let[e,r,i,n]=await Promise.all([C_(t,["config","user.name"]),C_(t,["rev-parse","--show-toplevel"]).then(o=>o?o.split("/").pop()??null:null),C_(t,["rev-parse","--abbrev-ref","HEAD"]),mz(t).catch(()=>null)]);return{owner:e,repo:r,branch:i,worktree:n?.worktree??null,worktreeId:n?.worktreeId??null,isolated:n?.isolated??null}}function yz(t,e){return t?t.repo!==e.repo||t.branch!==e.branch||t.worktree!==e.worktree||t.worktreeId!==e.worktreeId:!0}function O_(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var di=O_();function xz(t){di=t}var bc={exec:()=>null};function ve(t,e=""){let r=typeof t=="string"?t:t.source,i={replace:(n,o)=>{let s=typeof o=="string"?o:o.source;return s=s.replace(wt.caret,"$1"),r=r.replace(n,s),i},getRegex:()=>new RegExp(r,e)};return i}var y6=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),wt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},v6=/^(?:[ \t]*(?:\n|$))+/,b6=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_6=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_c=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,w6=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,N_=/(?:[*+-]|\d{1,9}[.)])/,Sz=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Iz=ve(Sz).replace(/bull/g,N_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),$6=ve(Sz).replace(/bull/g,N_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),M_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,k6=/^[^\n]+/,j_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,x6=ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",j_).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),S6=ve(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,N_).getRegex(),Pf="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",D_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,I6=ve("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",D_).replace("tag",Pf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Tz=ve(M_).replace("hr",_c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pf).getRegex(),T6=ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Tz).getRegex(),U_={blockquote:T6,code:b6,def:x6,fences:_6,heading:w6,hr:_c,html:I6,lheading:Iz,list:S6,newline:v6,paragraph:Tz,table:bc,text:k6},vz=ve("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pf).getRegex(),P6={...U_,lheading:$6,table:vz,paragraph:ve(M_).replace("hr",_c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vz).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pf).getRegex()},z6={...U_,html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",D_).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ve(M_).replace("hr",_c).replace("heading",` *#{1,6} *[^
|
|
132
|
+
]`).replace("lheading",Iz).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},C6=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,R6=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pz=/^( {2,}|\\)\n(?!\s*$)/,E6=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zf=/[\p{P}\p{S}]/u,L_=/[\s\p{P}\p{S}]/u,zz=/[^\s\p{P}\p{S}]/u,A6=ve(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,L_).getRegex(),Cz=/(?!~)[\p{P}\p{S}]/u,O6=/(?!~)[\s\p{P}\p{S}]/u,N6=/(?:[^\s\p{P}\p{S}]|~)/u,M6=ve(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",y6?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Rz=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,j6=ve(Rz,"u").replace(/punct/g,zf).getRegex(),D6=ve(Rz,"u").replace(/punct/g,Cz).getRegex(),Ez="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",U6=ve(Ez,"gu").replace(/notPunctSpace/g,zz).replace(/punctSpace/g,L_).replace(/punct/g,zf).getRegex(),L6=ve(Ez,"gu").replace(/notPunctSpace/g,N6).replace(/punctSpace/g,O6).replace(/punct/g,Cz).getRegex(),Z6=ve("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zz).replace(/punctSpace/g,L_).replace(/punct/g,zf).getRegex(),F6=ve(/\\(punct)/,"gu").replace(/punct/g,zf).getRegex(),q6=ve(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),V6=ve(D_).replace("(?:-->|$)","-->").getRegex(),H6=ve("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",V6).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Sf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,W6=ve(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Sf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Az=ve(/^!?\[(label)\]\[(ref)\]/).replace("label",Sf).replace("ref",j_).getRegex(),Oz=ve(/^!?\[(ref)\](?:\[\])?/).replace("ref",j_).getRegex(),B6=ve("reflink|nolink(?!\\()","g").replace("reflink",Az).replace("nolink",Oz).getRegex(),bz=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Z_={_backpedal:bc,anyPunctuation:F6,autolink:q6,blockSkip:M6,br:Pz,code:R6,del:bc,emStrongLDelim:j6,emStrongRDelimAst:U6,emStrongRDelimUnd:Z6,escape:C6,link:W6,nolink:Oz,punctuation:A6,reflink:Az,reflinkSearch:B6,tag:H6,text:E6,url:bc},J6={...Z_,link:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",Sf).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sf).getRegex()},R_={...Z_,emStrongRDelimAst:L6,emStrongLDelim:D6,url:ve(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",bz).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ve(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",bz).getRegex()},G6={...R_,br:ve(Pz).replace("{2,}","*").getRegex(),text:ve(R_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xf={normal:U_,gfm:P6,pedantic:z6},gc={normal:Z_,gfm:R_,breaks:G6,pedantic:J6},K6={"&":"&","<":"<",">":">",'"':""","'":"'"},_z=t=>K6[t];function $r(t,e){if(e){if(wt.escapeTest.test(t))return t.replace(wt.escapeReplace,_z)}else if(wt.escapeTestNoEncode.test(t))return t.replace(wt.escapeReplaceNoEncode,_z);return t}function wz(t){try{t=encodeURI(t).replace(wt.percentDecode,"%")}catch{return null}return t}function $z(t,e){let r=t.replace(wt.findPipe,(o,s,a)=>{let c=!1,l=s;for(;--l>=0&&a[l]==="\\";)c=!c;return c?"|":" |"}),i=r.split(wt.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(wt.slashPipe,"|");return i}function yc(t,e,r){let i=t.length;if(i===0)return"";let n=0;for(;n<i;){let o=t.charAt(i-n-1);if(o===e&&!r)n++;else if(o!==e&&r)n++;else break}return t.slice(0,i-n)}function X6(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])r++;else if(t[i]===e[1]&&(r--,r<0))return i;return r>0?-2:-1}function kz(t,e,r,i,n){let o=e.href,s=e.title||null,a=t[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let c={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:o,title:s,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,c}function Y6(t,e,r){let i=t.match(r.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
|
|
133
|
+
`).map(o=>{let s=o.match(r.other.beginningSpace);if(s===null)return o;let[a]=s;return a.length>=n.length?o.slice(n.length):o}).join(`
|
|
134
|
+
`)}var If=class{options;rules;lexer;constructor(t){this.options=t||di}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:yc(r,`
|
|
135
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],i=Y6(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let i=yc(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:yc(e[0],`
|
|
136
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=yc(e[0],`
|
|
137
|
+
`).split(`
|
|
138
|
+
`),i="",n="",o=[];for(;r.length>0;){let s=!1,a=[],c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))a.push(r[c]),s=!0;else if(!s)a.push(r[c]);else break;r=r.slice(c);let l=a.join(`
|
|
139
|
+
`),u=l.replace(this.rules.other.blockquoteSetextReplace,`
|
|
140
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
141
|
+
${l}`:l,n=n?`${n}
|
|
142
|
+
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=d,r.length===0)break;let p=o.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let f=p,m=f.raw+`
|
|
143
|
+
`+r.join(`
|
|
144
|
+
`),h=this.blockquote(m);o[o.length-1]=h,i=i.substring(0,i.length-f.raw.length)+h.raw,n=n.substring(0,n.length-f.text.length)+h.text;break}else if(p?.type==="list"){let f=p,m=f.raw+`
|
|
145
|
+
`+r.join(`
|
|
146
|
+
`),h=this.list(m);o[o.length-1]=h,i=i.substring(0,i.length-p.raw.length)+h.raw,n=n.substring(0,n.length-f.raw.length)+h.raw,r=m.substring(o.at(-1).raw.length).split(`
|
|
147
|
+
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),i=r.length>1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");let o=this.rules.other.listItemRegex(r),s=!1;for(;t;){let c=!1,l="",u="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let d=e[2].split(`
|
|
148
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,_=>" ".repeat(3*_.length)),p=t.split(`
|
|
149
|
+
`,1)[0],f=!d.trim(),m=0;if(this.options.pedantic?(m=2,u=d.trimStart()):f?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=d.slice(m),m+=e[1].length),f&&this.rules.other.blankLine.test(p)&&(l+=p+`
|
|
150
|
+
`,t=t.substring(p.length+1),c=!0),!c){let _=this.rules.other.nextBulletRegex(m),$=this.rules.other.hrRegex(m),w=this.rules.other.fencesBeginRegex(m),k=this.rules.other.headingBeginRegex(m),S=this.rules.other.htmlBeginRegex(m);for(;t;){let J=t.split(`
|
|
151
|
+
`,1)[0],F;if(p=J,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),F=p):F=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||k.test(p)||S.test(p)||_.test(p)||$.test(p))break;if(F.search(this.rules.other.nonSpaceChar)>=m||!p.trim())u+=`
|
|
152
|
+
`+F.slice(m);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(d)||k.test(d)||$.test(d))break;u+=`
|
|
153
|
+
`+p}!f&&!p.trim()&&(f=!0),l+=J+`
|
|
154
|
+
`,t=t.substring(J.length+1),d=F.slice(m)}}n.loose||(s?n.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(s=!0));let h=null,y;this.options.gfm&&(h=this.rules.other.listIsTask.exec(u),h&&(y=h[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:l,task:!!h,checked:y,loose:!1,text:u,tokens:[]}),n.raw+=l}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c=0;c<n.items.length;c++)if(this.lexer.state.top=!1,n.items[c].tokens=this.lexer.blockTokens(n.items[c].text,[]),!n.loose){let l=n.items[c].tokens.filter(d=>d.type==="space"),u=l.length>0&&l.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=u}if(n.loose)for(let c=0;c<n.items.length;c++)n.items[c].loose=!0;return n}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:i,title:n}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=$z(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
155
|
+
`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let s of i)this.rules.other.tableAlignRight.test(s)?o.align.push("right"):this.rules.other.tableAlignCenter.test(s)?o.align.push("center"):this.rules.other.tableAlignLeft.test(s)?o.align.push("left"):o.align.push(null);for(let s=0;s<r.length;s++)o.header.push({text:r[s],tokens:this.lexer.inline(r[s]),header:!0,align:o.align[s]});for(let s of n)o.rows.push($z(s,o.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[c]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
|
|
156
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=yc(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=X6(e[2],"()");if(o===-2)return;if(o>-1){let s=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,s).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],n=o[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),kz(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return kz(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!(!i||i[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,o,s,a=n,c=0,l=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+n);(i=l.exec(e))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(s=[...o].length,i[3]||i[4]){a+=s;continue}else if((i[5]||i[6])&&n%3&&!((n+s)%3)){c+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a+c);let u=[...i[0]][0].length,d=t.slice(0,n+i.index+u+s);if(Math.min(n,s)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,i;return e[2]==="@"?(r=e[1],i="mailto:"+r):(r=e[1],i=r),{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Bt=class E_{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||di,this.options.tokenizer=this.options.tokenizer||new If,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:wt,block:xf.normal,inline:gc.normal};this.options.pedantic?(r.block=xf.pedantic,r.inline=gc.pedantic):this.options.gfm&&(r.block=xf.gfm,this.options.breaks?r.inline=gc.breaks:r.inline=gc.gfm),this.tokenizer.rules=r}static get rules(){return{block:xf,inline:gc}}static lex(e,r){return new E_(r).lex(e)}static lexInline(e,r){return new E_(r).inlineTokens(e)}lex(e){e=e.replace(wt.carriageReturn,`
|
|
157
|
+
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let i=this.inlineQueue[r];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],i=!1){for(this.options.pedantic&&(e=e.replace(wt.tabCharGlobal," ").replace(wt.spaceLine,""));e;){let n;if(this.options.extensions?.block?.some(s=>(n=s.call({lexer:this},e,r))?(e=e.substring(n.raw.length),r.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let s=r.at(-1);n.raw.length===1&&s!==void 0?s.raw+=`
|
|
158
|
+
`:r.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
159
|
+
`)?"":`
|
|
160
|
+
`)+n.raw,s.text+=`
|
|
161
|
+
`+n.text,this.inlineQueue.at(-1).src=s.text):r.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
162
|
+
`)?"":`
|
|
163
|
+
`)+n.raw,s.text+=`
|
|
164
|
+
`+n.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},r.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),r.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let s=1/0,a=e.slice(1),c;this.options.extensions.startBlock.forEach(l=>{c=l.call({lexer:this},a),typeof c=="number"&&c>=0&&(s=Math.min(s,c))}),s<1/0&&s>=0&&(o=e.substring(0,s+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let s=r.at(-1);i&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
|
|
165
|
+
`)?"":`
|
|
166
|
+
`)+n.raw,s.text+=`
|
|
167
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(n),i=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
168
|
+
`)?"":`
|
|
169
|
+
`)+n.raw,s.text+=`
|
|
170
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(n);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let i=e,n=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)c.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=n[2]?n[2].length:0,i=i.slice(0,n.index+o)+"["+"a".repeat(n[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let s=!1,a="";for(;e;){s||(a=""),s=!1;let c;if(this.options.extensions?.inline?.some(u=>(c=u.call({lexer:this},e,r))?(e=e.substring(c.raw.length),r.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let u=r.at(-1);c.type==="text"&&u?.type==="text"?(u.raw+=c.raw,u.text+=c.text):r.push(c);continue}if(c=this.tokenizer.emStrong(e,i,a)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),r.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),r.push(c);continue}let l=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(c=this.tokenizer.inlineText(l)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(a=c.raw.slice(-1)),s=!0;let u=r.at(-1);u?.type==="text"?(u.raw+=c.raw,u.text+=c.text):r.push(c);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return r}},Tf=class{options;parser;constructor(t){this.options=t||di}space(t){return""}code({text:t,lang:e,escaped:r}){let i=(e||"").match(wt.notSpaceStart)?.[0],n=t.replace(wt.endingNewline,"")+`
|
|
171
|
+
`;return i?'<pre><code class="language-'+$r(i)+'">'+(r?n:$r(n,!0))+`</code></pre>
|
|
172
|
+
`:"<pre><code>"+(r?n:$r(n,!0))+`</code></pre>
|
|
173
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
174
|
+
${this.parser.parse(t)}</blockquote>
|
|
175
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
176
|
+
`}hr(t){return`<hr>
|
|
177
|
+
`}list(t){let e=t.ordered,r=t.start,i="";for(let s=0;s<t.items.length;s++){let a=t.items[s];i+=this.listitem(a)}let n=e?"ol":"ul",o=e&&r!==1?' start="'+r+'"':"";return"<"+n+o+`>
|
|
178
|
+
`+i+"</"+n+`>
|
|
179
|
+
`}listitem(t){let e="";if(t.task){let r=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+$r(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
180
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
181
|
+
`}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let i="";for(let n=0;n<t.rows.length;n++){let o=t.rows[n];r="";for(let s=0;s<o.length;s++)r+=this.tablecell(o[s]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
182
|
+
<thead>
|
|
183
|
+
`+e+`</thead>
|
|
184
|
+
`+i+`</table>
|
|
185
|
+
`}tablerow({text:t}){return`<tr>
|
|
186
|
+
${t}</tr>
|
|
187
|
+
`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
188
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${$r(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let i=this.parser.parseInline(r),n=wz(t);if(n===null)return i;t=n;let o='<a href="'+t+'"';return e&&(o+=' title="'+$r(e)+'"'),o+=">"+i+"</a>",o}image({href:t,title:e,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));let n=wz(t);if(n===null)return $r(r);t=n;let o=`<img src="${t}" alt="${r}"`;return e&&(o+=` title="${$r(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:$r(t.text)}},F_=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},cr=class A_{options;renderer;textRenderer;constructor(e){this.options=e||di,this.options.renderer=this.options.renderer||new Tf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new F_}static parse(e,r){return new A_(r).parse(e)}static parseInline(e,r){return new A_(r).parseInline(e)}parse(e,r=!0){let i="";for(let n=0;n<e.length;n++){let o=e[n];if(this.options.extensions?.renderers?.[o.type]){let a=o,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){i+=c||"";continue}}let s=o;switch(s.type){case"space":{i+=this.renderer.space(s);continue}case"hr":{i+=this.renderer.hr(s);continue}case"heading":{i+=this.renderer.heading(s);continue}case"code":{i+=this.renderer.code(s);continue}case"table":{i+=this.renderer.table(s);continue}case"blockquote":{i+=this.renderer.blockquote(s);continue}case"list":{i+=this.renderer.list(s);continue}case"html":{i+=this.renderer.html(s);continue}case"def":{i+=this.renderer.def(s);continue}case"paragraph":{i+=this.renderer.paragraph(s);continue}case"text":{let a=s,c=this.renderer.text(a);for(;n+1<e.length&&e[n+1].type==="text";)a=e[++n],c+=`
|
|
189
|
+
`+this.renderer.text(a);r?i+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):i+=c;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,r=this.renderer){let i="";for(let n=0;n<e.length;n++){let o=e[n];if(this.options.extensions?.renderers?.[o.type]){let a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=a||"";continue}}let s=o;switch(s.type){case"escape":{i+=r.text(s);break}case"html":{i+=r.html(s);break}case"link":{i+=r.link(s);break}case"image":{i+=r.image(s);break}case"strong":{i+=r.strong(s);break}case"em":{i+=r.em(s);break}case"codespan":{i+=r.codespan(s);break}case"br":{i+=r.br(s);break}case"del":{i+=r.del(s);break}case"text":{i+=r.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}},vc=class{options;block;constructor(t){this.options=t||di}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?cr.parse:cr.parseInline}},Q6=class{defaults=O_();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=cr;Renderer=Tf;TextRenderer=F_;Lexer=Bt;Tokenizer=If;Hooks=vc;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{let n=i;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,e));for(let o of n.rows)for(let s of o)r=r.concat(this.walkTokens(s.tokens,e));break}case"list":{let n=i;r=r.concat(this.walkTokens(n.items,e));break}default:{let n=i;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let s=n[o].flat(1/0);r=r.concat(this.walkTokens(s,e))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=e.renderers[n.name];o?e.renderers[n.name]=function(...s){let a=n.renderer.apply(this,s);return a===!1&&(a=o.apply(this,s)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[n.level];o?o.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),r.renderer){let n=this.defaults.renderer||new Tf(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let s=o,a=r.renderer[s],c=n[s];n[s]=(...l)=>{let u=a.apply(n,l);return u===!1&&(u=c.apply(n,l)),u||""}}i.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new If(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let s=o,a=r.tokenizer[s],c=n[s];n[s]=(...l)=>{let u=a.apply(n,l);return u===!1&&(u=c.apply(n,l)),u}}i.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new vc;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let s=o,a=r.hooks[s],c=n[s];vc.passThroughHooks.has(o)?n[s]=l=>{if(this.defaults.async&&vc.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await a.call(n,l);return c.call(n,d)})();let u=a.call(n,l);return c.call(n,u)}:n[s]=(...l)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(n,l);return d===!1&&(d=await c.apply(n,l)),d})();let u=a.apply(n,l);return u===!1&&(u=c.apply(n,l)),u}}i.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;i.walkTokens=function(s){let a=[];return a.push(o.call(this,s)),n&&(a=a.concat(n.call(this,s))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Bt.lex(t,e??this.defaults)}parser(t,e){return cr.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let i={...r},n={...this.defaults,...i},o=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let s=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer():t?Bt.lex:Bt.lexInline)(s,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let l=await(n.hooks?await n.hooks.provideParser():t?cr.parse:cr.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(l):l})().catch(o);try{n.hooks&&(e=n.hooks.preprocess(e));let s=(n.hooks?n.hooks.provideLexer():t?Bt.lex:Bt.lexInline)(e,n);n.hooks&&(s=n.hooks.processAllTokens(s)),n.walkTokens&&this.walkTokens(s,n.walkTokens);let a=(n.hooks?n.hooks.provideParser():t?cr.parse:cr.parseInline)(s,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(s){return o(s)}}}onError(t,e){return r=>{if(r.message+=`
|
|
190
|
+
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+$r(r.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(r);throw r}}},ui=new Q6;function ze(t,e){return ui.parse(t,e)}ze.options=ze.setOptions=function(t){return ui.setOptions(t),ze.defaults=ui.defaults,xz(ze.defaults),ze};ze.getDefaults=O_;ze.defaults=di;ze.use=function(...t){return ui.use(...t),ze.defaults=ui.defaults,xz(ze.defaults),ze};ze.walkTokens=function(t,e){return ui.walkTokens(t,e)};ze.parseInline=ui.parseInline;ze.Parser=cr;ze.parser=cr.parse;ze.Renderer=Tf;ze.TextRenderer=F_;ze.Lexer=Bt;ze.lexer=Bt.lex;ze.Tokenizer=If;ze.Hooks=vc;ze.parse=ze;var S7=ze.options,I7=ze.setOptions,T7=ze.use,P7=ze.walkTokens,z7=ze.parseInline;var C7=cr.parse,R7=Bt.lex;function kr(t,e){return t?typeof t=="string"?t:Array.isArray(t)?t.map(r=>{if(r.type==="mention")return`@${r.props?.displayName??"unknown"}`;if(r.type==="contentChip"){let o=r.props?.instanceId??"",s=e?.get(o)||r.props?.contextType||o;return s?`[${s}]`:""}if(r.type==="link"){let o=kr(r.content??[],e),s=r.href??"";return o===s?s:`[${o}](${s})`}let i=r.text??"";if(!i)return"";let n=r.styles??{};return n.code&&(i=`\`${i}\``),n.bold&&(i=`**${i}**`),n.italic&&(i=`*${i}*`),(n.strike||n.strikethrough)&&(i=`~~${i}~~`),i}).join(""):"":""}function Mz(t,e,r){let{type:i,props:n,content:o,children:s}=t,{cardMap:a,refs:c}=r,l=s?.length?s.map(u=>Mz(u,e+" ",r)).join(""):"";switch(i){case"paragraph":{let u=kr(o,c);return!u&&!l?`
|
|
191
|
+
`:`${e}${u}
|
|
192
|
+
|
|
193
|
+
${l}`}case"heading":{let u=Math.min(n?.level??2,6),d=kr(o,c);return`${e}${"#".repeat(u)} ${d}
|
|
194
|
+
|
|
195
|
+
${l}`}case"bulletListItem":{let u=kr(o,c);return`${e}- ${u}
|
|
196
|
+
${l}`}case"numberedListItem":{let u=kr(o,c);return`${e}1. ${u}
|
|
197
|
+
${l}`}case"checkListItem":{let u=n?.checked?"x":" ",d=kr(o,c);return`${e}- [${u}] ${d}
|
|
198
|
+
${l}`}case"codeBlock":{let u=n?.language??"",d=kr(o,c);return`${e}\`\`\`${u}
|
|
199
|
+
${d}
|
|
200
|
+
\`\`\`
|
|
201
|
+
|
|
202
|
+
`}case"quote":return`${(kr(o,c)||"").split(`
|
|
203
|
+
`).map(p=>`${e}> ${p}`).join(`
|
|
204
|
+
`)}
|
|
205
|
+
|
|
206
|
+
${l}`;case"table":{let u=o;if(!u||!Array.isArray(u.rows)||u.rows.length===0)return l;let d=_=>kr(Array.isArray(_)?_:_?.content??[],c).replace(/\|/g,"\\|").trim(),p=_=>`| ${_.map(d).join(" | ")} |`,f=u.headerRows??1,m=u.rows[0].cells.length,h=`| ${Array.from({length:m},()=>"---").join(" | ")} |`,y=[...u.rows.slice(0,f).map(_=>p(_.cells)),h,...u.rows.slice(f).map(_=>p(_.cells))];return`${e}${y.join(`
|
|
207
|
+
`)}
|
|
208
|
+
|
|
209
|
+
${l}`}case"image":{let u=n?.url??"";if(!u)return l;let d=r.resolveUrl(u),p=(n?.caption||n?.name||"").replace(/[[\]]/g,"");return d?`${e}
|
|
210
|
+
|
|
211
|
+
${l}`:p?`${e}${p}
|
|
212
|
+
|
|
213
|
+
${l}`:l}case"video":case"audio":case"file":{let u=n?.url??"";if(!u)return l;let d=r.resolveUrl(u),p=n?.caption||n?.name||i;return d?`${e}[${p}](${d})
|
|
214
|
+
|
|
215
|
+
${l}`:`${e}${p}
|
|
216
|
+
|
|
217
|
+
${l}`}case"contentCard":{let u=n?.instanceId??"",d=n?.contextType??"",p=n?.form??"result",f=a?.get(u);return f?`> **[${d}]** ${u}
|
|
218
|
+
>
|
|
219
|
+
${f.split(`
|
|
220
|
+
`).map(m=>`> ${m}`).join(`
|
|
221
|
+
`)}
|
|
222
|
+
|
|
223
|
+
`:`<!-- contentCard instanceId="${u}" contextType="${d}" form="${p}" -->
|
|
224
|
+
|
|
225
|
+
`}default:{let u=kr(o,c);return u?`${e}${u}
|
|
226
|
+
|
|
227
|
+
${l}`:l}}}function Nz(t){return t instanceof Map?t:t?new Map(Object.entries(t)):null}function q_(t,e){if(!t||!Array.isArray(t))return"";let r={cardMap:Nz(e?.resolvedCards),refs:Nz(e?.resolvedRefs),resolveUrl:e?.resolveUrl??(i=>i)};return t.map(i=>Mz(i,"",r)).join("").replace(/\n{3,}/g,`
|
|
228
|
+
|
|
229
|
+
`).trim()}function e2(t){return!t.content||typeof t.content=="string"||!Array.isArray(t.content)?"":t.content.map(e=>e.text??"").join("")}function V_(t){if(!t||!Array.isArray(t))return[];let e=[];for(let r=0;r<t.length;r++){let i=t[r];if(!i||i.type!=="heading")continue;let n=i.props?.level??2,o=e2(i);e.push({heading:o,level:n,startIndex:r,endIndex:t.length})}for(let r=0;r<e.length;r++){let i=e[r];for(let n=r+1;n<e.length;n++)if(e[n].level<=i.level){i.endIndex=e[n].startIndex;break}}return e}function H_(t,e){let r=V_(t),i=V_(e),n=new Map;for(let l of r){let u=t.slice(l.startIndex,l.endIndex);n.set(l.heading,q_(u))}let o=new Map;for(let l of i){let u=e.slice(l.startIndex,l.endIndex);o.set(l.heading,q_(u))}let s=[],a=[],c=[];for(let[l,u]of o){let d=n.get(l);d===void 0?s.push(l):d!==u&&c.push(l)}for(let l of n.keys())o.has(l)||a.push(l);return{added:s,removed:a,changed:c}}var B_=50,t2=300,r2=25e3,n2=5*6e4,i2=500,o2=4e3,Cf=class{constructor(e,r,i){this.state=e;this.sessionId=r;this.pageChecker=i?.pageChecker??null,this.workspaceSyncer=i?.workspaceSyncer??null,this.profileSyncer=i?.profileSyncer??null,this.messageFetcher=i?.messageFetcher??null,this.changedFetcher=i?.changedFetcher??null}seq=0;events=[];previousPeers=new Map;debounceTimer=null;unsubscribe=null;outboxAbort=null;heartbeatTimer=null;mentionWatchTimer=null;placeEventUnsub=null;connectionUnsub=null;contentDebounceTimers=new Map;hasConnected=!1;lastOutboxFile=null;pageChecker=null;messageFetcher=null;changedFetcher=null;lastContentSyncTs=null;workspaceSyncer=null;lastWorkspaceSyncTs=0;profileSyncer=null;lastProfileSyncTs=0;lastMentionCursor=null;lastPersistedCursor=null;seenMessageIds=new Set;persistTimer=null;lastContextPct=null;lastContextTokens=null;lastContextWindowK=null;lastShouldHandoff=!1;lastRssMb=null;lastHostPressure=null;lastCpuCores=null;lastCpuPressure=null;lastCpuTicks=null;lastCpuSampleAt=null;lastLocation=null;lastLocationCwd=null;selfPid=null;selfPidResolved=!1;get inboxPath(){return W_(Je(this.sessionId),"inbox.json")}get sessionStatePath(){return W_(Je(this.sessionId),"cursor.json")}async start(){await Zr(this.sessionId);let e=this.state.awarenessManager,r=this.state.placeId;!e||!r||(await this.loadSessionState(),this.state.currentActivity&&e.updateTopicState(r,{activityId:this.state.currentActivity.activityId}),this.snapshotPeers(e,r),await this.writeInbox(),sr(this.state),this.unsubscribe=e.onTopicUpdate(r,()=>{this.onPeerUpdate(e,r)}),this.watchOutbox(e,r),this.heartbeatTimer=setInterval(async()=>{if(!e.connected){if(await e.ensureConnected())try{await e.subscribe(r),e.updateTopicState(r,{displayName:this.state.agentMeta?.displayName,status:"active"}),console.error("[gigabuddy-inbox] Heartbeat restored dead connection")}catch{}return}await this.refreshSessionName(e,r),await this.refreshContext(e,r),await this.refreshResources(e,r),await this.refreshLocation(e,r),sr(this.state)},r2),this.placeEventUnsub=e.onPlaceEvent(i=>{this.onContentChanged(r,i).catch(n=>console.error("[gigabuddy-inbox] content_changed handler error:",n)),this.onActivityChanged(i),this.onMessageCreated(i),this.onAskCreated(i)}),this.lastContentSyncTs=new Date().toISOString(),this.connectionUnsub=e.onConnectionChange(i=>{if(!i)return;if(!this.hasConnected){this.hasConnected=!0;return}let n=this.lastContentSyncTs??new Date(Date.now()-5*6e4).toISOString();this.lastContentSyncTs=new Date().toISOString(),this.catchUpChangedContent(r,n).catch(o=>console.error("[gigabuddy-inbox] reconnect catch-up error:",o)),this.checkMentions(r).catch(o=>console.error("[gigabuddy-inbox] reconnect mention catch-up error:",o))}),this.messageFetcher&&(this.lastMentionCursor||(this.lastMentionCursor=this.state.lastMessageCursor),this.checkMentions(r).catch(i=>console.error("[gigabuddy-inbox] Mention bootstrap error:",i)),this.mentionWatchTimer=setInterval(()=>{this.checkMentions(r).catch(i=>console.error("[gigabuddy-inbox] Mention check error:",i))},n2)))}stop(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.outboxAbort&&(this.outboxAbort.abort(),this.outboxAbort=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.placeEventUnsub&&(this.placeEventUnsub(),this.placeEventUnsub=null);for(let e of this.contentDebounceTimers.values())clearTimeout(e);this.contentDebounceTimers.clear(),this.connectionUnsub&&(this.connectionUnsub(),this.connectionUnsub=null),this.mentionWatchTimer&&(clearInterval(this.mentionWatchTimer),this.mentionWatchTimer=null),this.persistTimer&&(clearTimeout(this.persistTimer),this.persistTimer=null),this.persistSessionState().catch(()=>{})}addEvent(e){e.type==="page_updated"&&e.pageId&&(this.events=this.events.filter(r=>!(r.type==="page_updated"&&r.pageId===e.pageId))),this.events.push({...e,ts:new Date().toISOString()}),this.events.length>B_&&(this.events=this.events.slice(-B_)),this.scheduleWrite()}notePosition(){this.schedulePersist()}noteSelfChanged(){this.scheduleWrite(),this.schedulePersist()}watchOutbox(e,r){let i=W_(Je(this.sessionId),"outbox.json");this.outboxAbort=new AbortController;let n=null,o=async()=>{try{let a=await Dz(i,"utf-8"),c=JSON.parse(a);if(c.ts&&c.ts!==n){n=c.ts;let l={lastActiveAt:c.ts};c.intent&&(l.action={label:c.intent});let u=c.recentFiles?.length?c.recentFiles:c.file?[c.file]:null;u&&JSON.stringify(u)!==JSON.stringify(this.lastOutboxFile?[this.lastOutboxFile]:[])&&(this.lastOutboxFile=u[0]??null,l.focus={kind:"files",ids:u}),c.owner&&(l.owner=c.owner),c.repo&&(l.repo=c.repo),c.branch&&(l.branch=c.branch),e.updateTopicState(r,l);let d=Date.now();if(this.workspaceSyncer&&d-this.lastWorkspaceSyncTs>1e4){this.lastWorkspaceSyncTs=d;let p={last_active_at:c.ts,status:"active"};c.intent&&(p.intent=c.intent),c.owner&&(p.owner=c.owner),c.repo&&(p.repo=c.repo),c.branch&&(p.branch=c.branch),c.recentFiles&&(p.recent_files=c.recentFiles),c.editedFiles&&(p.edited_files=c.editedFiles),c.uncommittedFiles&&(p.uncommitted_files=c.uncommittedFiles),c.gitStats&&(p.git_stats=c.gitStats),c.activeTask&&(p.active_task=c.activeTask),c.taskProgress&&(p.task_progress=c.taskProgress);let f=this.state.currentActivity?.activityId;f&&(p.activity_id=f),this.lastContextPct!=null&&(p.context_pct=this.lastContextPct);let m=this.state.agentMeta?.claudeSessionId,h=m?await pc(m):null;h&&(p.session_name=h),this.workspaceSyncer(p).catch(y=>console.error("[gigabuddy-inbox] Workspace sync error:",y))}if(this.profileSyncer&&d-this.lastProfileSyncTs>3e5){this.lastProfileSyncTs=d;let p=this.state.currentActivity?.label??c.activeTask??c.intent,f={lastDoing:{...p&&{label:p},...this.state.currentActivity?.activityId&&{activityId:this.state.currentActivity.activityId},...r&&{placeId:r},at:c.ts}};c.branch&&(f.branch=c.branch),this.lastContextPct!=null&&(f.metrics={contextPct:this.lastContextPct}),this.profileSyncer(f).catch(m=>console.error("[gigabuddy-inbox] Profile sync error:",m))}}}catch{}},s=setInterval(()=>{if(this.outboxAbort?.signal.aborted){clearInterval(s);return}o()},500);this.outboxAbort.signal.addEventListener("abort",()=>{clearInterval(s)})}onPeerUpdate(e,r){let i=this.buildPeerMap(e,r),n=this.getMyFocus(e,r);if(n.size>0){for(let[o,s]of i)if(s.focus){let a=s.focus.filter(c=>n.has(c));if(a.length>0){let c;for(let u=this.events.length-1;u>=0;u--){let d=this.events[u];if(d&&d.type==="conflict"&&d.peer===o){c=d;break}}c?.files&&JSON.stringify(c.files.sort())===JSON.stringify(a.sort())||this.addEvent({type:"conflict",peer:o,files:a})}}}this.previousPeers=i,this.scheduleWrite()}snapshotPeers(e,r){this.previousPeers=this.buildPeerMap(e,r)}buildPeerMap(e,r){let i=this.state.agentMeta?.displayName,n=new Map;for(let o of e.getTopicPeers(r)){let s=o.state,a=s.displayName??"Unknown";a===i||a==="Unknown"||a.startsWith("user:")||a.startsWith("agent:")||n.set(a,{displayName:a,owner:s.owner??null,status:s.status??"unknown",action:s.action?.label??null,focus:s.focus?.ids??null,activityId:s.activityId??null,lastActiveAt:s.lastActiveAt??null,repo:s.repo??null,branch:s.branch??null,worktreeId:s.worktreeId??null})}return n}myWorktreeId(){let e=this.state.placeId,r=this.state.awarenessManager;return!e||!r?null:r.topics?.get(e)?.localState?.worktreeId??null}getMyFocus(e,r){let o=e.topics?.get(r)?.localState?.focus;return new Set(o?.ids??[])}onActivityChanged(e){if(e.type!=="activity_changed"||e.change!=="attachment")return;let r=e.activityId;if(!r||!this.state.activeActivities.has(r))return;let i=e.actorId;if(i&&this.state.agentId&&i===this.state.agentId)return;let n=e.memberLabel?.trim(),o=e.memberKind??"item";this.addEvent({type:"attachment",peer:i??"someone",detail:n?`"${n}" (${o})`:`a ${o}`})}async onContentChanged(e,r){if(r.type!=="content_changed")return;let i=r.instanceId;!i||!this.state.watchedPages.has(i)||(r.ts&&(!this.lastContentSyncTs||r.ts>this.lastContentSyncTs)&&(this.lastContentSyncTs=r.ts),this.scheduleContentCheck(e,i))}scheduleContentCheck(e,r){let i=this.contentDebounceTimers.get(r);i&&clearTimeout(i);let n=setTimeout(()=>{this.contentDebounceTimers.delete(r),this.checkSingleWatchedPage(e,r).catch(o=>console.error("[gigabuddy-inbox] content check error:",o))},o2);this.contentDebounceTimers.set(r,n)}async checkSingleWatchedPage(e,r){if(!this.pageChecker)return;let i=this.state.watchedPages.get(r);if(!i)return;let n=this.state.agentId;try{let o=await this.pageChecker(e,r);if(!o)return;let{updatedAt:s,lastEditedBy:a}=o;if(!s||s===i.lastKnownUpdatedAt)return;if(a===n){i.lastKnownUpdatedAt=s,o.document&&(i.lastKnownDocument=o.document);return}let c="";if(i.lastKnownDocument&&o.document){let l=H_(i.lastKnownDocument,o.document),u=[];l.changed.length&&u.push(`changed: ${l.changed.join(", ")}`),l.added.length&&u.push(`added: ${l.added.join(", ")}`),l.removed.length&&u.push(`removed: ${l.removed.join(", ")}`),u.length&&(c=` (${u.join("; ")})`)}i.lastKnownUpdatedAt=s,o.document&&(i.lastKnownDocument=o.document),this.addEvent({type:"page_updated",peer:a??"someone",detail:`${i.title}${c}`,pageId:r,pageTitle:i.title})}catch{}}async catchUpChangedContent(e,r){if(!this.changedFetcher||this.state.watchedPages.size===0)return;let i;try{i=await this.changedFetcher(e,r)}catch{return}if(!(!i||i.length===0))for(let n of i)this.state.watchedPages.has(n.instanceId)&&await this.checkSingleWatchedPage(e,n.instanceId)}onMessageCreated(e){if(e.type!=="message_created")return;let r=e.message;r?.id&&this.processIncomingMessages([{id:r.id,content:Lr(r.content),senderName:r.senderName,senderCanonicalId:r.senderCanonicalId,createdAt:r.createdAt??new Date().toISOString(),parentMessageId:r.parentMessageId??void 0,mentionTargets:r.mentionTargets}])}onAskCreated(e){if(e.type!=="ask_created")return;let r=this.state.agentId;if(!r||e.to!==r)return;let i=typeof e.askId=="string"?e.askId:void 0;if(!i)return;let n=typeof e.title=="string"&&e.title?e.title:"(untitled ask)",o=typeof e.urgency=="string"&&e.urgency?` [${e.urgency}]`:"",s=typeof e.discussionActivityId=="string"?e.discussionActivityId:void 0,a=e.target,c=a?.id?` \xB7 about ${a.label?`"${a.label}" `:""}${a.id}`:"";this.addEvent({type:"ask",peer:typeof e.raisedByName=="string"&&e.raisedByName?e.raisedByName:"someone",detail:`${n}${o}${c} \u2014 answer with answer("${i}")`,threadId:s})}async checkMentions(e){if(!this.messageFetcher||!this.state.agentMeta?.displayName)return;let r=this.lastMentionCursor??void 0,i=await this.messageFetcher(e,r);!i||i.length===0||(this.lastMentionCursor=i[i.length-1].id,this.schedulePersist(),this.processIncomingMessages(i))}processIncomingMessages(e){let r=this.state.agentMeta?.displayName,i=this.state.agentId;if(!r)return;let n=r.toLowerCase();for(let o of e){if(this.seenMessageIds.has(o.id))continue;if(this.seenMessageIds.add(o.id),this.seenMessageIds.size>i2){let u=this.seenMessageIds.values().next().value;u!==void 0&&this.seenMessageIds.delete(u)}if(o.senderCanonicalId===i)continue;let s=Lr(o.content),a=s.toLowerCase(),c=i!=null&&(o.mentionTargets?.includes(i)??!1)||a.includes(n)||a.includes(`@${n}`),l=o.parentMessageId&&this.state.subscribedThreads.has(o.parentMessageId);if(c){let u=s.length>120?s.slice(0,120)+"...":s;this.addEvent({type:"mention",peer:o.senderName??"someone",detail:u,threadId:o.parentMessageId}),o.parentMessageId&&this.state.subscribeToThread(o.parentMessageId)}else if(l){let u=s.length>120?s.slice(0,120)+"...":s;this.addEvent({type:"thread_reply",peer:o.senderName??"someone",detail:u,threadId:o.parentMessageId})}}}async loadSessionState(){try{let e=await Dz(this.sessionStatePath,"utf-8"),r=JSON.parse(e);if(r.lastMentionCursor&&(this.lastMentionCursor=r.lastMentionCursor,this.lastPersistedCursor=r.lastMentionCursor),r.subscribedThreads?.length)for(let i of r.subscribedThreads)this.state.subscribedThreads.add(i);if(r.readCursors)for(let[i,n]of Object.entries(r.readCursors))n&&this.state.readCursors.set(i,n);if(r.currentActivity&&!this.state.currentActivity&&this.state.trackActivity(r.currentActivity),r.officeHours?.length){let i=Date.now();for(let n of r.officeHours)n.role==="origin"&&n.until&&Date.parse(n.until)<=i||this.state.officeHours.has(n.pageId)||this.state.officeHours.set(n.pageId,n)}console.error(`[gigabuddy-inbox] Restored session state: cursor=${r.lastMentionCursor}, threads=${r.subscribedThreads?.length??0}, readCursors=${Object.keys(r.readCursors??{}).length}, activity=${r.currentActivity?.activityId??"none"}`)}catch{}}async persistSessionState(){let e={lastMentionCursor:this.lastMentionCursor,subscribedThreads:Array.from(this.state.subscribedThreads),readCursors:Object.fromEntries(this.state.readCursors),currentActivity:this.state.currentActivity,officeHours:Array.from(this.state.officeHours.values()),savedAt:new Date().toISOString()},r=this.sessionStatePath+".tmp";await jz(r,JSON.stringify(e,null,2)),await Uz(r,this.sessionStatePath)}schedulePersist(){this.lastMentionCursor===this.lastPersistedCursor&&this.persistTimer||this.persistTimer||(this.persistTimer=setTimeout(()=>{this.persistTimer=null,this.lastPersistedCursor=this.lastMentionCursor,this.persistSessionState().catch(e=>console.error("[gigabuddy-inbox] Failed to persist session state:",e))},5e3))}scheduleWrite(){this.debounceTimer||(this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.writeInbox().catch(e=>{console.error("[gigabuddy-inbox] Failed to write inbox:",e)})},t2))}async refreshSessionName(e,r){let i=this.state.agentMeta;if(!i?.claudeSessionId)return;let n=await pc(i.claudeSessionId);n&&n!==i.sessionName&&(i.sessionName=n,e.updateTopicState(r,{sessionName:n}),this.scheduleWrite())}async refreshLocation(e,r){let i=await CP(this.state.agentMeta?.claudeSessionId);if(!i||i===this.lastLocationCwd)return;this.lastLocationCwd=i;let n=await kf(i);yz(this.lastLocation,n)&&(this.lastLocation=n,e.updateTopicState(r,{repo:n.repo,branch:n.branch,worktree:n.worktree,worktreeId:n.worktreeId,isolated:n.isolated}),this.scheduleWrite())}async refreshContext(e,r){let i=await Fr(this.state.agentMeta?.claudeSessionId);if(!i)return;let n=Math.round(i.usedTokens/1e3),o=i.windowTokens==null?null:Math.round(i.windowTokens/1e3),s=i.pct==null?null:Math.round(i.pct);n===this.lastContextTokens&&o===this.lastContextWindowK&&s===this.lastContextPct&&i.shouldHandoff===this.lastShouldHandoff||(this.lastContextTokens=n,this.lastContextWindowK=o,this.lastContextPct=s,this.lastShouldHandoff=i.shouldHandoff,e.updateTopicState(r,{contextTokensK:n,contextWindowK:o,contextPct:s,shouldHandoff:i.shouldHandoff}),this.scheduleWrite())}async refreshResources(e,r){this.selfPidResolved||(this.selfPidResolved=!0,this.selfPid=(await Vo().catch(()=>null))?.claudePid??null);let[i,n,o]=await Promise.all([this.selfPid!=null?$_(this.selfPid):Promise.resolve(null),Ho(),this.selfPid!=null?hf(this.selfPid):Promise.resolve(null)]),s=i==null?null:Math.round(i/25)*25,a=n?.pressure??null,c=n?.cpuPressure??null,l=Date.now(),u=null;if(o!=null&&this.lastCpuTicks!=null&&this.lastCpuSampleAt!=null){let p=(l-this.lastCpuSampleAt)/1e3;p>0&&(u=Math.max(0,Math.round((o-this.lastCpuTicks)/MP/p*10)/10))}if(o!=null&&(this.lastCpuTicks=o,this.lastCpuSampleAt=l),s===this.lastRssMb&&a===this.lastHostPressure&&c===this.lastCpuPressure&&u===this.lastCpuCores)return;this.lastRssMb=s,this.lastHostPressure=a,this.lastCpuPressure=c,this.lastCpuCores=u;let d={};s!=null&&(d.rssMb=s),a!=null&&(d.hostPressure=a),n?.memPct!=null&&(d.hostMemPct=n.memPct),u!=null&&(d.cpuCores=u),c!=null&&(d.hostCpuPressure=c),Object.keys(d).length!==0&&(e.updateTopicState(r,d),this.scheduleWrite())}async writeInbox(){this.seq++;let e=this.state.placeId;if(!e)return;let r={seq:this.seq,ts:new Date().toISOString(),self:{displayName:this.state.agentMeta?.displayName??"Unknown",agentId:this.state.agentId,placeId:e,activityId:this.state.currentActivity?.activityId??null,activityLabel:this.state.currentActivity?.label??null,sessionId:this.sessionId,claudeSessionId:this.state.agentMeta?.claudeSessionId??null,sessionName:this.state.agentMeta?.sessionName??null,contextTokensK:this.lastContextTokens,contextWindowK:this.lastContextWindowK,contextPct:this.lastContextPct,shouldHandoff:this.lastShouldHandoff,worktreeId:this.myWorktreeId(),officeHours:Array.from(this.state.officeHours.values())},peers:Array.from(this.previousPeers.values()),events:this.events.slice(-B_),...this.state.houseRuleHeadlines?.length?{houseRules:this.state.houseRuleHeadlines}:{}},i=this.inboxPath+".tmp";await jz(i,JSON.stringify(r,null,2)),await Uz(i,this.inboxPath);let n=[...this.events].reverse().find(o=>o.type==="conflict");this.state.statuslineRenderer?.onInbox({displayName:r.self.displayName,placeName:this.state.agentMeta?.placeName??null,activityLabel:r.self.activityLabel,worktreeId:r.self.worktreeId,officeHours:r.self.officeHours,peers:r.peers.map(o=>({displayName:o.displayName,owner:o.owner,worktreeId:o.worktreeId})),conflictFile:n?.files?.[0]??null,messageCount:this.events.filter(o=>o.type==="mention"||o.type==="thread_reply").length})}};import{randomUUID as s2}from"node:crypto";import{mkdir as a2,readFile as Lz,writeFile as c2}from"node:fs/promises";import{homedir as l2}from"node:os";import{join as Zz}from"node:path";var Fz=Zz(l2(),".gigabuddy"),J_=Zz(Fz,"machine-id"),pi=null;async function G_(){if(pi)return pi;try{let t=(await Lz(J_,"utf-8")).trim();if(t)return pi=t,pi}catch{}try{await a2(Fz,{recursive:!0}),await c2(J_,`${s2()}
|
|
230
|
+
`,{flag:"wx"})}catch{}try{pi=(await Lz(J_,"utf-8")).trim()||null}catch{pi=null}return pi}function qz(t,e=Date.now()){let r=Date.parse(t)-e,i=Math.round(Math.abs(r)/6e4),n=i<1?"<1 min":i<90?`${i} min`:`~${Math.round(i/60)}h`;return r>=0?`~${n} left`:`${n} ago`}function u2(t){if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"){let r=Date.parse(t);return Number.isNaN(r)?null:r}let e=t;return e&&typeof e._seconds=="number"?e._seconds*1e3:e&&typeof e.seconds=="number"?e.seconds*1e3:null}function wc(t,e=Date.now()){let r=u2(t);if(r===null)return"";let i=Math.max(0,Math.round((e-r)/1e3));if(i<45)return"just now";let n=Math.round(i/60);if(n<90)return`${Math.max(1,n)} min ago`;let o=Math.round(n/60);return o<36?`${o}h ago`:`${Math.round(o/24)} days ago`}function Vz(t,e){let r={get(i,n,o){if(n!=="updateTopicState"){let s=Reflect.get(i,n,o);return typeof s=="function"?s.bind(i):s}return(s,a)=>{i.updateTopicState(s,a);let c=e.getSponsorTopic(),l=e.getPlaceId();!c||!l||s!==l||i.updateTopicState(c,{...e.getLocation(),...a})}}};return new Proxy(t,r)}async function Hz(t,e,r){let i=await t.claimWork(e,r,{from:"open",to:"active"}).catch(()=>null);i&&!i.won&&(i.status==="stalled"||i.status==="parked")&&await t.claimWork(e,r,{from:i.status,to:"active"}).catch(()=>{})}async function K_(t,e,r){await t.claimWork(e,r,{from:"active",to:"open"}).catch(()=>{})}async function d2(t,e,r){let i=await t.getActivity(e,r).catch(()=>null);for(let n of i?.attachments??[]){if(n.kind!=="content")continue;let o=await t.getPlaceContent(e,n.id).catch(()=>null),s=o?.instance??o;if(s?.data?.handedOverAt)return{id:s.id??n.id,handedOverBy:s.data.handedOverBy??null}}return null}async function Rf(t,e,r){let i=await t.getActivity(e,r).catch(()=>null),n={pageId:null,title:null,handover:null,workItemId:null,workItemStatus:null,originActorId:null};for(let o of i?.attachments??[]){if(o.kind!=="page"&&o.kind!=="content")continue;let s=await t.getPlaceContent(e,o.id).catch(()=>null),a=s?.instance??s;if(a?.data){if(o.kind==="page"&&a.data.handover&&!n.pageId){n.pageId=a.id??o.id,n.title=a.data.title??null,n.handover=a.data.handover;let c=n.handover.origin??{};n.originActorId=c.actorId??n.originActorId}else o.kind==="content"&&a.data.handedOverAt&&!n.workItemId&&(n.workItemId=a.id??o.id,n.workItemStatus=a.data.status??null,n.originActorId??=a.data.handedOverBy??null);if(n.pageId&&n.workItemId)break}}return n.pageId||n.workItemId?n:null}async function Wz(t,e,r,i){let n=await d2(t,e,r).catch(()=>null);!n||i!=null&&n.handedOverBy===i||await K_(t,e,n.id)}var Bz="VnkEV4zbGztvjGknQwt-w";function f2(t){let e=t.sessionId??(t.claudeSessionId?`cc_${t.claudeSessionId}`:null);return e===null?{sessionId:`orient_${process.pid}`,orientOnly:!0}:{sessionId:e,orientOnly:!1}}function m2(t,e,r){if(t.some(s=>s.placeId===e.id))return null;let i=r.find(s=>s.id===e.tenancyId),n=`"${e.name}" (${e.id}) in club "${i?.name??e.tenancyId??"unknown"}"`+(e.visibility==="public"?" \u2014 a PUBLIC room":"");return`Not connecting yet: ${t.length>0?`This repo's sessions have used: ${t.map(s=>`"${s.placeName??s.placeId}"`).join(", ")} \u2014 never ${n}.`:`This repo has no sanctioned rooms yet; the first one deserves a deliberate choice \u2014 you asked for ${n}.`}
|
|
231
|
+
|
|
232
|
+
If the user really wants this session in that room, call connect again with confirm: true \u2014 it will be remembered for this repo and not asked again. Check with them first: everything this session posts will land there.`}var Jz="sanctioned-places.json";async function Gz(){try{let t=await Ef(qr(Rt(),Jz),"utf-8"),e=JSON.parse(t);if(Array.isArray(e.places))return e.places.filter(r=>typeof r.placeId=="string")}catch{}try{let t=await Ef(qr(Rt(),"connection.json"),"utf-8"),e=JSON.parse(t);if(e.placeId)return[{placeId:e.placeId,placeName:e.placeName,tenancyId:e.tenancyId}]}catch{}return[]}async function h2(t){let e=(await Gz()).filter(r=>r.placeId!==t.placeId);e.push({...t,sanctionedAt:new Date().toISOString()}),await g_(),await kc(qr(Rt(),Jz),JSON.stringify({places:e},null,2))}async function g2(t){try{let e=await Ef(qr(Je(t),"session.json"),"utf-8");return JSON.parse(e)}catch{return null}}async function $c(t){await Zr(t.sessionId),await kc(qr(Je(t.sessionId),"session.json"),JSON.stringify(t,null,2))}async function y2(t,e){try{let r=await Ef(qr(Je(t),"ws.json"),"utf-8"),i=JSON.parse(r);return i.placeId===e&&i.instanceId?i.instanceId:null}catch{return null}}async function v2(t,e,r){await Zr(t),await kc(qr(Je(t),"ws.json"),JSON.stringify({placeId:e,instanceId:r}))}function b2(t){try{return JSON.parse(atob(t.split(".")[1])).actingAs?.sub??null}catch{return null}}function _2(t){try{return JSON.parse(atob(t.split(".")[1])).principalType==="agent"}catch{return!1}}function w2(t){try{return JSON.parse(atob(t.split(".")[1])).sub??null}catch{return null}}function $2(t,e){return{...t.tenancyId?{tenancyId:t.tenancyId,installationId:t.tenancyId}:{},placeId:e}}function k2(t,e){let r=e.map(c=>c.state),i=c=>r.filter(l=>l.activityId===c).map(l=>l.displayName??"Unknown"),n=c=>c.updatedAt??c.createdAt??"",o=(c,l)=>({id:c.id,label:c.label,peerName:l?i(c.id).join(", "):void 0,updatedAgo:n(c)?wc(n(c)):void 0}),s=t.filter(c=>i(c.id).length>0),a=t.filter(c=>i(c.id).length===0&&n(c)).sort((c,l)=>n(l).localeCompare(n(c)));return[...s.slice(0,10).map(c=>o(c,!0)),...a.map(c=>o(c,!1))].slice(0,10)}async function X_(t,e,r,i){let n=t.sessionId?{sessionId:t.sessionId,hostSessionId:t.claudeSessionId}:t.claudeSessionId?{sessionId:`cc_${t.claudeSessionId}`,hostSessionId:t.claudeSessionId}:null;n||(n=await e.host.resolveSession()??await e.host.fallbackSession());let{sessionId:o,orientOnly:s}=f2({sessionId:n?.sessionId,claudeSessionId:n?.hostSessionId}),a;try{a=await r.withTokenProvider(e.getToken,()=>r.getPlace(t.placeId))}catch(j){throw new Error(`Place not found or not accessible: ${t.placeId} (${j instanceof Error?j.message:String(j)})`)}let c=$2(a,t.placeId),l=null,u=e.getToken,d=t.displayName,p=s?null:await g2(o);if(p&&p.placeId===t.placeId){l=p.agentId;let j=p.agentToken;u=()=>Promise.resolve(j),d=p.displayName,r.setTokenProvider(u);let de=async()=>{console.error("[gigabuddy] Cached agent token expired, re-minting..."),r.setTokenProvider(e.getToken);let ce=await r.requestAgentToken({displayName:d,sessionId:o,scope:c});j=ce.token,l=ce.agentId,u=()=>Promise.resolve(j),r.setTokenProvider(u),$c({sessionId:o,agentId:ce.agentId,agentToken:j,displayName:d,placeId:t.placeId,savedAt:new Date().toISOString()}).catch(()=>{}),console.error("[gigabuddy] Agent token re-minted successfully")};if((()=>{try{let ce=JSON.parse(atob(j.split(".")[1]));return ce.exp?ce.exp*1e3<Date.now():!1}catch{return!0}})())try{await de()}catch(ce){console.error(`[gigabuddy] Re-mint failed, falling back to human token: ${ce instanceof Error?ce.message:String(ce)}`),r.setTokenProvider(e.getToken),u=e.getToken}$c({sessionId:o,agentId:l??p.agentId,agentToken:j,displayName:d,placeId:t.placeId,savedAt:new Date().toISOString()}).catch(()=>{}),r.setOnTokenExpired(async()=>{try{await de()}catch(ce){throw console.error(`[gigabuddy] Re-mint failed: ${ce instanceof Error?ce.message:String(ce)}`),ce}}),console.error(`[gigabuddy] Reusing cached identity: ${d} (${l})`)}else if(!s&&_2(await e.getToken())){let j=await e.getToken();if(l=w2(j),u=e.getToken,r.setTokenProvider(u),console.error("[gigabuddy] Bearer is already an agent principal \u2014 skipping /api/token/agent mint."),l)try{await r.updateAgentProfile(l,{...t.workdir&&{workdir:t.workdir},...o&&{sessionLabel:o}})}catch{}}else if(s)console.error("[gigabuddy] No resolvable session \u2014 orienting read-only (no identity minted).");else try{let j=await r.requestAgentToken({displayName:t.displayName,sessionId:o,scope:c});l=j.agentId;let de=j.token;u=()=>Promise.resolve(de),j.nickname&&(d=j.nickname),$c({sessionId:o,agentId:l,agentToken:de,displayName:d,placeId:t.placeId,savedAt:new Date().toISOString()}).catch(we=>console.error("[gigabuddy] Failed to cache session:",we)),r.setTokenProvider(u),r.setOnTokenExpired(async()=>{console.error("[gigabuddy] Agent token expired, re-minting...");try{r.setTokenProvider(e.getToken);let we=await r.requestAgentToken({displayName:d,sessionId:o,scope:c});de=we.token,u=()=>Promise.resolve(de),r.setTokenProvider(u),$c({sessionId:o,agentId:we.agentId,agentToken:de,displayName:d,placeId:t.placeId,savedAt:new Date().toISOString()}).catch(()=>{}),console.error("[gigabuddy] Agent token re-minted successfully")}catch(we){throw console.error(`[gigabuddy] Re-mint failed: ${we instanceof Error?we.message:String(we)}`),we}});try{await r.updateAgentProfile(l,{...t.workdir&&{workdir:t.workdir},...o&&{sessionLabel:o}})}catch{}}catch(j){console.error(`[gigabuddy] Agent token failed, using human token: ${j instanceof Error?j.message:String(j)}`)}i.placeId=t.placeId,i.tenancyId=a.tenancyId??null,i.agentId=l,r.setTokenProvider(u);let f=async()=>{if(s)return u();let j=await u();try{let de=JSON.parse(atob(j.split(".")[1]));if(de.exp&&de.exp*1e3<Date.now()){console.error("[gigabuddy] WS token expired, re-minting for reconnect..."),r.setTokenProvider(e.getToken);let we=await r.requestAgentToken({displayName:d,sessionId:o,scope:c});return u=()=>Promise.resolve(we.token),r.setTokenProvider(u),l=we.agentId,$c({sessionId:o,agentId:we.agentId,agentToken:we.token,displayName:d,placeId:t.placeId,savedAt:new Date().toISOString()}).catch(()=>{}),we.token}}catch{}return j},m=e.createAwarenessManager({getToken:f,buildWsUrl:j=>r.buildAwarenessWsUrl(j),user:{displayName:d,canonicalId:l??o}}),h=Vz(m,{getPlaceId:()=>t.placeId,getSponsorTopic:()=>i.sponsorTopic,getLocation:()=>({agentId:l,placeId:t.placeId,placeName:a.name,activityLabel:i.currentActivity?.label})});await h.connect(),await h.subscribe(t.placeId);let y=s?null:b2(await u());y&&(i.sponsorTopic=`sponsor:${y}`,await h.subscribe(i.sponsorTopic));let _=t.workdir??process.cwd(),{owner:$,repo:w,branch:k,...S}=await kf(_),J={displayName:d,canonicalId:l??o,status:"active",typing:!1};$&&(J.owner=$),w&&(J.repo=w),k&&(J.branch=k),S.worktreeId&&(J.worktree=S.worktree,J.worktreeId=S.worktreeId,J.isolated=S.isolated);let F=n?.hostSessionId,P=n?await e.host.readSessionName(n):null;F&&(J.claudeSessionId=F),P&&(J.sessionName=P),J.client=e.host.clientLabel;let se=await G_().catch(()=>null),{hostname:ue,container:ae}=await UP(se);J.host=ae?`${ue} (devcontainer)`:ue,se&&(J.machineId=se),s||h.updateTopicState(t.placeId,J),i.awarenessManager=h,!s&&i.livePageManagerFactory&&(i.livePageManager=i.livePageManagerFactory(h,{name:d,canonicalId:l??o})),i.agentMeta={displayName:d,sessionId:o,claudeSessionId:F,sessionName:P??void 0,placeName:a.name,workdir:t.workdir};let Me=new Cf(i,o,{workspaceSyncer:async j=>{!i.workspaceInstanceId||!i.placeId||await r.updatePlaceContent(i.placeId,i.workspaceInstanceId,j)},profileSyncer:async j=>{l&&await r.updateAgentProfile(l,j)},pageChecker:async(j,de)=>{try{let we=await r.getPlaceContent(j,de),ce=we.instance??we,Tn=ce.data;return{updatedAt:ce.updatedAt??null,lastEditedBy:Tn?.lastEditedBy??null,document:Tn?.document??void 0}}catch{return null}},messageFetcher:async(j,de)=>{try{return(await r.getMessages(j,{limit:50,after:de})).messages.map(ce=>({id:ce.id,content:Lr(ce.content),senderName:ce.senderName,senderCanonicalId:ce.senderCanonicalId,createdAt:ce.createdAt,parentMessageId:ce.parentMessageId,mentionTargets:ce.mentionTargets}))}catch{return null}},changedFetcher:async(j,de)=>{try{return await r.getChangedContent(j,de)}catch{return null}}});i.inboxWriter=Me,Me.start().catch(j=>console.error("[gigabuddy] Inbox writer error:",j)),i.statuslineRenderer?.setPlaceConnected(!0),h.onConnectionChange(j=>i.statuslineRenderer?.setWsConnected(j));let je=new bf;je.onMessage(j=>{if(j.type!=="page.saved"||!j.pageId)return;let de=i.watchedPages.get(j.pageId);i.inboxWriter?.addEvent({type:"page_updated",peer:"human (VS Code)",detail:de?.title??j.pageId})}),je.start(t.placeId),i.bridge=je,!s&&n&&e.host.markConnected(n).catch(()=>{});let ie=JSON.stringify({tenancyId:a.tenancyId??null,orgId:a.orgId??null,placeId:t.placeId,placeName:a.name},null,2);kc(qr(Rt(),"connection.json"),ie).catch(()=>{}),kc(qr(p2(),".gigabuddy","connection.json"),ie).catch(()=>{}),i.connected=!0,i.placeConversationId=a.conversationId??null;let qe=h.getTopicPeers(t.placeId),Ve={messages:[]},We=[],Et=null;try{[Ve,We,Et]=await Promise.all([r.getMessages(t.placeId,{limit:20}),r.listActivities(t.placeId,{status:"active"}),QP(r,t.placeId)])}catch(j){console.error(`[gigabuddy] Warmup calls failed (non-fatal): ${j instanceof Error?j.message:String(j)}`)}if(i.houseRuleHeadlines=Et?ez(Et):null,!s)try{let j=await G_().catch(()=>null),de={display_name:d,owner:$??void 0,repo:w??void 0,branch:k??void 0,status:"active",last_active_at:new Date().toISOString(),claude_session_id:F??void 0,session_name:P??void 0,machine_id:j??void 0,cwd:_},we=await y2(o,t.placeId);if(!we)try{let Tn=((await r.listPlaceContent(t.placeId,{contextSchemaId:Bz,limit:200})).instances??[]).find(Tc=>(Tc.data??{}).session_id===o);Tn?.id&&(we=Tn.id)}catch(ce){console.error(`[gigabuddy] Workspace lookup failed (creating fresh record): ${ce instanceof Error?ce.message:String(ce)}`)}if(we)await r.updatePlaceContent(t.placeId,we,{connected_at:new Date().toISOString(),...de}),i.workspaceInstanceId=we;else{let ce=await r.createPlaceContent(t.placeId,"agent_workspace",{session_id:o,connected_at:new Date().toISOString(),...de},{contextSchemaId:Bz});i.workspaceInstanceId=ce.instance?.id??null}i.workspaceInstanceId?(await v2(o,t.placeId,i.workspaceInstanceId).catch(()=>{}),console.error(`[gigabuddy] Workspace instance: ${i.workspaceInstanceId}`)):console.error("[gigabuddy] Workspace instance NOT persisted (create returned no id)")}catch(j){console.error(`[gigabuddy] Workspace instance write failed (non-fatal): ${j instanceof Error?j.message:String(j)}`)}if(Ve.messages.length>0){let j=Ve.messages[Ve.messages.length-1];j&&(i.lastMessageCursor=j.id)}if(!s&&e.onConnected)try{e.onConnected()}catch(j){console.error(`[gigabuddy] onConnected hook failed (non-fatal): ${j instanceof Error?j.message:j}`)}return{placeName:a.name,placeDescription:a.description?.trim()||null,houseRules:Et,tenancyId:a.tenancyId??null,visibility:a.visibility??null,agentId:l,displayName:d,sessionId:o,peers:qe.map(j=>{let de=j.state;return{name:de.displayName??"Unknown",status:de.status??"unknown",action:de.action?.label,activityId:de.activityId??void 0}}),liveActivities:k2(We,qe),totalActiveActivities:We.length,recentMessages:Ve.messages.slice(-5).map(j=>{let de=Lr(j.content);return{sender:j.senderName??"Unknown",time:j.createdAt?wc(j.createdAt):"",content:de.length>100?de.slice(0,100)+"...":de}}),totalMessages:Ve.messages.length}}function Kz(t,e,r,i){t.tool("list_places","List places you have access to. Use this to discover available places before connecting.",{},async()=>{try{return await e.withTokenProvider(i.getToken,async()=>{let n=await e.listTenancies();if(n.length===0)return{content:[{type:"text",text:"No tenancies found. You may need to be invited to one first."}]};let o=[];for(let s of n){o.push(`Tenancy: ${s.name} (${s.id})`);try{let a=await e.listPlaces(s.id);if(a.length===0)o.push(" No places");else for(let c of a){let l=c.description?` \u2014 ${c.description}`:"",u=c.memberCount?` (${c.memberCount} members)`:"";o.push(` - ${c.name}${u}${l}`),o.push(` id: ${c.id}`)}}catch(a){o.push(` Error listing places: ${a instanceof Error?a.message:String(a)}`)}o.push("")}return{content:[{type:"text",text:o.join(`
|
|
233
|
+
`)}]}})}catch(n){return{content:[{type:"text",text:`Failed to list places: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("open_browser_session","Open an interactive BROWSER session as yourself (this agent) so you can drive Gigabuddy or the chat-app in a real browser (e.g. via Playwright) \u2014 logged in as your own agent identity, with your human sponsor attached. Returns a one-time, short-lived URL to navigate to. You must `connect` to a place first (that establishes your identity).",{app:H.enum([ot().webAppKey,"chat-app"]).optional().describe(`Which web app to open (default: ${ot().webAppKey})`),placeId:H.string().optional().describe("Place to open after sign-in (defaults to your connected place)"),baseUrl:H.string().optional().describe("Override the app base URL for local dev / staging, e.g. http://localhost:3012")},async n=>{try{if(!r.connected||!r.agentId)return{content:[{type:"text",text:"Connect to a place first (use `connect`) \u2014 your agent identity is established on connect."}],isError:!0};let o=await i.getToken(),s=await e.requestBrowserSession(o,{agentId:r.agentId,app:n.app??ot().webAppKey,placeId:n.placeId??r.placeId??void 0,baseUrl:n.baseUrl});return{content:[{type:"text",text:`Browser session ready for ${s.nickname??s.displayName??r.agentId} (expires ${qz(s.expiresAt)}). Open this one-time link:
|
|
234
|
+
|
|
235
|
+
${s.ticketUrl}
|
|
236
|
+
|
|
237
|
+
It signs the browser in as your agent identity with your sponsor attached. The link is single-use \u2014 re-call open_browser_session for a fresh one.`}]}}catch(o){return{content:[{type:"text",text:`Failed to open browser session: ${o instanceof Error?o.message:String(o)}`}],isError:!0}}}),t.tool("connect","Join a place. Pass a placeId to connect directly, or omit it to see available places. Bootstraps awareness and fetches recent messages and activities. SUBAGENTS: if you are a subagent (spawned inside another session via the Agent/Task tool), do not connect \u2014 the parent session owns place presence and posting; return your results to your orchestrator.",{placeId:H.string().optional().describe("Place ID to join (omit to list available places)"),confirm:H.boolean().optional().describe("Required the FIRST time this repo connects to a given room (sanctioned rooms are remembered and never re-ask). Only pass true after checking with the user \u2014 this is the guard against posting work into the wrong room."),displayName:H.string().describe("Your display name in the place"),sessionId:H.string().optional().describe("Unique session identifier (defaults to a generated ID)"),workdir:H.string().optional().describe("Current working directory (shown to other agents)")},async n=>{try{if(r.connected)return{content:[{type:"text",text:`Already connected to place ${r.placeId} as ${r.agentMeta?.displayName}. Call disconnect first to reconnect.`}]};if(!n.placeId)return await e.withTokenProvider(i.getToken,async()=>{let a=await e.listTenancies();if(a.length===0)return{content:[{type:"text",text:"No tenancies found. You may need to be invited to one first."}]};let c=["No placeId specified. Available places:",""];for(let l of a)try{let u=await e.listPlaces(l.id);for(let d of u)c.push(` - ${d.name} (${d.id})`)}catch{}return c.push(""),c.push("Call connect again with a placeId to join one."),{content:[{type:"text",text:c.join(`
|
|
238
|
+
`)}]}});if(!n.confirm){let a=await Gz();if(!a.some(c=>c.placeId===n.placeId)){let c=await e.withTokenProvider(i.getToken,async()=>{let l=await e.getPlace(n.placeId),u=await e.listTenancies();return m2(a,{...l,id:n.placeId},u)});if(c)return{content:[{type:"text",text:c}],isError:!0}}}let o=await X_({placeId:n.placeId,displayName:n.displayName,sessionId:n.sessionId,workdir:n.workdir},i,e,r);await h2({placeId:n.placeId,placeName:o.placeName,tenancyId:o.tenancyId}).catch(()=>{});let s=[];if(s.push(`Connected to "${o.placeName}" (${n.placeId})`),o.tenancyId&&s.push(` Club (tenancy): ${o.tenancyId}`),o.visibility&&s.push(o.visibility==="public"?" Visibility: PUBLIC \u2014 anyone who can see this club can read what you post here":` Visibility: ${o.visibility}`),o.agentId&&s.push(` Agent ID: ${o.agentId}`),s.push(` Display name: ${o.displayName}`),s.push(` Agents online: ${o.peers.length}`),s.push(""),o.placeDescription&&(s.push(`About this place: ${o.placeDescription}`),s.push("")),o.houseRules?.unreadable)s.push("\u26A0 House rules unreadable this session \u2014 do not assume there are none."),s.push("");else if(o.houseRules&&o.houseRules.rules.length>0){s.push("House rules here (standing directives \u2014 they outrank ad-hoc instructions):");for(let a of o.houseRules.rules){let c=a.pageRefs.length>0?` \u2014 read before proceeding: ${a.pageRefs.join(", ")}`:"";s.push(` \u25B8 ${a.title}${a.firmness==="memory"?" (advisory)":""}${c}`)}s.push("")}if(o.peers.length>0){s.push("Connected agents:");for(let a of o.peers)s.push(` - ${a.name} (${a.status}${a.action?`: ${a.action}`:""})`);s.push("")}if(o.liveActivities.length>0){s.push(`Recent activities (${o.liveActivities.length} of ${o.totalActiveActivities} active):`);for(let a of o.liveActivities){let c=a.peerName?` \u2014 ${a.peerName} is on it now`:a.updatedAgo?` (updated ${a.updatedAgo})`:"";s.push(` - [${a.id}] ${a.label}${c}`)}s.push(" (get_activities browses the rest)"),s.push("")}else o.totalActiveActivities>0&&(s.push(`Active activities: ${o.totalActiveActivities} (get_activities browses them)`),s.push(""));if(o.recentMessages.length>0){s.push(`Recent messages (${o.totalMessages}):`);for(let a of o.recentMessages)s.push(` [${a.time}] ${a.sender}: ${a.content}`);o.totalMessages>5&&s.push(` (${o.totalMessages-5} more \u2014 use get_messages to read all)`)}try{let a=await e.listMyAsks({status:"open",limit:10}),c=a.asks??[];if(c.length>0){s.push(""),s.push(`\u{1F4E8} ${a.count} open ask(s) addressed to you (delivered while you were away or still unanswered):`);for(let l of c.slice(0,5)){let u=l.data??{},d=(u.raisedBy??{}).name,p=u.target??{},f=typeof p.id=="string"&&p.id?` \xB7 about ${typeof p.label=="string"&&p.label?`"${p.label}" `:""}${p.id}`:"";s.push(` - ${typeof u.title=="string"?u.title:"(untitled)"}${typeof u.urgency=="string"?` [${u.urgency}]`:""}${typeof d=="string"?` \u2014 from ${d}`:""}${f} (${l.id})`)}a.count>5&&s.push(` (${a.count-5} more \u2014 list_asks for the full queue)`),s.push(" Answer with answer(<id>), commit with ack(<id>), or defer with snooze_ask.")}}catch{}return{content:[{type:"text",text:s.join(`
|
|
239
|
+
`)}]}}catch(o){return e.setTokenProvider(i.getToken),r.reset(),{content:[{type:"text",text:`Failed to connect: ${o instanceof Error?o.message:String(o)}`}],isError:!0}}}),t.tool("disconnect","Leave the current place. Completes any active activity (a handover work-session is handed back and left claimable instead of completed) and cleans up awareness.",{},async()=>{if(!r.connected)return r.autoConnectSuppressed=!0,r.statuslineRenderer?.setPendingPlace(null),{content:[{type:"text",text:"Not connected \u2014 auto-connect disabled for this session. Use `connect` to join a place."}]};r.autoConnectSuppressed=!0;try{if(r.currentActivity&&r.placeId){let n=r.currentActivity.activityId,o=await Rf(e,r.placeId,n).catch(()=>null);if(o){let s=r.agentId!=null&&r.agentId===o.originActorId;if(await e.setMyStatus(r.placeId,n,{status:"handed-off",actorType:"buddy"}).catch(()=>{}),!s&&o.workItemId&&await K_(e,r.placeId,o.workItemId),s&&o.pageId&&o.handover){let a=o.handover.origin??{};await e.updatePlaceContent(r.placeId,o.pageId,{handover:{...o.handover,origin:{...a,until:new Date().toISOString()}}}).catch(()=>{})}r.clearOfficeHoursForActivity(n)}else try{await e.completeActivity(r.placeId,n)}catch{}r.clearCurrentActivity()}if(r.inboxWriter?.stop(),r.workspaceInstanceId&&r.placeId)try{await e.updatePlaceContent(r.placeId,r.workspaceInstanceId,{status:"disconnected",last_active_at:new Date().toISOString()})}catch{}return r.awarenessManager?.disconnect(),e.setTokenProvider(i.getToken),r.reset(),{content:[{type:"text",text:"Disconnected."}]}}catch(n){return{content:[{type:"text",text:`Error during disconnect: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}})}function Qz(t,e,r){let i=new of,n=new Kp({name:ot().serverName,version:t.version??"0.0.0"}),o=t.host??(t.externalSessionId?new pf(t.externalSessionId):new df),s=new af(n,e,i,{version:t.version}),a={getToken:t.getToken,apiUrl:t.apiUrl,authUrl:t.authUrl,host:o,onConnected:()=>s.activate(),createAwarenessManager:l=>new Lo(l)},c={...t.auth,onLogin:l=>{t.auth.onLogin(l),i.statuslineRenderer?.setSignedIn(!0)}};return r(n,e,i,{connectConfig:a,auth:c}),{server:n,client:e,state:i,async listen(){let l=new Yp;await n.connect(l),console.error("Gigabuddy agent server started"),kP().then(f=>{f>0&&console.error(`[gigabuddy] Cleaned up ${f} stale file(s)`)}).catch(()=>{});let u=await S2(),d=(f,m)=>{let h=new vf(f);return h.setSignedIn(t.auth.isAuthenticated()),i.statuslineRenderer=h,h.start().catch(y=>console.error("[gigabuddy] statusline renderer error:",y)),t.auth.isAuthenticated()&&(async()=>{let y=t.autoConnect?.placeId?{kind:"default",placeId:t.autoConnect.placeId}:Xz(u,m);if(y.kind!=="resume"&&y.kind!=="default")return;let _=y.placeId,$=null;try{let w=await Yz(xc(Rt(),"connection.json"),"utf-8"),k=JSON.parse(w);k.placeId===_&&k.placeName&&($=k.placeName)}catch{}h.setPendingPlace($??_)})(),h},p=async()=>{if(i.statuslineRenderer)return;let f=await o.resolveSession().catch(()=>null);if(f){console.error(`[gigabuddy] Host session resolved (${o.clientLabel}): ${f.sessionId}`);let h=o.statuslineRef(f);h&&d(h,f.sessionId);return}setTimeout(()=>void p(),z2).unref?.()};p(),t.auth.isAuthenticated()?(t.autoConnect||u.length>0)&&E2(o,m=>{if(t.autoConnect)return t.autoConnect;let h=Xz(u,m.sessionId);return h.kind==="resume"||h.kind==="default"?(console.error(h.kind==="resume"?`[gigabuddy] Resuming into this session's own place ${h.placeId}`:`[gigabuddy] Defaulting to this host's single known place ${h.placeId}`),{placeId:h.placeId}):h.kind==="ambiguous"?{ambiguous:h.placeIds}:null},a,e,i):console.error("[gigabuddy] Not signed in \u2014 call the `login` tool to authenticate. Skipping auto-connect."),R2(process,()=>{i.inboxWriter?.stop(),i.statuslineRenderer?.stop(),i.awarenessManager?.disconnect()})}}}async function S2(){try{let t=await Y_(ar()),e=[];for(let r of t){let i,n,o=xc(ar(),r);try{if((await x2(o)).isDirectory())i=xc(o,"session.json"),n=r;else{if(!r.endsWith(".json")||r.startsWith("ws-"))continue;i=o,n=r.slice(0,-5)}}catch{continue}try{let s=await Yz(i,"utf-8"),a=JSON.parse(s);if(!a.placeId)continue;e.push({sessionId:n,placeId:a.placeId,savedAt:a.savedAt??""})}catch{}}return e}catch{return[]}}function Xz(t,e){let r=t.find(o=>o.sessionId===e);if(r)return{kind:"resume",placeId:r.placeId};let i=new Map;for(let o of t){let s=i.get(o.placeId);(s===void 0||o.savedAt>s)&&i.set(o.placeId,o.savedAt)}return i.size===0?{kind:"none"}:i.size===1?{kind:"default",placeId:[...i.keys()][0]}:{kind:"ambiguous",placeIds:[...i.entries()].sort(([,o],[,s])=>o<s?1:-1).map(([o])=>o)}}var I2=500,T2=5e3,P2=3e5,z2=1e4;function C2(t){return t<P2?I2:T2}function R2(t,e){let r=!1,i=()=>{r||(r=!0,e())},n=()=>{i(),t.exit(0)};t.on("SIGTERM",n),t.on("SIGINT",n),t.on("exit",i),t.stdin.on("end",n),t.stdin.on("close",n)}function E2(t,e,r,i,n){let o=Date.now(),s=!1,a=!1,c=!1,l=async()=>{let{stat:d,unlink:p}=await import("node:fs/promises");try{let _=[];try{for(let k of await Y_(ar()))_.push(xc(ar(),k,"pending-connect.json"))}catch{}for(let k of await Y_(Rt()))k.startsWith("pending-connect-")&&k.endsWith(".json")&&_.push(xc(Rt(),k));let $=0,w=[];for(let k of _)try{let S=await d(k);$++,S.mtimeMs<o&&w.push(k)}catch{}if($===0||w.length>0&&(await Promise.all(w.map(k=>p(k).catch(()=>{}))),w.length===$))return}catch{return}let f=await t.resolveSession().catch(()=>null),m="resolver";if(f){if(!await t.consumeConnectTrigger(f))return}else{if(f=await t.fallbackSession(),!f)return;m="fallback",await t.consumeConnectTrigger(f)}let h=e(f);if(h===null){a=!0;return}if("ambiguous"in h){n.autoConnectAmbiguity=h.ambiguous,a=!0,console.error(`[gigabuddy] Auto-connect skipped: recent sessions on this host used different places (${h.ambiguous.join(", ")}) and this session has none of its own yet \u2014 refusing to guess. Use the \`connect\` tool to pick one.`);return}console.error(`[gigabuddy] Identity via ${m} (${t.clientLabel}): ${f.sessionId}`);let y=await X_({placeId:h.placeId,displayName:h.displayName??t.defaultDisplayName,sessionId:f.sessionId,workdir:process.cwd(),claudeSessionId:f.hostSessionId},r,i,n);s=!0,console.error(`[gigabuddy] Connected to "${y.placeName}" as ${y.displayName} (session: ${f.sessionId})`),y.peers.length>0&&console.error(`[gigabuddy] Peers online: ${y.peers.map(_=>_.name).join(", ")}`)},u=async()=>{if(s||a||c||n.autoConnectSuppressed)return;c=!0;try{await l()}catch(p){console.error(`[gigabuddy] Auto-connect error: ${p instanceof Error?p.message:String(p)}`)}finally{c=!1}if(s||a||n.autoConnectSuppressed)return;setTimeout(u,C2(Date.now()-o)).unref?.()};u()}var Sc="agent";function Af(t=!1){return Gf(t,Sc)}function Q_(t,e=!1){Kf(t,e,Sc)}function ew(t=!1){Ew(t,Sc)}function tw(t=!1){return Yo(t,Sc)}function eC(t,e=!1){Aw(t,e,Sc)}var A2=["agent:spawn","discovery:read"];async function Of(t){return BT({authUrl:t,clientId:"gigabuddy-agent",scopes:A2})}async function Nf(t,e,r={}){return JT(t,e,{onPending:r.onPoll})}function fi(t){return{content:[{type:"text",text:t}]}}function tC(t,e){let r=null;t.tool("login","Sign in to Gigabuddy (one-time). Call this when a tool reports you are not authenticated. It returns a URL and a short code for the user to approve in their browser; relay them verbatim. Authentication completes in the background \u2014 re-call `login` to confirm, then retry what you were doing.",{},async()=>{if(e.isAuthenticated()){let n=e.currentUser();return fi(`Already signed in${n?` as ${n}`:""}. No action needed.`)}if(r?.status==="complete"){let n=e.currentUser();return r=null,fi(`Signed in${n?` as ${n}`:""} \u2713 You can use the other Gigabuddy tools now.`)}if(r?.status==="error"){let n=r.error??"unknown error";return r=null,fi(`The previous sign-in attempt failed (${n}). Call \`login\` again to retry.`)}if(r?.status==="pending"&&Date.now()<r.deadline)return fi(`Still waiting for approval. Visit ${r.flow.verificationUrl} and enter code ${r.flow.userCode}, then re-call \`login\` to confirm.`);let i=await Of(e.authUrl);return r={flow:i,deadline:Date.now()+i.expiresIn*1e3,status:"pending"},uc(i.verificationUrl).catch(()=>{}),Nf(e.authUrl,i).then(n=>{e.onLogin({refreshToken:n.refreshToken,userId:n.userId,userEmail:n.userEmail,authUrl:e.authUrl,apiUrl:e.apiUrl,createdAt:new Date().toISOString()}),r?.flow===i&&(r.status="complete")}).catch(n=>{r?.flow===i&&(r.status="error",r.error=n instanceof Error?n.message:String(n))}),fi(`To connect Gigabuddy, the user needs to sign in (one time):
|
|
240
|
+
|
|
241
|
+
1. Open ${i.verificationUrl}
|
|
242
|
+
2. Enter code: ${i.userCode}
|
|
243
|
+
|
|
244
|
+
I'll be authenticated automatically once they approve. Re-call \`login\` to confirm, then retry what you were doing.`)}),t.tool("logout","Sign out of Gigabuddy on this machine: removes the stored credential so no new session can act for the user until they sign in again. Session-level presence is separate \u2014 use `disconnect` to just leave the current place while staying signed in.",{},async()=>{if(!e.isAuthenticated())return fi("Not signed in \u2014 nothing to remove.");let i=e.currentUser();return r=null,e.onLogout(),fi(`Signed out${i?` (was ${i})`:""}. The stored credential is removed \u2014 new sessions will need \`login\` again. Note: other ALREADY-RUNNING sessions on this machine keep their in-memory tokens until they restart, and this session's current place connection (if any) stays up until it ends \u2014 use \`disconnect\` to drop it now.`)})}var O2=new Set([wf,...Object.values(Jo)]);function nC(t,e){let r=t.data??{},i=t.instanceId;if(!i)return null;let n=t.contextSchemaId,o=t.contextType,s=Array.isArray(r.tags)?r.tags:[],a=o==="page"&&s.includes(nz),c=!!n&&O2.has(n);if(!a&&!c||c&&r.handedOverAt||e.requireDispatch&&r.dispatch!==!0||r.status!=="open")return null;let l=a?"handover":P_(n);if(e.kind&&e.kind!==l)return null;let u=r.title??"Untitled";if(a)return{id:i,displayId:i,kind:l,title:u,pickup:`/pickup ${i}`};let d=sz(i,n);return{id:i,displayId:d,kind:l,title:u,pickup:`pickup_work ${d}`}}var N2=200,M2=1e3;async function j2(t,e){let r=[],i=new Map,n;for(;;){let o=await t.listPlaceContent(e,{extendsSchemaId:wf,limit:N2,before:n});for(let a of o.schemas??[])i.set(a.id,a.name);let s=o.instances??[];if(r.push(...s),!o.hasMore||!o.cursor||s.length===0)return{instances:r,schemas:i,truncated:!1};if(r.length>=M2)return{instances:r,schemas:i,truncated:!0};n=o.cursor}}async function D2(t,e,r){let i=await j2(t,e).catch(()=>({instances:[],schemas:new Map,truncated:!1})),n=await t.listPlaceContent(e,{contextSchemaId:iz,limit:50}).catch(()=>({instances:[]})),o=[],s=[];for(let c of[...i.instances,...n.instances??[]]){o.push(c);let l=nC({instanceId:c.id,contextSchemaId:c.contextSchemaId,contextType:c.contextType,data:c.data},r);l&&c.id&&s.push({match:l,instanceId:c.id})}if(s.length===0)return null;if(s.length===1)return s[0].match;let a=await r.ranker?.(o,e);return a&&s.sort((c,l)=>(a.get(c.instanceId)?.rank??Number.MAX_SAFE_INTEGER)-(a.get(l.instanceId)?.rank??Number.MAX_SAFE_INTEGER)),s[0].match}function rC(t,e){return{content:[{type:"text",text:[`${e==="reconciled"?"Work already waiting":"New work arrived"}: ${t.kind} "${t.title}" (${t.displayId})`,"",`Pick it up: \`${t.pickup}\``,"Then do the task and call resolve_work (or complete_activity for a handover).","Pickup CAS-claims it open\u2192active; if you LOSE the claim another picker got it first \u2014 yield and await_work again."].join(`
|
|
245
|
+
`)}]}}function U2(t){return{content:[{type:"text",text:t}],isError:!0}}function iC(t,e,r){t.tool("await_work",["Block until a dispatched work item arrives in this place's queue, then return it ready to pick up. This is the headless picker's heartbeat: a standing background session calls await_work, sleeps on the work-arrival event stream (no polling \u2014 same SSE machinery as wait_for_reply, just for work instead of replies), and wakes the instant a dispatch-flagged issue/idea/handover lands.","It reconciles anything already open+dispatched BEFORE blocking (so an item that arrived in the gap since your last call is never missed), then streams. Returns the matched item and the exact pickup command. By default it only wakes on items explicitly marked dispatch:true \u2014 human-only work is left alone; pass dispatch:false to watch every open arrival.","Loop shape: await_work \u2192 pickup_work/pickup (it CAS-claims open\u2192active; if you lose, yield) \u2192 do the task \u2192 resolve_work/complete_activity \u2192 await_work again."].join(" "),{dispatch:H.boolean().optional().describe("Only wake on dispatch-flagged items (default true). false = wake on ANY open work arrival."),kind:H.enum(["issue","idea","task","decision","handover"]).optional().describe("Restrict to one kind so a picker can specialize. Omit for all kinds."),timeout:H.number().optional().describe("Max seconds to block before returning empty (default 300, max 600).")},async i=>{try{_t(r);let n=r.placeId,o=i.dispatch!==!1,s=i.kind,a=Math.min(i.timeout??300,600),c=await D2(e,n,{requireDispatch:o,kind:s,ranker:r.workRanker});if(c)return rC(c,"reconciled");let l=await gP(e,n,a,d=>nC(d,{requireDispatch:o,kind:s}));return l?rC(l,"arrived"):{content:[{type:"text",text:`No ${o?"dispatched ":""}work arrived within ${a}s. Call await_work again to keep listening (it reconciles the gap).`}]}}catch(n){return U2(`Failed to await work: ${n instanceof Error?n.message:String(n)}`)}})}function L2(t,e,r){if(Math.abs(t.length-e.length)>r)return r+1;let i=Array.from({length:e.length+1},(n,o)=>o);for(let n=1;n<=t.length;n++){let o=[n],s=n;for(let a=1;a<=e.length;a++){let c=t[n-1]===e[a-1]?0:1,l=Math.min(i[a]+1,o[a-1]+1,i[a-1]+c);o[a]=l,l<s&&(s=l)}if(s>r)return r+1;i=o}return i[e.length]}function Z2(t,e){let r=t.toLowerCase(),i=e.toLowerCase().trim();if(!i||r.includes(i))return!0;let n=r.split(/\s+/).filter(Boolean);return i.split(/\s+/).filter(Boolean).every(o=>n.some(s=>s.includes(o)||o.length>=4&&L2(o,s,1)<=1))}function oC(t,e,r){t.tool("set_intent","Update your awareness state \u2014 what you are doing, which files you are touching, your current status. Other agents see this in real-time.",{status:H.enum(["active","idle","thinking","acting"]).optional().describe("Your current status"),action:H.string().optional().describe('What you are currently doing (e.g. "refactoring auth module")'),focus:H.array(H.string()).optional().describe("Files or resources you are touching (used for conflict detection)"),activityId:H.string().optional().describe("Activity you are currently working on")},async i=>{try{if(_t(r),await Zo(r),!r.awarenessManager)return{content:[{type:"text",text:"Awareness not initialized. Reconnect to fix."}],isError:!0};let n={};i.status&&(n.status=i.status),i.action!==void 0&&(n.action=i.action?{label:i.action}:null),i.focus!==void 0&&(n.focus=i.focus.length>0?{kind:"files",ids:i.focus}:null),i.activityId!==void 0&&(n.activityId=i.activityId||null),r.awarenessManager.updateTopicState(r.placeId,n);let o=["Intent updated:"];return i.status&&o.push(` status: ${i.status}`),i.action&&o.push(` action: ${i.action}`),i.focus?.length&&o.push(` focus: ${i.focus.join(", ")}`),i.activityId&&o.push(` activity: ${i.activityId}`),{content:[{type:"text",text:o.join(`
|
|
246
|
+
`)}]}}catch(n){return{content:[{type:"text",text:`Failed to set intent: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("get_awareness",'See connected agents, their current intent, the activity each is working on, and any file conflicts. Pass `name` to look up one agent (e.g. "Dusk Dace") \u2014 you get their current activity + a ready-to-use way to message them on it. This is how you reach an agent when you have something useful for them: look them up here, then send_message(activityId: \u2026) to land it in their work rather than the noisy main chat.',{name:H.string().optional().describe('Only show agents whose name matches this (case-insensitive substring), e.g. "Dusk Dace".')},async i=>{try{if(_t(r),await Zo(r),!r.awarenessManager)return{content:[{type:"text",text:"Awareness not initialized. Reconnect to fix."}],isError:!0};let n=r.awarenessManager,o=n.ws?.readyState,s=n.topics?.get(r.placeId),a=n._diag,c=r.awarenessManager.getTopicPeers(r.placeId);if(c.length===0)return{content:[{type:"text",text:["No other agents connected.",` ws connected: ${n._connected}`,` ws readyState: ${o} (1=OPEN)`,` topic subscribed: ${s?.subscribed}`,` topic clientId: ${s?.clientId}`,` topic peers map size: ${s?.peers?.size}`,` local state set: ${s?.localState!=null}`,"","Message counters:",` binary in: ${a?.binaryIn}`,` binary out: ${a?.binaryOut}`,` control in: ${a?.controlIn}`,` topic match: ${a?.topicMatch}`,` topic miss: ${a?.topicMiss}`,` peers decoded: ${a?.peersDecoded}`,"","Filter results:",` self-skip: ${a?.selfSkip}`,` null-state: ${a?.nullState}`,` kept: ${a?.kept}`,"","Last decoded peers:",...a?.lastPeers?.map(P=>` cid=${P.clientId} clock=${P.clock} keys=[${P.stateKeys}] \u2192 ${P.skip}`)??[],"",...a?.missedTopics?.length?["Missed topics (sample):",...a.missedTopics.map(P=>` "${P}"`)]:[]].join(`
|
|
247
|
+
`)}]};let l=new Set,d=r.awarenessManager.topics?.get(r.placeId),p=d?.localState?.focus;if(p?.ids)for(let F of p.ids)l.add(F);let f=d?.localState??{},m={branch:f.branch??null,worktreeId:f.worktreeId??null,activityId:f.activityId??null},h=[],y=r.agentMeta?.displayName,_=i.name?.trim(),$=c.filter(F=>{let P=F.state.displayName;return!(!P||P==="Unknown"||P===y||P.startsWith("user:")||P.startsWith("agent:")||_&&!Z2(P,_))}),w=new Map;if($.some(F=>F.state.activityId))try{for(let F of await e.listActivities(r.placeId,{status:"active"}))w.set(F.id,F.label)}catch{}let k=[];if(_&&$.length===0)return{content:[{type:"text",text:`No connected agent matches "${i.name}".`}]};k.push(_?`${$.length} agent(s) matching "${i.name}":`:`${$.length} other agent(s) connected:`),k.push("");let S=[];for(let F of $){let P=F.state,se=P.displayName??"Unknown",ue=P.canonicalId,ae=P.status??"unknown",Me=P.action,je=P.focus,ie=P.activityId,qe=P.waitingOnThread,Ve=P.repo,We=P.branch,Et=P.worktree,j=P.worktreeId,de=P.isolated,we=P.contextPct,ce=P.contextTokensK,Tn=P.shouldHandoff,Tc=P.rssMb,iw=P.host,ow=P.hostPressure,Pc=P.cpuCores;if(k.push(` ${se}`),ue&&k.push(` id: ${ue}`),k.push(` status: ${ae}`),Me?.label&&k.push(` action: ${Me.label}`),(Ve||We)&&k.push(` repo: ${Ve??"?"}${We?` (${We})`:""}`),Et&&k.push(` worktree: ${Et}${de===!1?" (shared checkout)":""}`),je?.ids?.length&&k.push(` focus: ${je.ids.join(", ")}`),h.push({agent:se,dims:{branch:We,worktreeId:j,activityId:ie,worktree:Et}}),ie){let Ge=w.get(ie);k.push(` activity: ${ie}${Ge?` (${Ge})`:""}`),k.push(` \u2192 reach them: send_message(activityId: "${ie}", content: "\u2026")`)}if(qe?.parentMessageId&&(typeof qe.since!="number"||Date.now()-qe.since<7e5)&&k.push(` \u23F3 waiting for a reply on thread ${qe.parentMessageId} \u2014 reply THERE, not in main chat`),typeof ce=="number"){let Ge=typeof we=="number"?`${we}% (~${ce}k)`:`~${ce}k (window unknown)`;k.push(` context: ${Ge}${Tn?" \u26A0 should hand off":""}`)}if(typeof Tc=="number"){let Ge=ow==="critical"?" \u{1F534}":ow==="warn"?" \u{1F7E1}":"",mi=typeof Pc=="number"&&Pc>0?`, ${Pc>=1?"\u{1F525}":""}${Pc}c cpu`:"";k.push(` footprint: ${Tc}MB${mi}${iw?` on ${iw}`:""}${Ge}`)}let Mf=mP(P);if(Mf&&fP(P.beatAt))for(let Ge of Mf.officeHours){if(Ge.role!=="origin")continue;let mi=w.get(Ge.activityId)??Ge.activityId,hC=Mf.availableFor.includes(Ge.activityId);k.push(hC?` \u{1F91D} holding office hours on ${mi} \u2014 reachable now${Ge.until?` (intended until ${Ge.until})`:""}`:` \u{1F91D} office hours on ${mi} \u2014 heads-down this moment, post to the thread and they'll see it`)}if(k.push(""),l.size>0&&je?.ids?.length){let Ge=je.ids.filter(mi=>l.has(mi));Ge.length>0&&S.push({agent:se,files:Ge})}}if(S.length>0){k.push("\u26A0 CONFLICTS DETECTED:");for(let F of S)k.push(` You and ${F.agent} are both touching: ${F.files.join(", ")}`)}else k.push("All clear \u2014 no file conflicts.");let J=gz(hz(m,h));if(J.length>0){k.push(""),k.push("Co-occupancy:");for(let F of J)k.push(` ${F}`)}return{content:[{type:"text",text:k.join(`
|
|
248
|
+
`)}]}}catch(n){return{content:[{type:"text",text:`Failed to get awareness: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("session_status","Show your own Gigabuddy identity \u2014 display name, session ID, place, connection health, and live context-window utilization (how full this session is, and whether it should hand off before auto-compaction). Optionally declare your context window so the percentage becomes precise: nothing on disk records whether you are on a 200k or 1M (claude-*-8[1m]) window, but YOU can read it from your own model id \u2014 pass contextWindow to teach it once; it is persisted for this session and reused everywhere (awareness, hooks, handover origin).",{contextWindow:H.number().optional().describe("Declare your context window in tokens (e.g. 200000, or 1000000 if your model id ends in [1m]). Persisted for this session so all context-% surfaces are exact."),model:H.string().optional().describe('Your full model id including any suffix, e.g. "claude-opus-4-8[1m]".')},async i=>{let n=[];if(!r.connected||!r.agentMeta)n.push("Not connected."),r.autoConnectAmbiguity?.length&&n.push(`Auto-connect was skipped: recent sessions on this host used different places (${r.autoConnectAmbiguity.join(", ")}) and this session has no place of its own yet. Call \`connect\` with the place you want.`);else{let o=r.agentMeta.claudeSessionId??ai();i.contextWindow&&o&&await zP(o,i.contextWindow,i.model).catch(()=>{}),n.push(`Name: ${r.agentMeta.displayName}`),n.push(`Session: ${r.agentMeta.sessionId}`),n.push(`Place: ${r.agentMeta.placeName?`${r.agentMeta.placeName} (${r.placeId})`:r.placeId}`),n.push(`Agent ID: ${r.agentId}`),n.push(`WS connected: ${r.awarenessManager?.connected??!1}`);let a=r.awarenessManager?.topics?.get(r.placeId??"")?.localState?.waitingOnThread;a?.parentMessageId&&(typeof a.since!="number"||Date.now()-a.since<7e5)&&n.push(`Waiting for a reply on thread: ${a.parentMessageId} (replies must land in this thread)`);let c=await Fr(o);c&&n.push(RP(c))}return{content:[{type:"text",text:n.join(`
|
|
249
|
+
`)}]}}),t.tool("host_status","Show system-resource health for the machine this session runs on: host memory/swap/load with a crash-risk verdict (ok/warn/critical), every Claude session on this host with its memory footprint (heaviest first \u2014 the kill list when the box is tight), and your own footprint + rank. When connected to a place, also lists peer agents on OTHER hosts with their published footprint, grouped by host, so you can spot a heavy/idle session anywhere and trace it back to its devcontainer + owner. Works without a place connection (the local view is read straight from /proc + the session registry).",{},async()=>{try{let i=[],o=(await Vo().catch(()=>null))?.claudePid,s=await Ho();s?(i.push(LP(s)),i.push("")):(i.push("Host resources: unavailable (non-Linux host \u2014 per-session footprints still shown below)."),i.push(""));let a=await DP(),c=a.filter(u=>!u.dead).map(u=>u.pid),l=await jP(c);for(let u of a){let d=l.get(u.pid);d!=null&&(u.cpuCores=d)}if(i.push(ZP(a,o)),o!=null){let u=a.filter(f=>!f.dead),d=u.findIndex(f=>f.pid===o),p=u[d];p?.rssMb!=null&&(i.push(""),i.push(`You: ${p.rssMb}MB, ranked ${d+1} of ${u.length} sessions on this host.`))}if(r.connected&&r.awarenessManager&&r.placeId){await Zo(r);let u=r.awarenessManager.getTopicPeers(r.placeId),d=r.agentMeta?.displayName,p=u.map(f=>f.state).filter(f=>{let m=f.displayName;return!m||m==="Unknown"||m===d?!1:typeof f.rssMb=="number"||typeof f.hostPressure=="string"||typeof f.cpuCores=="number"});if(p.length>0){let f=new Map;for(let m of p){let h=m.host||m.machineId||"unknown host",y=f.get(h)??[];y.push(m),f.set(h,y)}i.push(""),i.push("Peer agents on other hosts (from awareness):");for(let[m,h]of f){let y=h.find(w=>w.hostPressure)?.hostPressure,_=h.find(w=>w.hostCpuPressure)?.hostCpuPressure,$=[y?`mem ${y}`:"",_&&_!=="ok"?`cpu ${_}`:""].filter(Boolean).join(", ");i.push(` ${m}${$?` \u2014 ${$}`:""}`);for(let w of h.sort((k,S)=>(S.rssMb??0)-(k.rssMb??0))){let k=w.displayName??"Unknown",S=typeof w.rssMb=="number"?`${w.rssMb}MB`:"?MB",J=typeof w.cpuCores=="number"&&w.cpuCores>0?`, ${w.cpuCores>=1?"\u{1F525}":""}${w.cpuCores}c`:"",F=w.owner?` (${w.owner})`:"",P=w.sessionName||w.claudeSessionId?.slice(0,8)||"";i.push(` ${S}${J} ${k}${F}${P?` \u2014 ${P}`:""}`)}}}}return{content:[{type:"text",text:i.join(`
|
|
250
|
+
`)}]}}catch(i){return{content:[{type:"text",text:`Failed to read host status: ${i instanceof Error?i.message:String(i)}`}],isError:!0}}})}var sC=3.5*1024*1024;async function F2(t,e){let r=i=>[{type:"text",text:i}];try{let i=pP(e),n=await t.getFileUrl(i),o=`${n.name} (${n.contentType}, ${xn(n.size)}) \u2014 file:${n.fileId}`,s=n.url?`
|
|
251
|
+
Download URL (may expire): ${n.url}`:"";if(a_.has(n.contentType)){if(n.size>sC)return r(`${o}
|
|
252
|
+
Too large to view inline (limit ${xn(sC)}).${s}`);let{data:a,contentType:c}=await t.downloadFile(i),l=a_.has(c)?c:n.contentType;return[{type:"text",text:o},{type:"image",data:Buffer.from(a).toString("base64"),mimeType:l}]}if(dP(n.contentType)){if(n.size>c_)return r(`${o}
|
|
253
|
+
Too large to inline as text (limit ${xn(c_)}).${s}`);let{data:a}=await t.downloadFile(i),c=new TextDecoder().decode(a);return r(`${o}
|
|
254
|
+
|
|
255
|
+
\`\`\`
|
|
256
|
+
${c}
|
|
257
|
+
\`\`\``)}return r(`${o}
|
|
258
|
+
Not an inline-viewable type \u2014 I can render png/jpeg/gif/webp as images and text/JSON/CSV as text.${s}`)}catch(i){return r(`Failed to view ${e}: ${i instanceof Error?i.message:String(i)}`)}}function aC(t,e,r){t.tool("view_file","Look at file(s) shared in the place \u2014 a screenshot in the chat or an activity thread, an image on a page (file:\u2026 refs), a build log or JSON/CSV attachment, or anything surfaced by get_messages / find_messages. Images are returned so you actually SEE them; text/JSON/CSV files are decoded and returned inline (under a size cap); other types return metadata + a download URL. Pass an array of refs to look at several at once (e.g. a screenshot gallery). Access follows place membership, same as the humans reading the same chat.",{file:H.union([H.string(),H.array(H.string()).min(1)]).describe("A file reference \u2014 a `file:<id>` ref (as shown in messages/pages) or a bare id \u2014 OR an array of them to view several in one call.")},async i=>{try{_t(r);let n=Array.isArray(i.file)?i.file:[i.file],o=await Promise.all(n.map(a=>F2(e,a))),s=[];return o.forEach((a,c)=>{n.length>1&&s.push({type:"text",text:`\u2500\u2500 file ${c+1} of ${n.length} \u2500\u2500`}),s.push(...a)}),{content:s}}catch(n){return{content:[{type:"text",text:`Failed to view file: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("upload_file","Upload local file(s) into the place and get back `file:<id>` ref(s) \u2014 WITHOUT sending a message. Use this to mint an id you can then embed yourself: a screenshot on a page (``), an image in a handover, or any file you want referenced before it's posted anywhere. (To attach + post in one step, use send_message/log's `attachments` instead.) Files are private and place-scoped \u2014 readable by place members, and by agents via view_file. Pass an array to upload several at once.",{paths:H.union([H.string(),H.array(H.string()).min(1)]).describe("Local file path(s) to upload \u2014 a single path or an array of them."),attachToActivity:H.boolean().optional().describe("Also attach each uploaded file to your current activity (kind:file) so it shows up in list_activity_members. Default false; no-op if you have no current activity.")},async i=>{try{_t(r);let n=Array.isArray(i.paths)?i.paths:[i.paths],o=await rf(e,r.placeId,n),s="",a=i.attachToActivity?r.currentActivity?.activityId:void 0;if(a){let u=0;for(let d of o)await e.attachToActivity(r.placeId,a,{kind:"file",id:d.info.fileId,note:d.info.name}).then(()=>!0).catch(()=>!1)&&u++;u&&(s=`
|
|
259
|
+
Attached ${u} file(s) to activity ${a}.`)}let c=o.map(u=>`\u{1F4CE} ${u.info.name} (${u.info.contentType}, ${xn(u.info.size)}) \u2192 file:${u.info.fileId}`),l=o.length===1?`
|
|
260
|
+
Embed it on a page with \`![${o[0].info.name}](file:${o[0].info.fileId})\`, or view it with view_file.`:"\nEmbed any of them on a page with ``, or view them with view_file.";return{content:[{type:"text",text:`Uploaded ${o.length} file(s):
|
|
261
|
+
${c.join(`
|
|
262
|
+
`)}${s}${l}`}]}}catch(n){return{content:[{type:"text",text:`Failed to upload file: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}})}function cC(t,e,r){let i=n=>n??r.currentActivity?.activityId??null;t.tool("set_my_status","Set YOUR status in an activity \u2014 the per-participant claim primitive, symmetric in both directions. 'active' = I've got this (use it to CLAIM a handover/work item instead of a global lock; as a handover's ORIGIN it instead REOPENS your office hours \u2014 the undo for a premature end_office_hours); 'handed-off'/'done' = RELEASE the claim (the item returns to 'unclaimed' in list_handovers/list_work for the next picker \u2014 claim is derived from active participants, so handing off is all it takes; no admin/participant-removal step); 'watching' = spectating (also releases an active claim); 'blocked' = stuck. Joining is implicit (writing your status auto-joins). Your context-window fullness is auto-stamped so the room sees handoff-health. Posts the transition into the activity thread.",{status:H.enum(["watching","active","blocked","done","handed-off"]).describe("Your status. 'active' claims the work."),statusText:H.string().optional().describe('Optional human one-liner (e.g. "wiring the endpoints").'),activityId:H.string().optional().describe("Activity ID (defaults to your current activity)"),contextPct:H.number().optional().describe("Override context-window fullness (auto-stamped if omitted).")},async n=>{try{_t(r);let o=i(n.activityId);if(!o)return{content:[{type:"text",text:"No active activity. Start one or pass an explicit activityId."}],isError:!0};let s=n.contextPct;if(s==null){let p=r.agentMeta.claudeSessionId??ai()??null;s=(await Fr(p).catch(()=>null))?.pct??void 0}let a=await e.setMyStatus(r.placeId,o,{status:n.status,statusText:n.statusText,contextPct:s,actorType:"buddy"});(n.status==="handed-off"||n.status==="done")&&r.clearOfficeHoursForActivity(o);let c=null;if(n.status==="active"){let p=await Rf(e,r.placeId,o).catch(()=>null);if(p&&r.agentId!=null&&p.originActorId===r.agentId){if(p.pageId&&p.handover){c=new Date(Date.now()+55*6e4).toISOString();let f=p.handover.origin??{};await e.updatePlaceContent(r.placeId,p.pageId,{handover:{...p.handover,origin:{...f,until:c}}}).catch(()=>{});let m=p.title??a.label??o;r.setOfficeHours({role:"origin",pageId:p.pageId,activityId:o,title:m,until:c})}}else p?.workItemId&&await Hz(e,r.placeId,p.workItemId).catch(()=>{})}else(n.status==="watching"||n.status==="handed-off"||n.status==="done")&&await Wz(e,r.placeId,o,r.agentId??null).catch(()=>{});let l=r.currentActivity?.activityId===o?r.currentActivity.conversationId:a.conversationId??"";!l&&a.conversationId&&(l=a.conversationId);let u=n.status==="watching"||n.status==="handed-off"||n.status==="done",d=!1;if(u?r.currentActivity?.activityId===o&&(r.clearCurrentActivity(),r.awarenessManager?.updateTopicState(r.placeId,{activityId:null}),d=!0):l&&(r.trackActivity({activityId:o,conversationId:l,label:a.label||o}),r.awarenessManager?.updateTopicState(r.placeId,{activityId:o})),l){let p=s!=null?` (context ${s}%)`:"";await e.sendMessage(r.placeId,{content:`${r.agentMeta.displayName} is now **${n.status}**${n.statusText?` \u2014 ${n.statusText}`:""}${p}`,senderName:r.agentMeta.displayName,parentMessageId:l}).catch(()=>{})}return{content:[{type:"text",text:`Status set to '${n.status}' on ${o}${s!=null?` (context ${s}%)`:""}.`+(c?` Office hours REOPENED \u2014 you're listed as available again in list_handovers/list_work (advisory window until ${c}). Watch the activity thread with wait_for_reply and answer with 'log'.`:"")+(d?" Released this session's current-activity focus \u2014 you can start_activity on new work now (this one stays a valid queue item for the next picker).":"")}]}}catch(o){return{content:[{type:"text",text:`Failed to set status: ${o instanceof Error?o.message:String(o)}`}],isError:!0}}})}import{execFile as V2}from"node:child_process";function Go(t,e,r=5e3){return new Promise(i=>{V2("git",["-C",t,...e],{timeout:r,maxBuffer:8*1024*1024},(n,o)=>{i(n?null:o)})})}function H2(t){let e=[],r=null,i=()=>{r?.path&&e.push({path:r.path,branch:r.branch??null,head:r.head??null,detached:!!r.detached,bare:!!r.bare}),r=null};for(let n of t.split(`
|
|
263
|
+
`)){if(n===""){i();continue}let o=n.indexOf(" "),s=o===-1?n:n.slice(0,o),a=o===-1?"":n.slice(o+1);switch(s){case"worktree":i(),r={path:a};break;case"HEAD":r&&(r.head=a);break;case"branch":r&&(r.branch=a.replace(/^refs\/heads\//,""));break;case"detached":r&&(r.detached=!0);break;case"bare":r&&(r.bare=!0);break}}return i(),e}function W2(t){let e=0,r=0,i=0,n=0;for(let o of t.split(`
|
|
264
|
+
`)){if(!o)continue;n++;let s=o[0],a=o[1];if(s==="?"&&a==="?"){i++;continue}s!==" "&&s!==void 0&&e++,a!==" "&&a!==void 0&&r++}return{staged:e,unstaged:r,untracked:i,total:n}}function B2(t){let e=[];for(let r of t.split(`
|
|
265
|
+
`)){if(!r)continue;let[i,n,o,s]=r.split(" ");i&&e.push({name:i,head:n??"",upstream:o||null,committerDate:s||null})}return e}var rw=60;async function J2(t,e){let r=e.agentMeta?.workdir??process.cwd(),i=await Go(r,["worktree","list","--porcelain"]),n=i!=null,o=[];if(i)for(let p of H2(i)){if(p.bare){o.push({...p,dirty:null});continue}let f=await Go(p.path,["status","--porcelain"]);o.push({...p,dirty:f!=null?W2(f):null})}let s=n?await Go(r,["stash","list"]):null,a=s?s.split(`
|
|
266
|
+
`).filter(Boolean):[],c=!1,l=!1,u=[];if(n&&(c=!!(await Go(r,["for-each-ref","--count=1","refs/remotes"]))?.trim(),c)){let p=await Go(r,["for-each-ref","--sort=-committerdate","--format=%(refname:short) %(objectname) %(upstream:short) %(committerdate:relative)","refs/heads"]),f=p?B2(p):[];l=f.length>rw;for(let m of f.slice(0,rw)){let h=await Go(r,["rev-list","--count",m.head,"--not","--remotes"]),y=h?Number.parseInt(h.trim(),10):0;Number.isFinite(y)&&y>0&&u.push({name:m.name,unpushed:y,upstream:m.upstream,committerDate:m.committerDate})}}let d=null;if(e.connected&&e.placeId&&e.agentId)try{let p=await t.listActivities(e.placeId,{status:"active"});d=[];for(let f of p){let m=(f.participants??[]).find(y=>y.actorId===e.agentId&&y.status!=="done"&&y.status!=="handed-off");if(!m)continue;let h=(f.attachments??[]).filter(y=>y.note==="about").map(y=>y.id);d.push({activityId:f.id,label:f.label,about:h,myStatus:m.status??"active"})}}catch{d=null}return{cwd:r,gitAvailable:n,hasRemotes:c,worktrees:o,stashes:a,unpushedBranches:u,branchScanTruncated:l,claims:d}}function G2(t){return t.bare?"bare":t.branch?t.branch:t.detached?`detached@${(t.head??"").slice(0,8)}`:"?"}function K2(t){let e=["In-flight inventory \u2014 crash-recovery sweep",""];if(!t.gitAvailable)e.push("Working trees: not a git checkout (or git unavailable) \u2014 skipping git sweep.");else{e.push(`Working trees (${t.worktrees.length}):`);let r=!1;for(let i of t.worktrees){let n=G2(i);if(i.dirty&&i.dirty.total>0){r=!0;let o=[i.dirty.staged?`${i.dirty.staged} staged`:"",i.dirty.unstaged?`${i.dirty.unstaged} unstaged`:"",i.dirty.untracked?`${i.dirty.untracked} untracked`:""].filter(Boolean).join(", ");e.push(` \u26A0 ${i.path} [${n}] \u270E ${i.dirty.total} uncommitted file(s) \u2014 ${o}`)}else i.dirty?e.push(` ${i.path} [${n}] clean`):e.push(` ${i.path} [${n}] (status unavailable)`)}if(r||e.push(" \u2713 all working trees clean."),e.push(""),t.stashes.length>0){e.push(`Stashes (${t.stashes.length}):`);for(let i of t.stashes.slice(0,10))e.push(` ${i}`);t.stashes.length>10&&e.push(` \u2026 +${t.stashes.length-10} more`),e.push("")}if(!t.hasRemotes)e.push("Unpushed branches: no remote configured \u2014 cannot determine (skipped)."),e.push("");else if(t.unpushedBranches.length>0){e.push(`Local branches with unpushed commits (${t.unpushedBranches.length}):`);for(let i of t.unpushedBranches){let n=i.upstream?`\u2192 ${i.upstream}`:"no upstream",o=i.committerDate?` \xB7 ${i.committerDate}`:"";e.push(` \u26A0 ${i.name} \u2191${i.unpushed} unpushed (${n})${o}`)}t.branchScanTruncated&&e.push(` \u2026 only the ${rw} most-recent branches were scanned (older ones skipped).`),e.push("")}else e.push("Local branches with unpushed commits: none."),e.push("")}if(t.claims==null)e.push("Your Gigabuddy claims: not connected \u2014 connect to a place to see unresolved activities/work.");else if(t.claims.length===0)e.push("Your Gigabuddy claims: none held by your current identity."),e.push(" (A crash that minted a NEW identity won't match here \u2014 trust the git sweep above and cross-check get_awareness.)");else{e.push(`Your unresolved Gigabuddy claims (${t.claims.length}):`);for(let r of t.claims){let i=r.about.length?` about ${r.about.join(", ")}`:"";e.push(` \u26A0 ${r.activityId} "${r.label}"${i} [${r.myStatus}]`)}e.push(" \u2192 resume each, or close it with resolve_work / complete_activity.")}return e.join(`
|
|
267
|
+
`)}function lC(t,e,r){t.tool("recovery_status",`In-flight inventory for crash recovery \u2014 answers "what was I working on that isn't closed cleanly?" in one call. Sweeps EVERY git working tree for uncommitted changes (the classic crash residue: real work left dirty with zero commits), lists local branches with commits that never reached a remote, and any stashes \u2014 then, when connected, your unresolved Gigabuddy claims (activities/work your current identity picked up but never resolved). Read-only; the git sweep works with no place connection. Run it first thing in a fresh session after a crash or restart.`,{},async()=>{try{let i=await J2(e,r);return{content:[{type:"text",text:K2(i)}]}}catch(i){return{content:[{type:"text",text:`Failed to build in-flight inventory: ${i instanceof Error?i.message:String(i)}`}],isError:!0}}})}function nw(t){let e=t.senderName??"Unknown",r=t.createdAt?wc(t.createdAt):"",i=t.threadCount?` [${t.threadCount} replies]`:"",n=t.parentMessageId?` (reply to ${t.parentMessageId})`:"";return`[${r}] ${e}${n}${i}:
|
|
268
|
+
${Lr(t.content)}
|
|
269
|
+
id: ${t.id}`}function uC(t,e,r){t.tool("wait_for_reply","Wait for the next reply you haven't seen yet. Pass parentMessageId to watch ONE thread \u2014 a conversation id OR an activity:\u2026 / handover id works (it's normalized to the right conversation, so you can pass whatever id you're holding). With NO argument it watches the union of every thread you're subscribed to (same as `listen`), falling back to place-wide only if you're subscribed to nothing. Reconciles anything that arrived since you last read BEFORE blocking, so a reply in the gap between two waits is never missed.",{afterMessageId:H.string().optional().describe("Override the reconcile start point (defaults to your tracked read position)."),parentMessageId:H.string().optional().describe("Watch only this thread \u2014 a conversation id or an activity:\u2026/handover id (normalized to its conversation). Omit to watch all your subscribed threads."),timeout:H.number().optional().describe("Max seconds to wait (default 300, max 600)")},async i=>{try{_t(r);let n=Math.min(i.timeout??300,600),o;return i.parentMessageId?o=new Set([await si(r,e,i.parentMessageId)]):r.subscribedThreads.size>0?o=new Set(r.subscribedThreads):o=null,await sf(r,e,{threadKeys:o,afterMessageId:i.afterMessageId,timeoutSec:n,format:nw})}catch(n){return{content:[{type:"text",text:`Failed to wait for reply: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("listen","Your inbound loop: block until ANY reply lands in ANY thread you're a stakeholder on \u2014 every conversation you've sent into, every handover/activity you hold, and anything you `subscribe`d to \u2014 with no ids to pass by hand. This is the one tool to 'be reachable': call it after handing off work or posting questions and it surfaces whoever responds, in whichever thread. While you're in this broad listen your availability beacon advertises you as reachable across your whole subscription set. Pass `thread` to watch just ONE thread (the narrow case \u2014 same as wait_for_reply); doing so scopes your beacon to that thread only (you're marked away on the rest, because you are). Reconciles missed replies first, then blocks on live push.",{thread:H.string().optional().describe("Watch only this one thread \u2014 a conversation/activity/handover id (normalized for you). Omit to listen across your whole subscription set (the default, and what makes you broadly reachable)."),timeout:H.number().optional().describe("Max seconds to wait (default 300, max 600)")},async i=>{try{_t(r);let n=Math.min(i.timeout??300,600);if(i.thread){let s=await si(r,e,i.thread);return await sf(r,e,{threadKeys:new Set([s]),timeoutSec:n,format:nw,noun:"message"})}let o=new Set(r.subscribedThreads);for(let s of r.activeActivities.values())s.conversationId&&o.add(s.conversationId);return await sf(r,e,{threadKeys:o,timeoutSec:n,format:nw,noun:"message"})}catch(n){return{content:[{type:"text",text:`Failed to listen: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("subscribe","Become a stakeholder on a piece of work WITHOUT having to post in it \u2014 so a question posted to that work reaches you. Pass a work/thread id (activity, conversation, or handover/page id). After subscribing, your broad `listen` covers it and your availability beacon advertises you as reachable there. This is how a co-decider or reviewer joins the stakeholder set of work they acted on (e.g. made a design call on) but never chatted in \u2014 the case plain thread-participation misses. Drop it again with `unsubscribe`.",{work:H.string().describe("What to subscribe to \u2014 an activity id, conversation id, or handover/page id (normalized for you).")},async i=>{try{_t(r);let n=await si(r,e,i.work),o=r.subscribedThreads.has(n);r.subscribeToThread(n);let s=i.work.startsWith("activity:")?i.work:[...r.activeActivities.values()].find(c=>c.conversationId===n)?.activityId,a="";if(s&&r.agentId)try{await e.setStakeholder(r.placeId,s,r.agentId,{stakeholderRole:"participant",actorType:"buddy"}),a=" You are now recorded as a durable stakeholder on the activity (persists even when you disconnect)."}catch{}return{content:[{type:"text",text:o?`Already subscribed to ${i.work}. Your broad \`listen\` already covers it.${a}`:`Subscribed to ${i.work}. You'll receive messages posted there via \`listen\`, and your availability beacon now lists you as reachable on it.${a}`}]}}catch(n){return{content:[{type:"text",text:`Failed to subscribe: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}}),t.tool("unsubscribe","Stop being a stakeholder on a piece of work \u2014 drop it from your `listen` set and your availability beacon. Pass the same work/thread id you subscribed with (activity, conversation, or handover/page id). Use it to silence a thread you no longer need to track when the fan-in gets noisy.",{work:H.string().describe("What to unsubscribe from \u2014 an activity id, conversation id, or handover/page id.")},async i=>{try{_t(r);let n=await si(r,e,i.work);return{content:[{type:"text",text:r.unsubscribeFromThread(n)?`Unsubscribed from ${i.work} \u2014 it's out of your \`listen\` set and your beacon.`:`You weren't subscribed to ${i.work} (nothing to drop).`}]}}catch(n){return{content:[{type:"text",text:`Failed to unsubscribe: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}})}function dC(t){let e=new Wp({getToken:t.getToken,apiUrl:t.apiUrl,authUrl:t.authUrl});return Qz(t,e,(r,i,n,{connectConfig:o,auth:s})=>{tC(r,s),Kz(r,i,n,o),uC(r,i,n),aC(r,i,n),oC(r,i,n),lC(r,i,n),cC(r,i,n),iC(r,i,n)})}KT("gigabuddy");var Q2="https://api.gigabuddy.com",eF="https://auth.gigabuddy.com",tF="https://api.staging.gigabuddy.com",rF="https://auth.staging.gigabuddy.com";function pC(){let t=Ic.dirname(X2(import.meta.url));for(let e of[Ic.join(t,"package.json"),Ic.join(t,"..","package.json")])try{let r=JSON.parse(mC.readFileSync(e,"utf-8"));if(r.version)return r.version}catch{}return"unknown"}function nF(){console.error(`
|
|
270
|
+
Gigabuddy agent \u2014 real-time awareness and collaboration for coding agents
|
|
271
|
+
|
|
272
|
+
Usage:
|
|
273
|
+
gigabuddy-agent [command] [options]
|
|
274
|
+
|
|
275
|
+
Commands:
|
|
276
|
+
login Sign in
|
|
277
|
+
logout Clear stored credentials
|
|
278
|
+
status Show authentication status
|
|
279
|
+
(none) Start MCP server (piped) or show status (interactive)
|
|
280
|
+
|
|
281
|
+
Options:
|
|
282
|
+
--staging Use staging environment
|
|
283
|
+
--auto-connect Auto-join a place on server startup
|
|
284
|
+
--place=PLACE_ID Place to auto-join (requires --auto-connect)
|
|
285
|
+
--display-name=NAME Display name override for auto-connect
|
|
286
|
+
--api-url=URL API URL override
|
|
287
|
+
--auth-url=URL Auth URL override
|
|
288
|
+
-v, --version Show version
|
|
289
|
+
-h, --help Show this help message
|
|
290
|
+
|
|
291
|
+
Place discovery happens at runtime via the list_places and connect tools.
|
|
292
|
+
Auto-connect is configured per-project via .mcp.json args.
|
|
293
|
+
`)}async function iF(t,e,r=!1){Tw(r?"Gigabuddy agent login (staging)":"Gigabuddy agent login");let i;try{i=await Of(t)}catch(o){Wf(`Couldn't start sign-in: ${o instanceof Error?o.message:o}`),process.exit(1)}zw(`Open: ${i.verificationUrl}
|
|
294
|
+
Code: ${i.userCode}`,"Approve this device"),uc(i.verificationUrl).catch(()=>{});let n=Cw();n.start("Waiting for you to approve in the browser\u2026");try{let o=await Nf(t,i),s={refreshToken:o.refreshToken,userId:o.userId,userEmail:o.userEmail,authUrl:t,apiUrl:e,createdAt:new Date().toISOString()};Q_(s,r),n.stop("Approved"),Pw(`Signed in${o.userEmail?` as ${o.userEmail}`:""}. Credentials saved to ${tw(r)}.`),process.exit(0)}catch(o){n.stop("Sign-in failed"),Wf(o instanceof Error?o.message:String(o)),process.exit(1)}}function oF(t=!1){Af(t)?(ew(t),console.error("Credentials cleared")):console.error("No credentials found")}function fC(t=!1){let e=Af(t);console.error("Authentication:"),e?(console.error(` User: ${e.userEmail||e.userId}`),console.error(` Auth URL: ${e.authUrl}`),console.error(` Config: ${tw(t)}`)):(console.error(" Not authenticated"),console.error(""),console.error(" To sign in, run:"),console.error(` npx -y @gigabuddy/agent login${t?" --staging":""}`)),console.error(""),console.error("Use list_places and connect tools to discover and join places at runtime.")}async function sF(){let{values:t,positionals:e}=Y2({options:{staging:{type:"boolean"},"api-url":{type:"string"},"auth-url":{type:"string"},"auto-connect":{type:"boolean"},place:{type:"string"},"display-name":{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},allowPositionals:!0});t.version&&(console.log(`gigabuddy-agent v${pC()}`),process.exit(0)),t.help&&(nF(),process.exit(0));let r=e[0],i=t.staging??!1,n=t["api-url"]||(i?tF:Q2),o=t["auth-url"]||(i?rF:eF);if(r==="login"){await iF(o,n,i);return}if(r==="logout"){oF(i);return}if(r==="status"){fC(i);return}process.stdin.isTTY&&(fC(i),process.exit(0));let s=null,a=Af(i),c=d=>{a=d,s=new Zp({refreshToken:d.refreshToken,authUrl:d.authUrl,reloginHint:"Call the `login` tool, or run 'npx -y @gigabuddy/agent login', to re-authenticate.",onRefreshTokenRotated:p=>{eC(p,i)}})};a&&c(a);let l=t["auto-connect"]&&t.place?{placeId:t.place,displayName:t["display-name"]}:void 0;await dC({getToken:async()=>{if(!s)throw new Error("Not signed in. Call the `login` tool to authenticate (one-time).");return s.getToken()},apiUrl:n,authUrl:o,autoConnect:l,externalSessionId:process.env.GIGABUDDY_HARNESS_SESSION_ID||void 0,version:pC(),auth:{authUrl:o,apiUrl:n,staging:i,isAuthenticated:()=>s!==null,currentUser:()=>a?.userEmail??a?.userId,onLogin:d=>{Q_(d,i),c(d),console.error(`[gigabuddy-agent] Signed in${d.userEmail?` as ${d.userEmail}`:""} via login tool`)},onLogout:()=>{ew(i),s=null,a=null,console.error("[gigabuddy-agent] Signed out via logout tool")}}}).listen()}sF().catch(t=>{console.error("Failed to start Gigabuddy agent:",t),process.exit(1)});
|
|
295
|
+
//# sourceMappingURL=agent-cli.js.map
|