1541 lines
752 KiB
JavaScript
1541 lines
752 KiB
JavaScript
import{createRequire as Ny}from"node:module";var cy=Object.create;var{getPrototypeOf:Uy,defineProperty:w$,getOwnPropertyNames:Dy}=Object;var Sy=Object.prototype.hasOwnProperty;function Ay(n){return this[n]}var Oy,ky,Z4=(n,i,r)=>{var o=n!=null&&typeof n==="object";if(o){var t=i?Oy??=new WeakMap:ky??=new WeakMap,e=t.get(n);if(e)return e}r=n!=null?cy(Uy(n)):{};let u=i||!n||!n.__esModule?w$(r,"default",{value:n,enumerable:!0}):r;for(let l of Dy(n))if(!Sy.call(u,l))w$(u,l,{get:Ay.bind(n,l),enumerable:!0});if(o)t.set(n,u);return u};var P=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var dy=(n)=>n;function Ly(n,i){this[n]=dy.bind(null,i)}var pi=(n,i)=>{for(var r in i)w$(n,r,{get:i[r],enumerable:!0,configurable:!0,set:Ly.bind(i,r)})};var m4=Ny(import.meta.url);var ne=P((kD)=>{Object.defineProperty(kD,"__esModule",{value:!0});kD.regexpCode=kD.getEsmExportName=kD.getProperty=kD.safeStringify=kD.stringify=kD.strConcat=kD.addCodeArg=kD.str=kD._=kD.nil=kD._Code=kD.Name=kD.IDENTIFIER=kD._CodeOrName=void 0;class Ql{}kD._CodeOrName=Ql;kD.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Jr extends Ql{constructor(n){super();if(!kD.IDENTIFIER.test(n))throw Error("CodeGen: name must be a valid identifier");this.str=n}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}kD.Name=Jr;class ci extends Ql{constructor(n){super();this._items=typeof n==="string"?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===""||n==='""'}get str(){var n;return(n=this._str)!==null&&n!==void 0?n:this._str=this._items.reduce((i,r)=>`${i}${r}`,"")}get names(){var n;return(n=this._names)!==null&&n!==void 0?n:this._names=this._items.reduce((i,r)=>{if(r instanceof Jr)i[r.str]=(i[r.str]||0)+1;return i},{})}}kD._Code=ci;kD.nil=new ci("");function AD(n,...i){let r=[n[0]],o=0;while(o<i.length)jc(r,i[o]),r.push(n[++o]);return new ci(r)}kD._=AD;var Gc=new ci("+");function OD(n,...i){let r=[so(n[0])],o=0;while(o<i.length)r.push(Gc),jc(r,i[o]),r.push(Gc,so(n[++o]));return ZJ(r),new ci(r)}kD.str=OD;function jc(n,i){if(i instanceof ci)n.push(...i._items);else if(i instanceof Jr)n.push(i);else n.push(zJ(i))}kD.addCodeArg=jc;function ZJ(n){let i=1;while(i<n.length-1){if(n[i]===Gc){let r=mJ(n[i-1],n[i+1]);if(r!==void 0){n.splice(i-1,3,r);continue}n[i++]="+"}i++}}function mJ(n,i){if(i==='""')return n;if(n==='""')return i;if(typeof n=="string"){if(i instanceof Jr||n[n.length-1]!=='"')return;if(typeof i!="string")return`${n.slice(0,-1)}${i}"`;if(i[0]==='"')return n.slice(0,-1)+i.slice(1);return}if(typeof i=="string"&&i[0]==='"'&&!(n instanceof Jr))return`"${n}${i.slice(1)}`;return}function MJ(n,i){return i.emptyStr()?n:n.emptyStr()?i:OD`${n}${i}`}kD.strConcat=MJ;function zJ(n){return typeof n=="number"||typeof n=="boolean"||n===null?n:so(Array.isArray(n)?n.join(","):n)}function CJ(n){return new ci(so(n))}kD.stringify=CJ;function so(n){return JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}kD.safeStringify=so;function RJ(n){return typeof n=="string"&&kD.IDENTIFIER.test(n)?new ci(`.${n}`):AD`[${n}]`}kD.getProperty=RJ;function xJ(n){if(typeof n=="string"&&kD.IDENTIFIER.test(n))return new ci(`${n}`);throw Error(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}kD.getEsmExportName=xJ;function aJ(n){return new ci(n.toString())}kD.regexpCode=aJ});var Xc=P((yD)=>{Object.defineProperty(yD,"__esModule",{value:!0});yD.ValueScope=yD.ValueScopeName=yD.Scope=yD.varKinds=yD.UsedValueState=void 0;var an=ne();class LD extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`);this.value=n.value}}var Kl;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed"})(Kl||(yD.UsedValueState=Kl={}));yD.varKinds={const:new an.Name("const"),let:new an.Name("let"),var:new an.Name("var")};class Jc{constructor({prefixes:n,parent:i}={}){this._names={},this._prefixes=n,this._parent=i}toName(n){return n instanceof an.Name?n:this.name(n)}name(n){return new an.Name(this._newName(n))}_newName(n){let i=this._names[n]||this._nameGroup(n);return`${n}${i.index++}`}_nameGroup(n){var i,r;if(((r=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||r===void 0?void 0:r.has(n))||this._prefixes&&!this._prefixes.has(n))throw Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}}yD.Scope=Jc;class Hc extends an.Name{constructor(n,i){super(i);this.prefix=n}setValue(n,{property:i,itemIndex:r}){this.value=n,this.scopePath=an._`.${new an.Name(i)}[${r}]`}}yD.ValueScopeName=Hc;var g8=an._`\n`;class ND extends Jc{constructor(n){super(n);this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?g8:an.nil}}get(){return this._scope}name(n){return new Hc(n,this._newName(n))}value(n,i){var r;if(i.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(n),{prefix:t}=o,e=(r=i.key)!==null&&r!==void 0?r:i.ref,u=this._values[t];if(u){let I=u.get(e);if(I)return I}else u=this._values[t]=new Map;u.set(e,o);let l=this._scope[t]||(this._scope[t]=[]),$=l.length;return l[$]=i.ref,o.setValue(i,{property:t,itemIndex:$}),o}getValue(n,i){let r=this._values[n];if(!r)return;return r.get(i)}scopeRefs(n,i=this._values){return this._reduceValues(i,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return an._`${n}${r.scopePath}`})}scopeCode(n=this._values,i,r){return this._reduceValues(n,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},i,r)}_reduceValues(n,i,r={},o){let t=an.nil;for(let e in n){let u=n[e];if(!u)continue;let l=r[e]=r[e]||new Map;u.forEach(($)=>{if(l.has($))return;l.set($,Kl.Started);let I=i($);if(I){let g=this.opts.es5?yD.varKinds.var:yD.varKinds.const;t=an._`${t}${g} ${$} = ${I};${this.opts._n}`}else if(I=o===null||o===void 0?void 0:o($))t=an._`${t}${I}${this.opts._n}`;else throw new LD($);l.set($,Kl.Completed)})}return t}}yD.ValueScope=ND});var M=P((sn)=>{Object.defineProperty(sn,"__esModule",{value:!0});sn.or=sn.and=sn.not=sn.CodeGen=sn.operators=sn.varKinds=sn.ValueScopeName=sn.ValueScope=sn.Scope=sn.Name=sn.regexpCode=sn.stringify=sn.getProperty=sn.nil=sn.strConcat=sn.str=sn._=void 0;var s=ne(),Ui=Xc(),vt=ne();Object.defineProperty(sn,"_",{enumerable:!0,get:function(){return vt._}});Object.defineProperty(sn,"str",{enumerable:!0,get:function(){return vt.str}});Object.defineProperty(sn,"strConcat",{enumerable:!0,get:function(){return vt.strConcat}});Object.defineProperty(sn,"nil",{enumerable:!0,get:function(){return vt.nil}});Object.defineProperty(sn,"getProperty",{enumerable:!0,get:function(){return vt.getProperty}});Object.defineProperty(sn,"stringify",{enumerable:!0,get:function(){return vt.stringify}});Object.defineProperty(sn,"regexpCode",{enumerable:!0,get:function(){return vt.regexpCode}});Object.defineProperty(sn,"Name",{enumerable:!0,get:function(){return vt.Name}});var El=Xc();Object.defineProperty(sn,"Scope",{enumerable:!0,get:function(){return El.Scope}});Object.defineProperty(sn,"ValueScope",{enumerable:!0,get:function(){return El.ValueScope}});Object.defineProperty(sn,"ValueScopeName",{enumerable:!0,get:function(){return El.ValueScopeName}});Object.defineProperty(sn,"varKinds",{enumerable:!0,get:function(){return El.varKinds}});sn.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class $t{optimizeNodes(){return this}optimizeNames(n,i){return this}}class jD extends $t{constructor(n,i,r){super();this.varKind=n,this.name=i,this.rhs=r}render({es5:n,_n:i}){let r=n?Ui.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+i}optimizeNames(n,i){if(!n[this.name.str])return;if(this.rhs)this.rhs=Xr(this.rhs,n,i);return this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class Yc extends $t{constructor(n,i,r){super();this.lhs=n,this.rhs=i,this.sideEffects=r}render({_n:n}){return`${this.lhs} = ${this.rhs};`+n}optimizeNames(n,i){if(this.lhs instanceof s.Name&&!n[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Xr(this.rhs,n,i),this}get names(){let n=this.lhs instanceof s.Name?{}:{...this.lhs.names};return _l(n,this.rhs)}}class WD extends Yc{constructor(n,i,r,o){super(n,r,o);this.op=i}render({_n:n}){return`${this.lhs} ${this.op}= ${this.rhs};`+n}}class JD extends $t{constructor(n){super();this.label=n,this.names={}}render({_n:n}){return`${this.label}:`+n}}class HD extends $t{constructor(n){super();this.label=n,this.names={}}render({_n:n}){return`break${this.label?` ${this.label}`:""};`+n}}class XD extends $t{constructor(n){super();this.error=n}render({_n:n}){return`throw ${this.error};`+n}get names(){return this.error.names}}class hD extends $t{constructor(n){super();this.code=n}render({_n:n}){return`${this.code};`+n}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(n,i){return this.code=Xr(this.code,n,i),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class Zl extends $t{constructor(n=[]){super();this.nodes=n}render(n){return this.nodes.reduce((i,r)=>i+r.render(n),"")}optimizeNodes(){let{nodes:n}=this,i=n.length;while(i--){let r=n[i].optimizeNodes();if(Array.isArray(r))n.splice(i,1,...r);else if(r)n[i]=r;else n.splice(i,1)}return n.length>0?this:void 0}optimizeNames(n,i){let{nodes:r}=this,o=r.length;while(o--){let t=r[o];if(t.optimizeNames(n,i))continue;c8(n,t.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((n,i)=>Xt(n,i.names),{})}}class It extends Zl{render(n){return"{"+n._n+super.render(n)+"}"+n._n}}class PD extends Zl{}class ie extends It{}ie.kind="else";class Vi extends It{constructor(n,i){super(i);this.condition=n}render(n){let i=`if(${this.condition})`+super.render(n);if(this.else)i+="else "+this.else.render(n);return i}optimizeNodes(){super.optimizeNodes();let n=this.condition;if(n===!0)return this.nodes;let i=this.else;if(i){let r=i.optimizeNodes();i=this.else=Array.isArray(r)?new ie(r):r}if(i){if(n===!1)return i instanceof Vi?i:i.nodes;if(this.nodes.length)return this;return new Vi(KD(n),i instanceof Vi?[i]:i.nodes)}if(n===!1||!this.nodes.length)return;return this}optimizeNames(n,i){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(n,i),!(super.optimizeNames(n,i)||this.else))return;return this.condition=Xr(this.condition,n,i),this}get names(){let n=super.names;if(_l(n,this.condition),this.else)Xt(n,this.else.names);return n}}Vi.kind="if";class Hr extends It{}Hr.kind="for";class YD extends Hr{constructor(n){super();this.iteration=n}render(n){return`for(${this.iteration})`+super.render(n)}optimizeNames(n,i){if(!super.optimizeNames(n,i))return;return this.iteration=Xr(this.iteration,n,i),this}get names(){return Xt(super.names,this.iteration.names)}}class pD extends Hr{constructor(n,i,r,o){super();this.varKind=n,this.name=i,this.from=r,this.to=o}render(n){let i=n.es5?Ui.varKinds.var:this.varKind,{name:r,from:o,to:t}=this;return`for(${i} ${r}=${o}; ${r}<${t}; ${r}++)`+super.render(n)}get names(){let n=_l(super.names,this.from);return _l(n,this.to)}}class hc extends Hr{constructor(n,i,r,o){super();this.loop=n,this.varKind=i,this.name=r,this.iterable=o}render(n){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(n)}optimizeNames(n,i){if(!super.optimizeNames(n,i))return;return this.iterable=Xr(this.iterable,n,i),this}get names(){return Xt(super.names,this.iterable.names)}}class Bl extends It{constructor(n,i,r){super();this.name=n,this.args=i,this.async=r}render(n){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(n)}}Bl.kind="func";class Vl extends Zl{render(n){return"return "+super.render(n)}}Vl.kind="return";class QD extends It{render(n){let i="try"+super.render(n);if(this.catch)i+=this.catch.render(n);if(this.finally)i+=this.finally.render(n);return i}optimizeNodes(){var n,i;return super.optimizeNodes(),(n=this.catch)===null||n===void 0||n.optimizeNodes(),(i=this.finally)===null||i===void 0||i.optimizeNodes(),this}optimizeNames(n,i){var r,o;return super.optimizeNames(n,i),(r=this.catch)===null||r===void 0||r.optimizeNames(n,i),(o=this.finally)===null||o===void 0||o.optimizeNames(n,i),this}get names(){let n=super.names;if(this.catch)Xt(n,this.catch.names);if(this.finally)Xt(n,this.finally.names);return n}}class Tl extends It{constructor(n){super();this.error=n}render(n){return`catch(${this.error})`+super.render(n)}}Tl.kind="catch";class ql extends It{render(n){return"finally"+super.render(n)}}ql.kind="finally";class FD{constructor(n,i={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...i,_n:i.lines?`
|
||
`:""},this._extScope=n,this._scope=new Ui.Scope({parent:n}),this._nodes=[new PD]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,i){let r=this._extScope.value(n,i);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(n,i){return this._extScope.getValue(n,i)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,i,r,o){let t=this._scope.toName(i);if(r!==void 0&&o)this._constants[t.str]=r;return this._leafNode(new jD(n,t,r)),t}const(n,i,r){return this._def(Ui.varKinds.const,n,i,r)}let(n,i,r){return this._def(Ui.varKinds.let,n,i,r)}var(n,i,r){return this._def(Ui.varKinds.var,n,i,r)}assign(n,i,r){return this._leafNode(new Yc(n,i,r))}add(n,i){return this._leafNode(new WD(n,sn.operators.ADD,i))}code(n){if(typeof n=="function")n();else if(n!==s.nil)this._leafNode(new hD(n));return this}object(...n){let i=["{"];for(let[r,o]of n){if(i.length>1)i.push(",");if(i.push(r),r!==o||this.opts.es5)i.push(":"),(0,s.addCodeArg)(i,o)}return i.push("}"),new s._Code(i)}if(n,i,r){if(this._blockNode(new Vi(n)),i&&r)this.code(i).else().code(r).endIf();else if(i)this.code(i).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(n){return this._elseNode(new Vi(n))}else(){return this._elseNode(new ie)}endIf(){return this._endBlockNode(Vi,ie)}_for(n,i){if(this._blockNode(n),i)this.code(i).endFor();return this}for(n,i){return this._for(new YD(n),i)}forRange(n,i,r,o,t=this.opts.es5?Ui.varKinds.var:Ui.varKinds.let){let e=this._scope.toName(n);return this._for(new pD(t,e,i,r),()=>o(e))}forOf(n,i,r,o=Ui.varKinds.const){let t=this._scope.toName(n);if(this.opts.es5){let e=i instanceof s.Name?i:this.var("_arr",i);return this.forRange("_i",0,s._`${e}.length`,(u)=>{this.var(t,s._`${e}[${u}]`),r(t)})}return this._for(new hc("of",o,t,i),()=>r(t))}forIn(n,i,r,o=this.opts.es5?Ui.varKinds.var:Ui.varKinds.const){if(this.opts.ownProperties)return this.forOf(n,s._`Object.keys(${i})`,r);let t=this._scope.toName(n);return this._for(new hc("in",o,t,i),()=>r(t))}endFor(){return this._endBlockNode(Hr)}label(n){return this._leafNode(new JD(n))}break(n){return this._leafNode(new HD(n))}return(n){let i=new Vl;if(this._blockNode(i),this.code(n),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Vl)}try(n,i,r){if(!i&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new QD;if(this._blockNode(o),this.code(n),i){let t=this.name("e");this._currNode=o.catch=new Tl(t),i(t)}if(r)this._currNode=o.finally=new ql,this.code(r);return this._endBlockNode(Tl,ql)}throw(n){return this._leafNode(new XD(n))}block(n,i){if(this._blockStarts.push(this._nodes.length),n)this.code(n).endBlock(i);return this}endBlock(n){let i=this._blockStarts.pop();if(i===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-i;if(r<0||n!==void 0&&r!==n)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${n} expected`);return this._nodes.length=i,this}func(n,i=s.nil,r,o){if(this._blockNode(new Bl(n,i,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Bl)}optimize(n=1){while(n-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(n){return this._currNode.nodes.push(n),this}_blockNode(n){this._currNode.nodes.push(n),this._nodes.push(n)}_endBlockNode(n,i){let r=this._currNode;if(r instanceof n||i&&r instanceof i)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${i?`${n.kind}/${i.kind}`:n.kind}"`)}_elseNode(n){let i=this._currNode;if(!(i instanceof Vi))throw Error('CodeGen: "else" without "if"');return this._currNode=i.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let i=this._nodes;i[i.length-1]=n}}sn.CodeGen=FD;function Xt(n,i){for(let r in i)n[r]=(n[r]||0)+(i[r]||0);return n}function _l(n,i){return i instanceof s._CodeOrName?Xt(n,i.names):n}function Xr(n,i,r){if(n instanceof s.Name)return o(n);if(!t(n))return n;return new s._Code(n._items.reduce((e,u)=>{if(u instanceof s.Name)u=o(u);if(u instanceof s._Code)e.push(...u._items);else e.push(u);return e},[]));function o(e){let u=r[e.str];if(u===void 0||i[e.str]!==1)return e;return delete i[e.str],u}function t(e){return e instanceof s._Code&&e._items.some((u)=>u instanceof s.Name&&i[u.str]===1&&r[u.str]!==void 0)}}function c8(n,i){for(let r in i)n[r]=(n[r]||0)-(i[r]||0)}function KD(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:s._`!${Pc(n)}`}sn.not=KD;var U8=BD(sn.operators.AND);function D8(...n){return n.reduce(U8)}sn.and=D8;var S8=BD(sn.operators.OR);function A8(...n){return n.reduce(S8)}sn.or=A8;function BD(n){return(i,r)=>i===s.nil?r:r===s.nil?i:s._`${Pc(i)} ${n} ${Pc(r)}`}function Pc(n){return n instanceof s.Name?n:s._`(${n})`}});var nn=P((zD)=>{Object.defineProperty(zD,"__esModule",{value:!0});zD.checkStrictMode=zD.getErrorPath=zD.Type=zD.useFunc=zD.setEvaluated=zD.evaluatedPropsToName=zD.mergeEvaluated=zD.eachItem=zD.unescapeJsonPointer=zD.escapeJsonPointer=zD.escapeFragment=zD.unescapeFragment=zD.schemaRefOrVal=zD.schemaHasRulesButRef=zD.schemaHasRules=zD.checkUnknownRules=zD.alwaysValidSchema=zD.toHash=void 0;var cn=M(),L8=ne();function N8(n){let i={};for(let r of n)i[r]=!0;return i}zD.toHash=N8;function y8(n,i){if(typeof i=="boolean")return i;if(Object.keys(i).length===0)return!0;return _D(n,i),!ED(i,n.self.RULES.all)}zD.alwaysValidSchema=y8;function _D(n,i=n.schema){let{opts:r,self:o}=n;if(!r.strictSchema)return;if(typeof i==="boolean")return;let t=o.RULES.keywords;for(let e in i)if(!t[e])MD(n,`unknown keyword: "${e}"`)}zD.checkUnknownRules=_D;function ED(n,i){if(typeof n=="boolean")return!n;for(let r in n)if(i[r])return!0;return!1}zD.schemaHasRules=ED;function G8(n,i){if(typeof n=="boolean")return!n;for(let r in n)if(r!=="$ref"&&i.all[r])return!0;return!1}zD.schemaHasRulesButRef=G8;function j8({topSchemaRef:n,schemaPath:i},r,o,t){if(!t){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return cn._`${r}`}return cn._`${n}${i}${(0,cn.getProperty)(o)}`}zD.schemaRefOrVal=j8;function W8(n){return ZD(decodeURIComponent(n))}zD.unescapeFragment=W8;function J8(n){return encodeURIComponent(Qc(n))}zD.escapeFragment=J8;function Qc(n){if(typeof n=="number")return`${n}`;return n.replace(/~/g,"~0").replace(/\//g,"~1")}zD.escapeJsonPointer=Qc;function ZD(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}zD.unescapeJsonPointer=ZD;function H8(n,i){if(Array.isArray(n))for(let r of n)i(r);else i(n)}zD.eachItem=H8;function TD({mergeNames:n,mergeToName:i,mergeValues:r,resultToName:o}){return(t,e,u,l)=>{let $=u===void 0?e:u instanceof cn.Name?(e instanceof cn.Name?n(t,e,u):i(t,e,u),u):e instanceof cn.Name?(i(t,u,e),e):r(e,u);return l===cn.Name&&!($ instanceof cn.Name)?o(t,$):$}}zD.mergeEvaluated={props:TD({mergeNames:(n,i,r)=>n.if(cn._`${r} !== true && ${i} !== undefined`,()=>{n.if(cn._`${i} === true`,()=>n.assign(r,!0),()=>n.assign(r,cn._`${r} || {}`).code(cn._`Object.assign(${r}, ${i})`))}),mergeToName:(n,i,r)=>n.if(cn._`${r} !== true`,()=>{if(i===!0)n.assign(r,!0);else n.assign(r,cn._`${r} || {}`),Fc(n,r,i)}),mergeValues:(n,i)=>n===!0?!0:{...n,...i},resultToName:mD}),items:TD({mergeNames:(n,i,r)=>n.if(cn._`${r} !== true && ${i} !== undefined`,()=>n.assign(r,cn._`${i} === true ? true : ${r} > ${i} ? ${r} : ${i}`)),mergeToName:(n,i,r)=>n.if(cn._`${r} !== true`,()=>n.assign(r,i===!0?!0:cn._`${r} > ${i} ? ${r} : ${i}`)),mergeValues:(n,i)=>n===!0?!0:Math.max(n,i),resultToName:(n,i)=>n.var("items",i)})};function mD(n,i){if(i===!0)return n.var("props",!0);let r=n.var("props",cn._`{}`);if(i!==void 0)Fc(n,r,i);return r}zD.evaluatedPropsToName=mD;function Fc(n,i,r){Object.keys(r).forEach((o)=>n.assign(cn._`${i}${(0,cn.getProperty)(o)}`,!0))}zD.setEvaluated=Fc;var qD={};function X8(n,i){return n.scopeValue("func",{ref:i,code:qD[i.code]||(qD[i.code]=new L8._Code(i.code))})}zD.useFunc=X8;var pc;(function(n){n[n.Num=0]="Num",n[n.Str=1]="Str"})(pc||(zD.Type=pc={}));function h8(n,i,r){if(n instanceof cn.Name){let o=i===pc.Num;return r?o?cn._`"[" + ${n} + "]"`:cn._`"['" + ${n} + "']"`:o?cn._`"/" + ${n}`:cn._`"/" + ${n}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,cn.getProperty)(n).toString():"/"+Qc(n)}zD.getErrorPath=h8;function MD(n,i,r=n.opts.strictSchema){if(!r)return;if(i=`strict mode: ${i}`,r===!0)throw Error(i);n.self.logger.warn(i)}zD.checkStrictMode=MD});var Ti=P((RD)=>{Object.defineProperty(RD,"__esModule",{value:!0});var Vn=M(),R8={data:new Vn.Name("data"),valCxt:new Vn.Name("valCxt"),instancePath:new Vn.Name("instancePath"),parentData:new Vn.Name("parentData"),parentDataProperty:new Vn.Name("parentDataProperty"),rootData:new Vn.Name("rootData"),dynamicAnchors:new Vn.Name("dynamicAnchors"),vErrors:new Vn.Name("vErrors"),errors:new Vn.Name("errors"),this:new Vn.Name("this"),self:new Vn.Name("self"),scope:new Vn.Name("scope"),json:new Vn.Name("json"),jsonPos:new Vn.Name("jsonPos"),jsonLen:new Vn.Name("jsonLen"),jsonPart:new Vn.Name("jsonPart")};RD.default=R8});var te=P((n1)=>{Object.defineProperty(n1,"__esModule",{value:!0});n1.extendErrors=n1.resetErrorsCount=n1.reportExtraError=n1.reportError=n1.keyword$DataError=n1.keywordError=void 0;var tn=M(),Ml=nn(),mn=Ti();n1.keywordError={message:({keyword:n})=>tn.str`must pass "${n}" keyword validation`};n1.keyword$DataError={message:({keyword:n,schemaType:i})=>i?tn.str`"${n}" keyword must be ${i} ($data)`:tn.str`"${n}" keyword is invalid ($data)`};function a8(n,i=n1.keywordError,r,o){let{it:t}=n,{gen:e,compositeRule:u,allErrors:l}=t,$=sD(n,i,r);if(o!==null&&o!==void 0?o:u||l)xD(e,$);else aD(t,tn._`[${$}]`)}n1.reportError=a8;function s8(n,i=n1.keywordError,r){let{it:o}=n,{gen:t,compositeRule:e,allErrors:u}=o,l=sD(n,i,r);if(xD(t,l),!(e||u))aD(o,mn.default.vErrors)}n1.reportExtraError=s8;function nH(n,i){n.assign(mn.default.errors,i),n.if(tn._`${mn.default.vErrors} !== null`,()=>n.if(i,()=>n.assign(tn._`${mn.default.vErrors}.length`,i),()=>n.assign(mn.default.vErrors,null)))}n1.resetErrorsCount=nH;function iH({gen:n,keyword:i,schemaValue:r,data:o,errsCount:t,it:e}){if(t===void 0)throw Error("ajv implementation error");let u=n.name("err");n.forRange("i",t,mn.default.errors,(l)=>{if(n.const(u,tn._`${mn.default.vErrors}[${l}]`),n.if(tn._`${u}.instancePath === undefined`,()=>n.assign(tn._`${u}.instancePath`,(0,tn.strConcat)(mn.default.instancePath,e.errorPath))),n.assign(tn._`${u}.schemaPath`,tn.str`${e.errSchemaPath}/${i}`),e.opts.verbose)n.assign(tn._`${u}.schema`,r),n.assign(tn._`${u}.data`,o)})}n1.extendErrors=iH;function xD(n,i){let r=n.const("err",i);n.if(tn._`${mn.default.vErrors} === null`,()=>n.assign(mn.default.vErrors,tn._`[${r}]`),tn._`${mn.default.vErrors}.push(${r})`),n.code(tn._`${mn.default.errors}++`)}function aD(n,i){let{gen:r,validateName:o,schemaEnv:t}=n;if(t.$async)r.throw(tn._`new ${n.ValidationError}(${i})`);else r.assign(tn._`${o}.errors`,i),r.return(!1)}var ht={keyword:new tn.Name("keyword"),schemaPath:new tn.Name("schemaPath"),params:new tn.Name("params"),propertyName:new tn.Name("propertyName"),message:new tn.Name("message"),schema:new tn.Name("schema"),parentSchema:new tn.Name("parentSchema")};function sD(n,i,r){let{createErrors:o}=n.it;if(o===!1)return tn._`{}`;return tH(n,i,r)}function tH(n,i,r={}){let{gen:o,it:t}=n,e=[rH(t,r),oH(n,r)];return eH(n,i,e),o.object(...e)}function rH({errorPath:n},{instancePath:i}){let r=i?tn.str`${n}${(0,Ml.getErrorPath)(i,Ml.Type.Str)}`:n;return[mn.default.instancePath,(0,tn.strConcat)(mn.default.instancePath,r)]}function oH({keyword:n,it:{errSchemaPath:i}},{schemaPath:r,parentSchema:o}){let t=o?i:tn.str`${i}/${n}`;if(r)t=tn.str`${t}${(0,Ml.getErrorPath)(r,Ml.Type.Str)}`;return[ht.schemaPath,t]}function eH(n,{params:i,message:r},o){let{keyword:t,data:e,schemaValue:u,it:l}=n,{opts:$,propertyName:I,topSchemaRef:g,schemaPath:b}=l;if(o.push([ht.keyword,t],[ht.params,typeof i=="function"?i(n):i||tn._`{}`]),$.messages)o.push([ht.message,typeof r=="function"?r(n):r]);if($.verbose)o.push([ht.schema,u],[ht.parentSchema,tn._`${g}${b}`],[mn.default.data,e]);if(I)o.push([ht.propertyName,I])}});var e1=P((r1)=>{Object.defineProperty(r1,"__esModule",{value:!0});r1.boolOrEmptySchema=r1.topBoolOrEmptySchema=void 0;var IH=te(),gH=M(),bH=Ti(),wH={message:"boolean schema is false"};function fH(n){let{gen:i,schema:r,validateName:o}=n;if(r===!1)t1(n,!1);else if(typeof r=="object"&&r.$async===!0)i.return(bH.default.data);else i.assign(gH._`${o}.errors`,null),i.return(!0)}r1.topBoolOrEmptySchema=fH;function cH(n,i){let{gen:r,schema:o}=n;if(o===!1)r.var(i,!1),t1(n);else r.var(i,!0)}r1.boolOrEmptySchema=cH;function t1(n,i){let{gen:r,data:o}=n,t={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:n};(0,IH.reportError)(t,wH,void 0,i)}});var Bc=P((u1)=>{Object.defineProperty(u1,"__esModule",{value:!0});u1.getRules=u1.isJSONType=void 0;var DH=["string","number","integer","boolean","null","object","array"],SH=new Set(DH);function AH(n){return typeof n=="string"&&SH.has(n)}u1.isJSONType=AH;function OH(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}u1.getRules=OH});var Vc=P((I1)=>{Object.defineProperty(I1,"__esModule",{value:!0});I1.shouldUseRule=I1.shouldUseGroup=I1.schemaHasRulesForType=void 0;function dH({schema:n,self:i},r){let o=i.RULES.types[r];return o&&o!==!0&&v1(n,o)}I1.schemaHasRulesForType=dH;function v1(n,i){return i.rules.some((r)=>$1(n,r))}I1.shouldUseGroup=v1;function $1(n,i){var r;return n[i.keyword]!==void 0||((r=i.definition.implements)===null||r===void 0?void 0:r.some((o)=>n[o]!==void 0))}I1.shouldUseRule=$1});var re=P((c1)=>{Object.defineProperty(c1,"__esModule",{value:!0});c1.reportTypeError=c1.checkDataTypes=c1.checkDataType=c1.coerceAndCheckDataType=c1.getJSONTypes=c1.getSchemaTypes=c1.DataType=void 0;var yH=Bc(),GH=Vc(),jH=te(),m=M(),b1=nn(),hr;(function(n){n[n.Correct=0]="Correct",n[n.Wrong=1]="Wrong"})(hr||(c1.DataType=hr={}));function WH(n){let i=w1(n.type);if(i.includes("null")){if(n.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!i.length&&n.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(n.nullable===!0)i.push("null")}return i}c1.getSchemaTypes=WH;function w1(n){let i=Array.isArray(n)?n:n?[n]:[];if(i.every(yH.isJSONType))return i;throw Error("type must be JSONType or JSONType[]: "+i.join(","))}c1.getJSONTypes=w1;function JH(n,i){let{gen:r,data:o,opts:t}=n,e=HH(i,t.coerceTypes),u=i.length>0&&!(e.length===0&&i.length===1&&(0,GH.schemaHasRulesForType)(n,i[0]));if(u){let l=qc(i,o,t.strictNumbers,hr.Wrong);r.if(l,()=>{if(e.length)XH(n,i,e);else _c(n)})}return u}c1.coerceAndCheckDataType=JH;var f1=new Set(["string","number","integer","boolean","null"]);function HH(n,i){return i?n.filter((r)=>f1.has(r)||i==="array"&&r==="array"):[]}function XH(n,i,r){let{gen:o,data:t,opts:e}=n,u=o.let("dataType",m._`typeof ${t}`),l=o.let("coerced",m._`undefined`);if(e.coerceTypes==="array")o.if(m._`${u} == 'object' && Array.isArray(${t}) && ${t}.length == 1`,()=>o.assign(t,m._`${t}[0]`).assign(u,m._`typeof ${t}`).if(qc(i,t,e.strictNumbers),()=>o.assign(l,t)));o.if(m._`${l} !== undefined`);for(let I of r)if(f1.has(I)||I==="array"&&e.coerceTypes==="array")$(I);o.else(),_c(n),o.endIf(),o.if(m._`${l} !== undefined`,()=>{o.assign(t,l),hH(n,l)});function $(I){switch(I){case"string":o.elseIf(m._`${u} == "number" || ${u} == "boolean"`).assign(l,m._`"" + ${t}`).elseIf(m._`${t} === null`).assign(l,m._`""`);return;case"number":o.elseIf(m._`${u} == "boolean" || ${t} === null
|
||
|| (${u} == "string" && ${t} && ${t} == +${t})`).assign(l,m._`+${t}`);return;case"integer":o.elseIf(m._`${u} === "boolean" || ${t} === null
|
||
|| (${u} === "string" && ${t} && ${t} == +${t} && !(${t} % 1))`).assign(l,m._`+${t}`);return;case"boolean":o.elseIf(m._`${t} === "false" || ${t} === 0 || ${t} === null`).assign(l,!1).elseIf(m._`${t} === "true" || ${t} === 1`).assign(l,!0);return;case"null":o.elseIf(m._`${t} === "" || ${t} === 0 || ${t} === false`),o.assign(l,null);return;case"array":o.elseIf(m._`${u} === "string" || ${u} === "number"
|
||
|| ${u} === "boolean" || ${t} === null`).assign(l,m._`[${t}]`)}}}function hH({gen:n,parentData:i,parentDataProperty:r},o){n.if(m._`${i} !== undefined`,()=>n.assign(m._`${i}[${r}]`,o))}function Tc(n,i,r,o=hr.Correct){let t=o===hr.Correct?m.operators.EQ:m.operators.NEQ,e;switch(n){case"null":return m._`${i} ${t} null`;case"array":e=m._`Array.isArray(${i})`;break;case"object":e=m._`${i} && typeof ${i} == "object" && !Array.isArray(${i})`;break;case"integer":e=u(m._`!(${i} % 1) && !isNaN(${i})`);break;case"number":e=u();break;default:return m._`typeof ${i} ${t} ${n}`}return o===hr.Correct?e:(0,m.not)(e);function u(l=m.nil){return(0,m.and)(m._`typeof ${i} == "number"`,l,r?m._`isFinite(${i})`:m.nil)}}c1.checkDataType=Tc;function qc(n,i,r,o){if(n.length===1)return Tc(n[0],i,r,o);let t,e=(0,b1.toHash)(n);if(e.array&&e.object){let u=m._`typeof ${i} != "object"`;t=e.null?u:m._`!${i} || ${u}`,delete e.null,delete e.array,delete e.object}else t=m.nil;if(e.number)delete e.integer;for(let u in e)t=(0,m.and)(t,Tc(u,i,r,o));return t}c1.checkDataTypes=qc;var PH={message:({schema:n})=>`must be ${n}`,params:({schema:n,schemaValue:i})=>typeof n=="string"?m._`{type: ${n}}`:m._`{type: ${i}}`};function _c(n){let i=YH(n);(0,jH.reportError)(i,PH)}c1.reportTypeError=_c;function YH(n){let{gen:i,data:r,schema:o}=n,t=(0,b1.schemaRefOrVal)(n,o,"type");return{gen:i,keyword:"type",data:r,schema:o.type,schemaCode:t,schemaValue:t,parentSchema:o,params:{},it:n}}});var O1=P((S1)=>{Object.defineProperty(S1,"__esModule",{value:!0});S1.assignDefaults=void 0;var Pr=M(),TH=nn();function qH(n,i){let{properties:r,items:o}=n.schema;if(i==="object"&&r)for(let t in r)D1(n,t,r[t].default);else if(i==="array"&&Array.isArray(o))o.forEach((t,e)=>D1(n,e,t.default))}S1.assignDefaults=qH;function D1(n,i,r){let{gen:o,compositeRule:t,data:e,opts:u}=n;if(r===void 0)return;let l=Pr._`${e}${(0,Pr.getProperty)(i)}`;if(t){(0,TH.checkStrictMode)(n,`default is ignored for: ${l}`);return}let $=Pr._`${l} === undefined`;if(u.useDefaults==="empty")$=Pr._`${$} || ${l} === null || ${l} === ""`;o.if($,Pr._`${l} = ${(0,Pr.stringify)(r)}`)}});var Ii=P((L1)=>{Object.defineProperty(L1,"__esModule",{value:!0});L1.validateUnion=L1.validateArray=L1.usePattern=L1.callValidateCode=L1.schemaProperties=L1.allSchemaProperties=L1.noPropertyInData=L1.propertyInData=L1.isOwnProperty=L1.hasPropFunc=L1.reportMissingProp=L1.checkMissingProp=L1.checkReportMissingProp=void 0;var Sn=M(),Ec=nn(),gt=Ti(),_H=nn();function EH(n,i){let{gen:r,data:o,it:t}=n;r.if(mc(r,o,i,t.opts.ownProperties),()=>{n.setParams({missingProperty:Sn._`${i}`},!0),n.error()})}L1.checkReportMissingProp=EH;function ZH({gen:n,data:i,it:{opts:r}},o,t){return(0,Sn.or)(...o.map((e)=>(0,Sn.and)(mc(n,i,e,r.ownProperties),Sn._`${t} = ${e}`)))}L1.checkMissingProp=ZH;function mH(n,i){n.setParams({missingProperty:i},!0),n.error()}L1.reportMissingProp=mH;function k1(n){return n.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Sn._`Object.prototype.hasOwnProperty`})}L1.hasPropFunc=k1;function Zc(n,i,r){return Sn._`${k1(n)}.call(${i}, ${r})`}L1.isOwnProperty=Zc;function MH(n,i,r,o){let t=Sn._`${i}${(0,Sn.getProperty)(r)} !== undefined`;return o?Sn._`${t} && ${Zc(n,i,r)}`:t}L1.propertyInData=MH;function mc(n,i,r,o){let t=Sn._`${i}${(0,Sn.getProperty)(r)} === undefined`;return o?(0,Sn.or)(t,(0,Sn.not)(Zc(n,i,r))):t}L1.noPropertyInData=mc;function d1(n){return n?Object.keys(n).filter((i)=>i!=="__proto__"):[]}L1.allSchemaProperties=d1;function zH(n,i){return d1(i).filter((r)=>!(0,Ec.alwaysValidSchema)(n,i[r]))}L1.schemaProperties=zH;function CH({schemaCode:n,data:i,it:{gen:r,topSchemaRef:o,schemaPath:t,errorPath:e},it:u},l,$,I){let g=I?Sn._`${n}, ${i}, ${o}${t}`:i,b=[[gt.default.instancePath,(0,Sn.strConcat)(gt.default.instancePath,e)],[gt.default.parentData,u.parentData],[gt.default.parentDataProperty,u.parentDataProperty],[gt.default.rootData,gt.default.rootData]];if(u.opts.dynamicRef)b.push([gt.default.dynamicAnchors,gt.default.dynamicAnchors]);let w=Sn._`${g}, ${r.object(...b)}`;return $!==Sn.nil?Sn._`${l}.call(${$}, ${w})`:Sn._`${l}(${w})`}L1.callValidateCode=CH;var RH=Sn._`new RegExp`;function xH({gen:n,it:{opts:i}},r){let o=i.unicodeRegExp?"u":"",{regExp:t}=i.code,e=t(r,o);return n.scopeValue("pattern",{key:e.toString(),ref:e,code:Sn._`${t.code==="new RegExp"?RH:(0,_H.useFunc)(n,t)}(${r}, ${o})`})}L1.usePattern=xH;function aH(n){let{gen:i,data:r,keyword:o,it:t}=n,e=i.name("valid");if(t.allErrors){let l=i.let("valid",!0);return u(()=>i.assign(l,!1)),l}return i.var(e,!0),u(()=>i.break()),e;function u(l){let $=i.const("len",Sn._`${r}.length`);i.forRange("i",0,$,(I)=>{n.subschema({keyword:o,dataProp:I,dataPropType:Ec.Type.Num},e),i.if((0,Sn.not)(e),l)})}}L1.validateArray=aH;function sH(n){let{gen:i,schema:r,keyword:o,it:t}=n;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(($)=>(0,Ec.alwaysValidSchema)(t,$))&&!t.opts.unevaluated)return;let u=i.let("valid",!1),l=i.name("_valid");i.block(()=>r.forEach(($,I)=>{let g=n.subschema({keyword:o,schemaProp:I,compositeRule:!0},l);if(i.assign(u,Sn._`${u} || ${l}`),!n.mergeValidEvaluated(g,l))i.if((0,Sn.not)(u))})),n.result(u,()=>n.reset(),()=>n.error(!0))}L1.validateUnion=sH});var J1=P((j1)=>{Object.defineProperty(j1,"__esModule",{value:!0});j1.validateKeywordUsage=j1.validSchemaType=j1.funcKeywordCode=j1.macroKeywordCode=void 0;var Mn=M(),Pt=Ti(),b9=Ii(),w9=te();function f9(n,i){let{gen:r,keyword:o,schema:t,parentSchema:e,it:u}=n,l=i.macro.call(u.self,t,e,u),$=G1(r,o,l);if(u.opts.validateSchema!==!1)u.self.validateSchema(l,!0);let I=r.name("valid");n.subschema({schema:l,schemaPath:Mn.nil,errSchemaPath:`${u.errSchemaPath}/${o}`,topSchemaRef:$,compositeRule:!0},I),n.pass(I,()=>n.error(!0))}j1.macroKeywordCode=f9;function c9(n,i){var r;let{gen:o,keyword:t,schema:e,parentSchema:u,$data:l,it:$}=n;D9($,i);let I=!l&&i.compile?i.compile.call($.self,e,u,$):i.validate,g=G1(o,t,I),b=o.let("valid");n.block$data(b,w),n.ok((r=i.valid)!==null&&r!==void 0?r:b);function w(){if(i.errors===!1){if(S(),i.modifying)y1(n);k(()=>n.error())}else{let d=i.async?f():c();if(i.modifying)y1(n);k(()=>U9(n,d))}}function f(){let d=o.let("ruleErrs",null);return o.try(()=>S(Mn._`await `),(p)=>o.assign(b,!1).if(Mn._`${p} instanceof ${$.ValidationError}`,()=>o.assign(d,Mn._`${p}.errors`),()=>o.throw(p))),d}function c(){let d=Mn._`${g}.errors`;return o.assign(d,null),S(Mn.nil),d}function S(d=i.async?Mn._`await `:Mn.nil){let p=$.opts.passContext?Pt.default.this:Pt.default.self,h=!(("compile"in i)&&!l||i.schema===!1);o.assign(b,Mn._`${d}${(0,b9.callValidateCode)(n,g,p,h)}`,i.modifying)}function k(d){var p;o.if((0,Mn.not)((p=i.valid)!==null&&p!==void 0?p:b),d)}}j1.funcKeywordCode=c9;function y1(n){let{gen:i,data:r,it:o}=n;i.if(o.parentData,()=>i.assign(r,Mn._`${o.parentData}[${o.parentDataProperty}]`))}function U9(n,i){let{gen:r}=n;r.if(Mn._`Array.isArray(${i})`,()=>{r.assign(Pt.default.vErrors,Mn._`${Pt.default.vErrors} === null ? ${i} : ${Pt.default.vErrors}.concat(${i})`).assign(Pt.default.errors,Mn._`${Pt.default.vErrors}.length`),(0,w9.extendErrors)(n)},()=>n.error())}function D9({schemaEnv:n},i){if(i.async&&!n.$async)throw Error("async keyword in sync schema")}function G1(n,i,r){if(r===void 0)throw Error(`keyword "${i}" failed to compile`);return n.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Mn.stringify)(r)})}function S9(n,i,r=!1){return!i.length||i.some((o)=>o==="array"?Array.isArray(n):o==="object"?n&&typeof n=="object"&&!Array.isArray(n):typeof n==o||r&&typeof n>"u")}j1.validSchemaType=S9;function A9({schema:n,opts:i,self:r,errSchemaPath:o},t,e){if(Array.isArray(t.keyword)?!t.keyword.includes(e):t.keyword!==e)throw Error("ajv implementation error");let u=t.dependencies;if(u===null||u===void 0?void 0:u.some((l)=>!Object.prototype.hasOwnProperty.call(n,l)))throw Error(`parent schema must have dependencies of ${e}: ${u.join(",")}`);if(t.validateSchema){if(!t.validateSchema(n[e])){let $=`keyword "${e}" value is invalid at path "${o}": `+r.errorsText(t.validateSchema.errors);if(i.validateSchema==="log")r.logger.error($);else throw Error($)}}}j1.validateKeywordUsage=A9});var P1=P((X1)=>{Object.defineProperty(X1,"__esModule",{value:!0});X1.extendSubschemaMode=X1.extendSubschemaData=X1.getSubschema=void 0;var Ji=M(),H1=nn();function L9(n,{keyword:i,schemaProp:r,schema:o,schemaPath:t,errSchemaPath:e,topSchemaRef:u}){if(i!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){let l=n.schema[i];return r===void 0?{schema:l,schemaPath:Ji._`${n.schemaPath}${(0,Ji.getProperty)(i)}`,errSchemaPath:`${n.errSchemaPath}/${i}`}:{schema:l[r],schemaPath:Ji._`${n.schemaPath}${(0,Ji.getProperty)(i)}${(0,Ji.getProperty)(r)}`,errSchemaPath:`${n.errSchemaPath}/${i}/${(0,H1.escapeFragment)(r)}`}}if(o!==void 0){if(t===void 0||e===void 0||u===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:t,topSchemaRef:u,errSchemaPath:e}}throw Error('either "keyword" or "schema" must be passed')}X1.getSubschema=L9;function N9(n,i,{dataProp:r,dataPropType:o,data:t,dataTypes:e,propertyName:u}){if(t!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:l}=i;if(r!==void 0){let{errorPath:I,dataPathArr:g,opts:b}=i,w=l.let("data",Ji._`${i.data}${(0,Ji.getProperty)(r)}`,!0);$(w),n.errorPath=Ji.str`${I}${(0,H1.getErrorPath)(r,o,b.jsPropertySyntax)}`,n.parentDataProperty=Ji._`${r}`,n.dataPathArr=[...g,n.parentDataProperty]}if(t!==void 0){let I=t instanceof Ji.Name?t:l.let("data",t,!0);if($(I),u!==void 0)n.propertyName=u}if(e)n.dataTypes=e;function $(I){n.data=I,n.dataLevel=i.dataLevel+1,n.dataTypes=[],i.definedProperties=new Set,n.parentData=i.data,n.dataNames=[...i.dataNames,I]}}X1.extendSubschemaData=N9;function y9(n,{jtdDiscriminator:i,jtdMetadata:r,compositeRule:o,createErrors:t,allErrors:e}){if(o!==void 0)n.compositeRule=o;if(t!==void 0)n.createErrors=t;if(e!==void 0)n.allErrors=e;n.jtdDiscriminator=i,n.jtdMetadata=r}X1.extendSubschemaMode=y9});var Mc=P((tE,Y1)=>{Y1.exports=function n(i,r){if(i===r)return!0;if(i&&r&&typeof i=="object"&&typeof r=="object"){if(i.constructor!==r.constructor)return!1;var o,t,e;if(Array.isArray(i)){if(o=i.length,o!=r.length)return!1;for(t=o;t--!==0;)if(!n(i[t],r[t]))return!1;return!0}if(i.constructor===RegExp)return i.source===r.source&&i.flags===r.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===r.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===r.toString();if(e=Object.keys(i),o=e.length,o!==Object.keys(r).length)return!1;for(t=o;t--!==0;)if(!Object.prototype.hasOwnProperty.call(r,e[t]))return!1;for(t=o;t--!==0;){var u=e[t];if(!n(i[u],r[u]))return!1}return!0}return i!==i&&r!==r}});var Q1=P((rE,p1)=>{var bt=p1.exports=function(n,i,r){if(typeof i=="function")r=i,i={};r=i.cb||r;var o=typeof r=="function"?r:r.pre||function(){},t=r.post||function(){};zl(i,o,t,n,"",n)};bt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};bt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};bt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};bt.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 zl(n,i,r,o,t,e,u,l,$,I){if(o&&typeof o=="object"&&!Array.isArray(o)){i(o,t,e,u,l,$,I);for(var g in o){var b=o[g];if(Array.isArray(b)){if(g in bt.arrayKeywords)for(var w=0;w<b.length;w++)zl(n,i,r,b[w],t+"/"+g+"/"+w,e,t,g,o,w)}else if(g in bt.propsKeywords){if(b&&typeof b=="object")for(var f in b)zl(n,i,r,b[f],t+"/"+g+"/"+W9(f),e,t,g,o,f)}else if(g in bt.keywords||n.allKeys&&!(g in bt.skipKeywords))zl(n,i,r,b,t+"/"+g,e,t,g,o)}r(o,t,e,u,l,$,I)}}function W9(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}});var oe=P((V1)=>{Object.defineProperty(V1,"__esModule",{value:!0});V1.getSchemaRefs=V1.resolveUrl=V1.normalizeId=V1._getFullPath=V1.getFullPath=V1.inlineRef=void 0;var J9=nn(),H9=Mc(),X9=Q1(),h9=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function P9(n,i=!0){if(typeof n=="boolean")return!0;if(i===!0)return!zc(n);if(!i)return!1;return F1(n)<=i}V1.inlineRef=P9;var Y9=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function zc(n){for(let i in n){if(Y9.has(i))return!0;let r=n[i];if(Array.isArray(r)&&r.some(zc))return!0;if(typeof r=="object"&&zc(r))return!0}return!1}function F1(n){let i=0;for(let r in n){if(r==="$ref")return 1/0;if(i++,h9.has(r))continue;if(typeof n[r]=="object")(0,J9.eachItem)(n[r],(o)=>i+=F1(o));if(i===1/0)return 1/0}return i}function K1(n,i="",r){if(r!==!1)i=Yr(i);let o=n.parse(i);return B1(n,o)}V1.getFullPath=K1;function B1(n,i){return n.serialize(i).split("#")[0]+"#"}V1._getFullPath=B1;var p9=/#\/?$/;function Yr(n){return n?n.replace(p9,""):""}V1.normalizeId=Yr;function Q9(n,i,r){return r=Yr(r),n.resolve(i,r)}V1.resolveUrl=Q9;var F9=/^[a-z_][-a-z0-9._]*$/i;function K9(n,i){if(typeof n=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,t=Yr(n[r]||i),e={"":t},u=K1(o,t,!1),l={},$=new Set;return X9(n,{allKeys:!0},(b,w,f,c)=>{if(c===void 0)return;let S=u+w,k=e[c];if(typeof b[r]=="string")k=d.call(this,b[r]);p.call(this,b.$anchor),p.call(this,b.$dynamicAnchor),e[w]=k;function d(h){let j=this.opts.uriResolver.resolve;if(h=Yr(k?j(k,h):h),$.has(h))throw g(h);$.add(h);let L=this.refs[h];if(typeof L=="string")L=this.refs[L];if(typeof L=="object")I(b,L.schema,h);else if(h!==Yr(S))if(h[0]==="#")I(b,l[h],h),l[h]=b;else this.refs[h]=S;return h}function p(h){if(typeof h=="string"){if(!F9.test(h))throw Error(`invalid anchor "${h}"`);d.call(this,`#${h}`)}}}),l;function I(b,w,f){if(w!==void 0&&!H9(b,w))throw g(f)}function g(b){return Error(`reference "${b}" resolves to more than one schema`)}}V1.getSchemaRefs=K9});var le=P((tS)=>{Object.defineProperty(tS,"__esModule",{value:!0});tS.getData=tS.KeywordCxt=tS.validateFunctionCode=void 0;var m1=e1(),q1=re(),Rc=Vc(),Cl=re(),E9=O1(),ue=J1(),Cc=P1(),F=M(),V=Ti(),Z9=oe(),qi=nn(),ee=te();function m9(n){if(C1(n)){if(R1(n),z1(n)){C9(n);return}}M1(n,()=>(0,m1.topBoolOrEmptySchema)(n))}tS.validateFunctionCode=m9;function M1({gen:n,validateName:i,schema:r,schemaEnv:o,opts:t},e){if(t.code.es5)n.func(i,F._`${V.default.data}, ${V.default.valCxt}`,o.$async,()=>{n.code(F._`"use strict"; ${_1(r,t)}`),z9(n,t),n.code(e)});else n.func(i,F._`${V.default.data}, ${M9(t)}`,o.$async,()=>n.code(_1(r,t)).code(e))}function M9(n){return F._`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${n.dynamicRef?F._`, ${V.default.dynamicAnchors}={}`:F.nil}}={}`}function z9(n,i){n.if(V.default.valCxt,()=>{if(n.var(V.default.instancePath,F._`${V.default.valCxt}.${V.default.instancePath}`),n.var(V.default.parentData,F._`${V.default.valCxt}.${V.default.parentData}`),n.var(V.default.parentDataProperty,F._`${V.default.valCxt}.${V.default.parentDataProperty}`),n.var(V.default.rootData,F._`${V.default.valCxt}.${V.default.rootData}`),i.dynamicRef)n.var(V.default.dynamicAnchors,F._`${V.default.valCxt}.${V.default.dynamicAnchors}`)},()=>{if(n.var(V.default.instancePath,F._`""`),n.var(V.default.parentData,F._`undefined`),n.var(V.default.parentDataProperty,F._`undefined`),n.var(V.default.rootData,V.default.data),i.dynamicRef)n.var(V.default.dynamicAnchors,F._`{}`)})}function C9(n){let{schema:i,opts:r,gen:o}=n;M1(n,()=>{if(r.$comment&&i.$comment)a1(n);if(nX(n),o.let(V.default.vErrors,null),o.let(V.default.errors,0),r.unevaluated)R9(n);x1(n),rX(n)});return}function R9(n){let{gen:i,validateName:r}=n;n.evaluated=i.const("evaluated",F._`${r}.evaluated`),i.if(F._`${n.evaluated}.dynamicProps`,()=>i.assign(F._`${n.evaluated}.props`,F._`undefined`)),i.if(F._`${n.evaluated}.dynamicItems`,()=>i.assign(F._`${n.evaluated}.items`,F._`undefined`))}function _1(n,i){let r=typeof n=="object"&&n[i.schemaId];return r&&(i.code.source||i.code.process)?F._`/*# sourceURL=${r} */`:F.nil}function x9(n,i){if(C1(n)){if(R1(n),z1(n)){a9(n,i);return}}(0,m1.boolOrEmptySchema)(n,i)}function z1({schema:n,self:i}){if(typeof n=="boolean")return!n;for(let r in n)if(i.RULES.all[r])return!0;return!1}function C1(n){return typeof n.schema!="boolean"}function a9(n,i){let{schema:r,gen:o,opts:t}=n;if(t.$comment&&r.$comment)a1(n);iX(n),tX(n);let e=o.const("_errs",V.default.errors);x1(n,e),o.var(i,F._`${e} === ${V.default.errors}`)}function R1(n){(0,qi.checkUnknownRules)(n),s9(n)}function x1(n,i){if(n.opts.jtd)return E1(n,[],!1,i);let r=(0,q1.getSchemaTypes)(n.schema),o=(0,q1.coerceAndCheckDataType)(n,r);E1(n,r,!o,i)}function s9(n){let{schema:i,errSchemaPath:r,opts:o,self:t}=n;if(i.$ref&&o.ignoreKeywordsWithRef&&(0,qi.schemaHasRulesButRef)(i,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function nX(n){let{schema:i,opts:r}=n;if(i.default!==void 0&&r.useDefaults&&r.strictSchema)(0,qi.checkStrictMode)(n,"default is ignored in the schema root")}function iX(n){let i=n.schema[n.opts.schemaId];if(i)n.baseId=(0,Z9.resolveUrl)(n.opts.uriResolver,n.baseId,i)}function tX(n){if(n.schema.$async&&!n.schemaEnv.$async)throw Error("async schema in sync schema")}function a1({gen:n,schemaEnv:i,schema:r,errSchemaPath:o,opts:t}){let e=r.$comment;if(t.$comment===!0)n.code(F._`${V.default.self}.logger.log(${e})`);else if(typeof t.$comment=="function"){let u=F.str`${o}/$comment`,l=n.scopeValue("root",{ref:i.root});n.code(F._`${V.default.self}.opts.$comment(${e}, ${u}, ${l}.schema)`)}}function rX(n){let{gen:i,schemaEnv:r,validateName:o,ValidationError:t,opts:e}=n;if(r.$async)i.if(F._`${V.default.errors} === 0`,()=>i.return(V.default.data),()=>i.throw(F._`new ${t}(${V.default.vErrors})`));else{if(i.assign(F._`${o}.errors`,V.default.vErrors),e.unevaluated)oX(n);i.return(F._`${V.default.errors} === 0`)}}function oX({gen:n,evaluated:i,props:r,items:o}){if(r instanceof F.Name)n.assign(F._`${i}.props`,r);if(o instanceof F.Name)n.assign(F._`${i}.items`,o)}function E1(n,i,r,o){let{gen:t,schema:e,data:u,allErrors:l,opts:$,self:I}=n,{RULES:g}=I;if(e.$ref&&($.ignoreKeywordsWithRef||!(0,qi.schemaHasRulesButRef)(e,g))){t.block(()=>nS(n,"$ref",g.all.$ref.definition));return}if(!$.jtd)eX(n,i);t.block(()=>{for(let w of g.rules)b(w);b(g.post)});function b(w){if(!(0,Rc.shouldUseGroup)(e,w))return;if(w.type){if(t.if((0,Cl.checkDataType)(w.type,u,$.strictNumbers)),Z1(n,w),i.length===1&&i[0]===w.type&&r)t.else(),(0,Cl.reportTypeError)(n);t.endIf()}else Z1(n,w);if(!l)t.if(F._`${V.default.errors} === ${o||0}`)}}function Z1(n,i){let{gen:r,schema:o,opts:{useDefaults:t}}=n;if(t)(0,E9.assignDefaults)(n,i.type);r.block(()=>{for(let e of i.rules)if((0,Rc.shouldUseRule)(o,e))nS(n,e.keyword,e.definition,i.type)})}function eX(n,i){if(n.schemaEnv.meta||!n.opts.strictTypes)return;if(uX(n,i),!n.opts.allowUnionTypes)lX(n,i);vX(n,n.dataTypes)}function uX(n,i){if(!i.length)return;if(!n.dataTypes.length){n.dataTypes=i;return}i.forEach((r)=>{if(!s1(n.dataTypes,r))xc(n,`type "${r}" not allowed by context "${n.dataTypes.join(",")}"`)}),IX(n,i)}function lX(n,i){if(i.length>1&&!(i.length===2&&i.includes("null")))xc(n,"use allowUnionTypes to allow union type keyword")}function vX(n,i){let r=n.self.RULES.all;for(let o in r){let t=r[o];if(typeof t=="object"&&(0,Rc.shouldUseRule)(n.schema,t)){let{type:e}=t.definition;if(e.length&&!e.some((u)=>$X(i,u)))xc(n,`missing type "${e.join(",")}" for keyword "${o}"`)}}}function $X(n,i){return n.includes(i)||i==="number"&&n.includes("integer")}function s1(n,i){return n.includes(i)||i==="integer"&&n.includes("number")}function IX(n,i){let r=[];for(let o of n.dataTypes)if(s1(i,o))r.push(o);else if(i.includes("integer")&&o==="number")r.push("integer");n.dataTypes=r}function xc(n,i){let r=n.schemaEnv.baseId+n.errSchemaPath;i+=` at "${r}" (strictTypes)`,(0,qi.checkStrictMode)(n,i,n.opts.strictTypes)}class ac{constructor(n,i,r){if((0,ue.validateKeywordUsage)(n,i,r),this.gen=n.gen,this.allErrors=n.allErrors,this.keyword=r,this.data=n.data,this.schema=n.schema[r],this.$data=i.$data&&n.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,qi.schemaRefOrVal)(n,this.schema,r,this.$data),this.schemaType=i.schemaType,this.parentSchema=n.schema,this.params={},this.it=n,this.def=i,this.$data)this.schemaCode=n.gen.const("vSchema",iS(this.$data,n));else if(this.schemaCode=this.schemaValue,!(0,ue.validSchemaType)(this.schema,i.schemaType,i.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(i.schemaType)}`);if("code"in i?i.trackErrors:i.errors!==!1)this.errsCount=n.gen.const("_errs",V.default.errors)}result(n,i,r){this.failResult((0,F.not)(n),i,r)}failResult(n,i,r){if(this.gen.if(n),r)r();else this.error();if(i){if(this.gen.else(),i(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(n,i){this.failResult((0,F.not)(n),void 0,i)}fail(n){if(n===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(n),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(n){if(!this.$data)return this.fail(n);let{schemaCode:i}=this;this.fail(F._`${i} !== undefined && (${(0,F.or)(this.invalid$data(),n)})`)}error(n,i,r){if(i){this.setParams(i),this._error(n,r),this.setParams({});return}this._error(n,r)}_error(n,i){(n?ee.reportExtraError:ee.reportError)(this,this.def.error,i)}$dataError(){(0,ee.reportError)(this,this.def.$dataError||ee.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,ee.resetErrorsCount)(this.gen,this.errsCount)}ok(n){if(!this.allErrors)this.gen.if(n)}setParams(n,i){if(i)Object.assign(this.params,n);else this.params=n}block$data(n,i,r=F.nil){this.gen.block(()=>{this.check$data(n,r),i()})}check$data(n=F.nil,i=F.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:t,def:e}=this;if(r.if((0,F.or)(F._`${o} === undefined`,i)),n!==F.nil)r.assign(n,!0);if(t.length||e.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),n!==F.nil)r.assign(n,!1)}r.else()}invalid$data(){let{gen:n,schemaCode:i,schemaType:r,def:o,it:t}=this;return(0,F.or)(e(),u());function e(){if(r.length){if(!(i instanceof F.Name))throw Error("ajv implementation error");let l=Array.isArray(r)?r:[r];return F._`${(0,Cl.checkDataTypes)(l,i,t.opts.strictNumbers,Cl.DataType.Wrong)}`}return F.nil}function u(){if(o.validateSchema){let l=n.scopeValue("validate$data",{ref:o.validateSchema});return F._`!${l}(${i})`}return F.nil}}subschema(n,i){let r=(0,Cc.getSubschema)(this.it,n);(0,Cc.extendSubschemaData)(r,this.it,n),(0,Cc.extendSubschemaMode)(r,n);let o={...this.it,...r,items:void 0,props:void 0};return x9(o,i),o}mergeEvaluated(n,i){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&n.props!==void 0)r.props=qi.mergeEvaluated.props(o,n.props,r.props,i);if(r.items!==!0&&n.items!==void 0)r.items=qi.mergeEvaluated.items(o,n.items,r.items,i)}mergeValidEvaluated(n,i){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(i,()=>this.mergeEvaluated(n,F.Name)),!0}}tS.KeywordCxt=ac;function nS(n,i,r,o){let t=new ac(n,r,i);if("code"in r)r.code(t,o);else if(t.$data&&r.validate)(0,ue.funcKeywordCode)(t,r);else if("macro"in r)(0,ue.macroKeywordCode)(t,r);else if(r.compile||r.validate)(0,ue.funcKeywordCode)(t,r)}var gX=/^\/(?:[^~]|~0|~1)*$/,bX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function iS(n,{dataLevel:i,dataNames:r,dataPathArr:o}){let t,e;if(n==="")return V.default.rootData;if(n[0]==="/"){if(!gX.test(n))throw Error(`Invalid JSON-pointer: ${n}`);t=n,e=V.default.rootData}else{let I=bX.exec(n);if(!I)throw Error(`Invalid JSON-pointer: ${n}`);let g=+I[1];if(t=I[2],t==="#"){if(g>=i)throw Error($("property/index",g));return o[i-g]}if(g>i)throw Error($("data",g));if(e=r[i-g],!t)return e}let u=e,l=t.split("/");for(let I of l)if(I)e=F._`${e}${(0,F.getProperty)((0,qi.unescapeJsonPointer)(I))}`,u=F._`${u} && ${e}`;return u;function $(I,g){return`Cannot access ${I} ${g} levels up, current level is ${i}`}}tS.getData=iS});var Rl=P((eS)=>{Object.defineProperty(eS,"__esModule",{value:!0});class oS extends Error{constructor(n){super("validation failed");this.errors=n,this.ajv=this.validation=!0}}eS.default=oS});var ve=P((lS)=>{Object.defineProperty(lS,"__esModule",{value:!0});var sc=oe();class uS extends Error{constructor(n,i,r,o){super(o||`can't resolve reference ${r} from id ${i}`);this.missingRef=(0,sc.resolveUrl)(n,i,r),this.missingSchema=(0,sc.normalizeId)((0,sc.getFullPath)(n,this.missingRef))}}lS.default=uS});var al=P((IS)=>{Object.defineProperty(IS,"__esModule",{value:!0});IS.resolveSchema=IS.getCompilingSchema=IS.resolveRef=IS.compileSchema=IS.SchemaEnv=void 0;var Di=M(),DX=Rl(),Yt=Ti(),Si=oe(),vS=nn(),SX=le();class $e{constructor(n){var i;this.refs={},this.dynamicAnchors={};let r;if(typeof n.schema=="object")r=n.schema;this.schema=n.schema,this.schemaId=n.schemaId,this.root=n.root||this,this.baseId=(i=n.baseId)!==null&&i!==void 0?i:(0,Si.normalizeId)(r===null||r===void 0?void 0:r[n.schemaId||"$id"]),this.schemaPath=n.schemaPath,this.localRefs=n.localRefs,this.meta=n.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}IS.SchemaEnv=$e;function i6(n){let i=$S.call(this,n);if(i)return i;let r=(0,Si.getFullPath)(this.opts.uriResolver,n.root.baseId),{es5:o,lines:t}=this.opts.code,{ownProperties:e}=this.opts,u=new Di.CodeGen(this.scope,{es5:o,lines:t,ownProperties:e}),l;if(n.$async)l=u.scopeValue("Error",{ref:DX.default,code:Di._`require("ajv/dist/runtime/validation_error").default`});let $=u.scopeName("validate");n.validateName=$;let I={gen:u,allErrors:this.opts.allErrors,data:Yt.default.data,parentData:Yt.default.parentData,parentDataProperty:Yt.default.parentDataProperty,dataNames:[Yt.default.data],dataPathArr:[Di.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",this.opts.code.source===!0?{ref:n.schema,code:(0,Di.stringify)(n.schema)}:{ref:n.schema}),validateName:$,ValidationError:l,schema:n.schema,schemaEnv:n,rootId:r,baseId:n.baseId||r,schemaPath:Di.nil,errSchemaPath:n.schemaPath||(this.opts.jtd?"":"#"),errorPath:Di._`""`,opts:this.opts,self:this},g;try{this._compilations.add(n),(0,SX.validateFunctionCode)(I),u.optimize(this.opts.code.optimize);let b=u.toString();if(g=`${u.scopeRefs(Yt.default.scope)}return ${b}`,this.opts.code.process)g=this.opts.code.process(g,n);let f=Function(`${Yt.default.self}`,`${Yt.default.scope}`,g)(this,this.scope.get());if(this.scope.value($,{ref:f}),f.errors=null,f.schema=n.schema,f.schemaEnv=n,n.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:$,validateCode:b,scopeValues:u._values};if(this.opts.unevaluated){let{props:c,items:S}=I;if(f.evaluated={props:c instanceof Di.Name?void 0:c,items:S instanceof Di.Name?void 0:S,dynamicProps:c instanceof Di.Name,dynamicItems:S instanceof Di.Name},f.source)f.source.evaluated=(0,Di.stringify)(f.evaluated)}return n.validate=f,n}catch(b){if(delete n.validate,delete n.validateName,g)this.logger.error("Error compiling schema, function code:",g);throw b}finally{this._compilations.delete(n)}}IS.compileSchema=i6;function AX(n,i,r){var o;r=(0,Si.resolveUrl)(this.opts.uriResolver,i,r);let t=n.refs[r];if(t)return t;let e=dX.call(this,n,r);if(e===void 0){let u=(o=n.localRefs)===null||o===void 0?void 0:o[r],{schemaId:l}=this.opts;if(u)e=new $e({schema:u,schemaId:l,root:n,baseId:i})}if(e===void 0)return;return n.refs[r]=OX.call(this,e)}IS.resolveRef=AX;function OX(n){if((0,Si.inlineRef)(n.schema,this.opts.inlineRefs))return n.schema;return n.validate?n:i6.call(this,n)}function $S(n){for(let i of this._compilations)if(kX(i,n))return i}IS.getCompilingSchema=$S;function kX(n,i){return n.schema===i.schema&&n.root===i.root&&n.baseId===i.baseId}function dX(n,i){let r;while(typeof(r=this.refs[i])=="string")i=r;return r||this.schemas[i]||xl.call(this,n,i)}function xl(n,i){let r=this.opts.uriResolver.parse(i),o=(0,Si._getFullPath)(this.opts.uriResolver,r),t=(0,Si.getFullPath)(this.opts.uriResolver,n.baseId,void 0);if(Object.keys(n.schema).length>0&&o===t)return n6.call(this,r,n);let e=(0,Si.normalizeId)(o),u=this.refs[e]||this.schemas[e];if(typeof u=="string"){let l=xl.call(this,n,u);if(typeof(l===null||l===void 0?void 0:l.schema)!=="object")return;return n6.call(this,r,l)}if(typeof(u===null||u===void 0?void 0:u.schema)!=="object")return;if(!u.validate)i6.call(this,u);if(e===(0,Si.normalizeId)(i)){let{schema:l}=u,{schemaId:$}=this.opts,I=l[$];if(I)t=(0,Si.resolveUrl)(this.opts.uriResolver,t,I);return new $e({schema:l,schemaId:$,root:n,baseId:t})}return n6.call(this,r,u)}IS.resolveSchema=xl;var LX=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function n6(n,{baseId:i,schema:r,root:o}){var t;if(((t=n.fragment)===null||t===void 0?void 0:t[0])!=="/")return;for(let l of n.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let $=r[(0,vS.unescapeFragment)(l)];if($===void 0)return;r=$;let I=typeof r==="object"&&r[this.opts.schemaId];if(!LX.has(l)&&I)i=(0,Si.resolveUrl)(this.opts.uriResolver,i,I)}let e;if(typeof r!="boolean"&&r.$ref&&!(0,vS.schemaHasRulesButRef)(r,this.RULES)){let l=(0,Si.resolveUrl)(this.opts.uriResolver,i,r.$ref);e=xl.call(this,o,l)}let{schemaId:u}=this.opts;if(e=e||new $e({schema:r,schemaId:u,root:o,baseId:i}),e.schema!==e.root.schema)return e;return}});var bS=P(($E,WX)=>{WX.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 o6=P((IE,SS)=>{var JX=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),fS=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),t6=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),cS=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),HX=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function r6(n){let i="",r=0,o=0;for(o=0;o<n.length;o++){if(r=n[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";i+=n[o];break}for(o+=1;o<n.length;o++){if(r=n[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";i+=n[o]}return i}var XX=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function wS(n){return n.length=0,!0}function hX(n,i,r){if(n.length){let o=r6(n);if(o!=="")i.push(o);else return r.error=!0,!1;n.length=0}return!0}function PX(n){let i=0,r={error:!1,address:"",zone:""},o=[],t=[],e=!1,u=!1,l=hX;for(let $=0;$<n.length;$++){let I=n[$];if(I==="["||I==="]")continue;if(I===":"){if(e===!0)u=!0;if(!l(t,o,r))break;if(++i>7){r.error=!0;break}if($>0&&n[$-1]===":")e=!0;o.push(":");continue}else if(I==="%"){if(!l(t,o,r))break;l=wS}else{t.push(I);continue}}if(t.length)if(l===wS)r.zone=t.join("");else if(u)o.push(t.join(""));else o.push(r6(t));return r.address=o.join(""),r}function US(n){if(YX(n,":")<2)return{host:n,isIPV6:!1};let i=PX(n);if(!i.error){let{address:r,address:o}=i;if(i.zone)r+="%"+i.zone,o+="%25"+i.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:n,isIPV6:!1}}function YX(n,i){let r=0;for(let o=0;o<n.length;o++)if(n[o]===i)r++;return r}function pX(n){let i=n,r=[],o=-1,t=0;while(t=i.length){if(t===1)if(i===".")break;else if(i==="/"){r.push("/");break}else{r.push(i);break}else if(t===2){if(i[0]==="."){if(i[1]===".")break;else if(i[1]==="/"){i=i.slice(2);continue}}else if(i[0]==="/"){if(i[1]==="."||i[1]==="/"){r.push("/");break}}}else if(t===3){if(i==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(i[0]==="."){if(i[1]==="."){if(i[2]==="/"){i=i.slice(3);continue}}else if(i[1]==="/"){i=i.slice(2);continue}}else if(i[0]==="/"){if(i[1]==="."){if(i[2]==="/"){i=i.slice(2);continue}else if(i[2]==="."){if(i[3]==="/"){if(i=i.slice(3),r.length!==0)r.pop();continue}}}}if((o=i.indexOf("/",1))===-1){r.push(i);break}else r.push(i.slice(0,o)),i=i.slice(o)}return r.join("")}var QX={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},FX=/[@/?#:]/g,KX=/[@/?#]/g;function DS(n,i){let r=i?KX:FX;return r.lastIndex=0,n.replace(r,(o)=>QX[o])}function BX(n,i=!1){if(n.indexOf("%")===-1)return n;let r="";for(let o=0;o<n.length;o++){if(n[o]==="%"&&o+2<n.length){let t=n.slice(o+1,o+3);if(t6(t)){let e=t.toUpperCase(),u=String.fromCharCode(parseInt(e,16));if(i&&cS(u))r+=u;else r+="%"+e;o+=2;continue}}r+=n[o]}return r}function VX(n){let i="";for(let r=0;r<n.length;r++){if(n[r]==="%"&&r+2<n.length){let o=n.slice(r+1,r+3);if(t6(o)){let t=o.toUpperCase(),e=String.fromCharCode(parseInt(t,16));if(e!=="."&&cS(e))i+=e;else i+="%"+t;r+=2;continue}}if(HX(n[r]))i+=n[r];else i+=escape(n[r])}return i}function TX(n){let i="";for(let r=0;r<n.length;r++){if(n[r]==="%"&&r+2<n.length){let o=n.slice(r+1,r+3);if(t6(o)){i+="%"+o.toUpperCase(),r+=2;continue}}i+=escape(n[r])}return i}function qX(n){let i=[];if(n.userinfo!==void 0)i.push(n.userinfo),i.push("@");if(n.host!==void 0){let r=unescape(n.host);if(!fS(r)){let o=US(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=DS(r,!1)}i.push(r)}if(typeof n.port==="number"||typeof n.port==="string")i.push(":"),i.push(String(n.port));return i.length?i.join(""):void 0}SS.exports={nonSimpleDomain:XX,recomposeAuthority:qX,reescapeHostDelimiters:DS,normalizePercentEncoding:BX,normalizePathEncoding:VX,escapePreservingEscapes:TX,removeDotSegments:pX,isIPv4:fS,isUUID:JX,normalizeIPv6:US,stringArrayToHexStripped:r6}});var LS=P((gE,dS)=>{var{isUUID:_X}=o6(),EX=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,ZX=["http","https","ws","wss","urn","urn:uuid"];function mX(n){return ZX.indexOf(n)!==-1}function e6(n){if(n.secure===!0)return!0;else if(n.secure===!1)return!1;else if(n.scheme)return n.scheme.length===3&&(n.scheme[0]==="w"||n.scheme[0]==="W")&&(n.scheme[1]==="s"||n.scheme[1]==="S")&&(n.scheme[2]==="s"||n.scheme[2]==="S");else return!1}function AS(n){if(!n.host)n.error=n.error||"HTTP URIs must have a host.";return n}function OS(n){let i=String(n.scheme).toLowerCase()==="https";if(n.port===(i?443:80)||n.port==="")n.port=void 0;if(!n.path)n.path="/";return n}function MX(n){return n.secure=e6(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n}function zX(n){if(n.port===(e6(n)?443:80)||n.port==="")n.port=void 0;if(typeof n.secure==="boolean")n.scheme=n.secure?"wss":"ws",n.secure=void 0;if(n.resourceName){let[i,r]=n.resourceName.split("?");n.path=i&&i!=="/"?i:void 0,n.query=r,n.resourceName=void 0}return n.fragment=void 0,n}function CX(n,i){if(!n.path)return n.error="URN can not be parsed",n;let r=n.path.match(EX);if(r){let o=i.scheme||n.scheme||"urn";n.nid=r[1].toLowerCase(),n.nss=r[2];let t=`${o}:${i.nid||n.nid}`,e=u6(t);if(n.path=void 0,e)n=e.parse(n,i)}else n.error=n.error||"URN can not be parsed.";return n}function RX(n,i){if(n.nid===void 0)throw Error("URN without nid cannot be serialized");let r=i.scheme||n.scheme||"urn",o=n.nid.toLowerCase(),t=`${r}:${i.nid||o}`,e=u6(t);if(e)n=e.serialize(n,i);let u=n,l=n.nss;return u.path=`${o||i.nid}:${l}`,i.skipEscape=!0,u}function xX(n,i){let r=n;if(r.uuid=r.nss,r.nss=void 0,!i.tolerant&&(!r.uuid||!_X(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function aX(n){let i=n;return i.nss=(n.uuid||"").toLowerCase(),i}var kS={scheme:"http",domainHost:!0,parse:AS,serialize:OS},sX={scheme:"https",domainHost:kS.domainHost,parse:AS,serialize:OS},sl={scheme:"ws",domainHost:!0,parse:MX,serialize:zX},nh={scheme:"wss",domainHost:sl.domainHost,parse:sl.parse,serialize:sl.serialize},ih={scheme:"urn",parse:CX,serialize:RX,skipNormalize:!0},th={scheme:"urn:uuid",parse:xX,serialize:aX,skipNormalize:!0},nv={http:kS,https:sX,ws:sl,wss:nh,urn:ih,"urn:uuid":th};Object.setPrototypeOf(nv,null);function u6(n){return n&&(nv[n]||nv[n.toLowerCase()])||void 0}dS.exports={wsIsSecure:e6,SCHEMES:nv,isValidSchemeName:mX,getSchemeHandler:u6}});var JS=P((bE,iv)=>{var{normalizeIPv6:rh,removeDotSegments:Ie,recomposeAuthority:oh,normalizePercentEncoding:eh,normalizePathEncoding:uh,escapePreservingEscapes:lh,reescapeHostDelimiters:vh,isIPv4:$h,nonSimpleDomain:Ih}=o6(),{SCHEMES:gh,getSchemeHandler:yS}=LS();function bh(n,i){if(typeof n==="string")n=Dh(n,i);else if(typeof n==="object")n=pr(pt(n,i),i);return n}function wh(n,i,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},t=GS(pr(n,o),pr(i,o),o,!0);return o.skipEscape=!0,pt(t,o)}function GS(n,i,r,o){let t={};if(!o)n=pr(pt(n,r),r),i=pr(pt(i,r),r);if(r=r||{},!r.tolerant&&i.scheme)t.scheme=i.scheme,t.userinfo=i.userinfo,t.host=i.host,t.port=i.port,t.path=Ie(i.path||""),t.query=i.query;else{if(i.userinfo!==void 0||i.host!==void 0||i.port!==void 0)t.userinfo=i.userinfo,t.host=i.host,t.port=i.port,t.path=Ie(i.path||""),t.query=i.query;else{if(!i.path)if(t.path=n.path,i.query!==void 0)t.query=i.query;else t.query=n.query;else{if(i.path[0]==="/")t.path=Ie(i.path);else{if((n.userinfo!==void 0||n.host!==void 0||n.port!==void 0)&&!n.path)t.path="/"+i.path;else if(!n.path)t.path=i.path;else t.path=n.path.slice(0,n.path.lastIndexOf("/")+1)+i.path;t.path=Ie(t.path)}t.query=i.query}t.userinfo=n.userinfo,t.host=n.host,t.port=n.port}t.scheme=n.scheme}return t.fragment=i.fragment,t}function fh(n,i,r){let o=NS(n,r),t=NS(i,r);return o!==void 0&&t!==void 0&&o.toLowerCase()===t.toLowerCase()}function pt(n,i){let r={host:n.host,scheme:n.scheme,userinfo:n.userinfo,port:n.port,path:n.path,query:n.query,nid:n.nid,nss:n.nss,uuid:n.uuid,fragment:n.fragment,reference:n.reference,resourceName:n.resourceName,secure:n.secure,error:""},o=Object.assign({},i),t=[],e=yS(o.scheme||r.scheme);if(e&&e.serialize)e.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=lh(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=eh(r.path);if(o.reference!=="suffix"&&r.scheme)t.push(r.scheme,":");let u=oh(r);if(u!==void 0){if(o.reference!=="suffix")t.push("//");if(t.push(u),r.path&&r.path[0]!=="/")t.push("/")}if(r.path!==void 0){let l=r.path;if(!o.absolutePath&&(!e||!e.absolutePath))l=Ie(l);if(u===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);t.push(l)}if(r.query!==void 0)t.push("?",r.query);if(r.fragment!==void 0)t.push("#",r.fragment);return t.join("")}var ch=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Uh(n,i){if(i[2]!==void 0&&n.path&&n.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof n.port==="number"&&(n.port<0||n.port>65535))return"URI port is malformed.";return}function jS(n,i){let r=Object.assign({},i),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},t=!1,e=!1;if(r.reference==="suffix")if(r.scheme)n=r.scheme+":"+n;else n="//"+n;let u=n.match(ch);if(u){if(o.scheme=u[1],o.userinfo=u[3],o.host=u[4],o.port=parseInt(u[5],10),o.path=u[6]||"",o.query=u[7],o.fragment=u[8],isNaN(o.port))o.port=u[5];let l=Uh(o,u);if(l!==void 0)o.error=o.error||l,t=!0;if(o.host)if($h(o.host)===!1){let g=rh(o.host);o.host=g.host.toLowerCase(),e=g.isIPV6}else e=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let $=yS(r.scheme||o.scheme);if(!r.unicodeSupport&&(!$||!$.unicodeSupport)){if(o.host&&(r.domainHost||$&&$.domainHost)&&e===!1&&Ih(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(I){o.error=o.error||"Host's domain name can not be converted to ASCII: "+I}}if(!$||$&&!$.skipNormalize){if(n.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=vh(unescape(o.host),e)}if(o.path)o.path=uh(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if($&&$.parse)$.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:t}}function pr(n,i){return jS(n,i).parsed}function Dh(n,i){return WS(n,i).normalized}function WS(n,i){let{parsed:r,malformedAuthorityOrPort:o}=jS(n,i);return{normalized:o?n:pt(r,i),malformedAuthorityOrPort:o}}function NS(n,i){if(typeof n==="string"){let{normalized:r,malformedAuthorityOrPort:o}=WS(n,i);return o?void 0:r}if(typeof n==="object")return pt(n,i)}var l6={SCHEMES:gh,normalize:bh,resolve:wh,resolveComponent:GS,equal:fh,serialize:pt,parse:pr};iv.exports=l6;iv.exports.default=l6;iv.exports.fastUri=l6});var hS=P((XS)=>{Object.defineProperty(XS,"__esModule",{value:!0});var HS=JS();HS.code='require("ajv/dist/runtime/uri").default';XS.default=HS});var VS=P((_i)=>{Object.defineProperty(_i,"__esModule",{value:!0});_i.CodeGen=_i.Name=_i.nil=_i.stringify=_i.str=_i._=_i.KeywordCxt=void 0;var Ah=le();Object.defineProperty(_i,"KeywordCxt",{enumerable:!0,get:function(){return Ah.KeywordCxt}});var Qr=M();Object.defineProperty(_i,"_",{enumerable:!0,get:function(){return Qr._}});Object.defineProperty(_i,"str",{enumerable:!0,get:function(){return Qr.str}});Object.defineProperty(_i,"stringify",{enumerable:!0,get:function(){return Qr.stringify}});Object.defineProperty(_i,"nil",{enumerable:!0,get:function(){return Qr.nil}});Object.defineProperty(_i,"Name",{enumerable:!0,get:function(){return Qr.Name}});Object.defineProperty(_i,"CodeGen",{enumerable:!0,get:function(){return Qr.CodeGen}});var Oh=Rl(),FS=ve(),kh=Bc(),ge=al(),dh=M(),be=oe(),tv=re(),$6=nn(),PS=bS(),Lh=hS(),KS=(n,i)=>new RegExp(n,i);KS.code="new RegExp";var Nh=["removeAdditional","useDefaults","coerceTypes"],yh=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Gh={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."},jh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},YS=200;function Wh(n){var i,r,o,t,e,u,l,$,I,g,b,w,f,c,S,k,d,p,h,j,L,q,x,yn,Wn;let On=n.strict,en=(i=n.code)===null||i===void 0?void 0:i.optimize,kt=en===!0||en===void 0?1:en||0,wi=(o=(r=n.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:KS,no=(t=n.uriResolver)!==null&&t!==void 0?t:Lh.default;return{strictSchema:(u=(e=n.strictSchema)!==null&&e!==void 0?e:On)!==null&&u!==void 0?u:!0,strictNumbers:($=(l=n.strictNumbers)!==null&&l!==void 0?l:On)!==null&&$!==void 0?$:!0,strictTypes:(g=(I=n.strictTypes)!==null&&I!==void 0?I:On)!==null&&g!==void 0?g:"log",strictTuples:(w=(b=n.strictTuples)!==null&&b!==void 0?b:On)!==null&&w!==void 0?w:"log",strictRequired:(c=(f=n.strictRequired)!==null&&f!==void 0?f:On)!==null&&c!==void 0?c:!1,code:n.code?{...n.code,optimize:kt,regExp:wi}:{optimize:kt,regExp:wi},loopRequired:(S=n.loopRequired)!==null&&S!==void 0?S:YS,loopEnum:(k=n.loopEnum)!==null&&k!==void 0?k:YS,meta:(d=n.meta)!==null&&d!==void 0?d:!0,messages:(p=n.messages)!==null&&p!==void 0?p:!0,inlineRefs:(h=n.inlineRefs)!==null&&h!==void 0?h:!0,schemaId:(j=n.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(L=n.addUsedSchema)!==null&&L!==void 0?L:!0,validateSchema:(q=n.validateSchema)!==null&&q!==void 0?q:!0,validateFormats:(x=n.validateFormats)!==null&&x!==void 0?x:!0,unicodeRegExp:(yn=n.unicodeRegExp)!==null&&yn!==void 0?yn:!0,int32range:(Wn=n.int32range)!==null&&Wn!==void 0?Wn:!0,uriResolver:no}}class rv{constructor(n={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,n=this.opts={...n,...Wh(n)};let{es5:i,lines:r}=this.opts.code;this.scope=new dh.ValueScope({scope:{},prefixes:yh,es5:i,lines:r}),this.logger=Yh(n.logger);let o=n.validateFormats;if(n.validateFormats=!1,this.RULES=(0,kh.getRules)(),pS.call(this,Gh,n,"NOT SUPPORTED"),pS.call(this,jh,n,"DEPRECATED","warn"),this._metaOpts=hh.call(this),n.formats)Hh.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),n.keywords)Xh.call(this,n.keywords);if(typeof n.meta=="object")this.addMetaSchema(n.meta);Jh.call(this),n.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:n,meta:i,schemaId:r}=this.opts,o=PS;if(r==="id")o={...PS},o.id=o.$id,delete o.$id;if(i&&n)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:n,schemaId:i}=this.opts;return this.opts.defaultMeta=typeof n=="object"?n[i]||n:void 0}validate(n,i){let r;if(typeof n=="string"){if(r=this.getSchema(n),!r)throw Error(`no schema with key or ref "${n}"`)}else r=this.compile(n);let o=r(i);if(!("$async"in r))this.errors=r.errors;return o}compile(n,i){let r=this._addSchema(n,i);return r.validate||this._compileSchemaEnv(r)}compileAsync(n,i){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,n,i);async function o(I,g){await t.call(this,I.$schema);let b=this._addSchema(I,g);return b.validate||e.call(this,b)}async function t(I){if(I&&!this.getSchema(I))await o.call(this,{$ref:I},!0)}async function e(I){try{return this._compileSchemaEnv(I)}catch(g){if(!(g instanceof FS.default))throw g;return u.call(this,g),await l.call(this,g.missingSchema),e.call(this,I)}}function u({missingSchema:I,missingRef:g}){if(this.refs[I])throw Error(`AnySchema ${I} is loaded but ${g} cannot be resolved`)}async function l(I){let g=await $.call(this,I);if(!this.refs[I])await t.call(this,g.$schema);if(!this.refs[I])this.addSchema(g,I,i)}async function $(I){let g=this._loading[I];if(g)return g;try{return await(this._loading[I]=r(I))}finally{delete this._loading[I]}}}addSchema(n,i,r,o=this.opts.validateSchema){if(Array.isArray(n)){for(let e of n)this.addSchema(e,void 0,r,o);return this}let t;if(typeof n==="object"){let{schemaId:e}=this.opts;if(t=n[e],t!==void 0&&typeof t!="string")throw Error(`schema ${e} must be string`)}return i=(0,be.normalizeId)(i||t),this._checkUnique(i),this.schemas[i]=this._addSchema(n,r,i,o,!0),this}addMetaSchema(n,i,r=this.opts.validateSchema){return this.addSchema(n,i,!0,r),this}validateSchema(n,i){if(typeof n=="boolean")return!0;let r;if(r=n.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,n);if(!o&&i){let t="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(t);else throw Error(t)}return o}getSchema(n){let i;while(typeof(i=QS.call(this,n))=="string")n=i;if(i===void 0){let{schemaId:r}=this.opts,o=new ge.SchemaEnv({schema:{},schemaId:r});if(i=ge.resolveSchema.call(this,o,n),!i)return;this.refs[n]=i}return i.validate||this._compileSchemaEnv(i)}removeSchema(n){if(n instanceof RegExp)return this._removeAllSchemas(this.schemas,n),this._removeAllSchemas(this.refs,n),this;switch(typeof n){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let i=QS.call(this,n);if(typeof i=="object")this._cache.delete(i.schema);return delete this.schemas[n],delete this.refs[n],this}case"object":{let i=n;this._cache.delete(i);let r=n[this.opts.schemaId];if(r)r=(0,be.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(n){for(let i of n)this.addKeyword(i);return this}addKeyword(n,i){let r;if(typeof n=="string"){if(r=n,typeof i=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),i.keyword=r}else if(typeof n=="object"&&i===void 0){if(i=n,r=i.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Qh.call(this,r,i),!i)return(0,$6.eachItem)(r,(t)=>v6.call(this,t)),this;Kh.call(this,i);let o={...i,type:(0,tv.getJSONTypes)(i.type),schemaType:(0,tv.getJSONTypes)(i.schemaType)};return(0,$6.eachItem)(r,o.type.length===0?(t)=>v6.call(this,t,o):(t)=>o.type.forEach((e)=>v6.call(this,t,o,e))),this}getKeyword(n){let i=this.RULES.all[n];return typeof i=="object"?i.definition:!!i}removeKeyword(n){let{RULES:i}=this;delete i.keywords[n],delete i.all[n];for(let r of i.rules){let o=r.rules.findIndex((t)=>t.keyword===n);if(o>=0)r.rules.splice(o,1)}return this}addFormat(n,i){if(typeof i=="string")i=new RegExp(i);return this.formats[n]=i,this}errorsText(n=this.errors,{separator:i=", ",dataVar:r="data"}={}){if(!n||n.length===0)return"No errors";return n.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,t)=>o+i+t)}$dataMetaSchema(n,i){let r=this.RULES.all;n=JSON.parse(JSON.stringify(n));for(let o of i){let t=o.split("/").slice(1),e=n;for(let u of t)e=e[u];for(let u in r){let l=r[u];if(typeof l!="object")continue;let{$data:$}=l.definition,I=e[u];if($&&I)e[u]=BS(I)}}return n}_removeAllSchemas(n,i){for(let r in n){let o=n[r];if(!i||i.test(r)){if(typeof o=="string")delete n[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete n[r]}}}_addSchema(n,i,r,o=this.opts.validateSchema,t=this.opts.addUsedSchema){let e,{schemaId:u}=this.opts;if(typeof n=="object")e=n[u];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof n!="boolean")throw Error("schema must be object or boolean");let l=this._cache.get(n);if(l!==void 0)return l;r=(0,be.normalizeId)(e||r);let $=be.getSchemaRefs.call(this,n,r);if(l=new ge.SchemaEnv({schema:n,schemaId:u,meta:i,baseId:r,localRefs:$}),this._cache.set(l.schema,l),t&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=l}if(o)this.validateSchema(n,!0);return l}_checkUnique(n){if(this.schemas[n]||this.refs[n])throw Error(`schema with key or id "${n}" already exists`)}_compileSchemaEnv(n){if(n.meta)this._compileMetaSchema(n);else ge.compileSchema.call(this,n);if(!n.validate)throw Error("ajv implementation error");return n.validate}_compileMetaSchema(n){let i=this.opts;this.opts=this._metaOpts;try{ge.compileSchema.call(this,n)}finally{this.opts=i}}}rv.ValidationError=Oh.default;rv.MissingRefError=FS.default;_i.default=rv;function pS(n,i,r,o="error"){for(let t in n){let e=t;if(e in i)this.logger[o](`${r}: option ${t}. ${n[e]}`)}}function QS(n){return n=(0,be.normalizeId)(n),this.schemas[n]||this.refs[n]}function Jh(){let n=this.opts.schemas;if(!n)return;if(Array.isArray(n))this.addSchema(n);else for(let i in n)this.addSchema(n[i],i)}function Hh(){for(let n in this.opts.formats){let i=this.opts.formats[n];if(i)this.addFormat(n,i)}}function Xh(n){if(Array.isArray(n)){this.addVocabulary(n);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let i in n){let r=n[i];if(!r.keyword)r.keyword=i;this.addKeyword(r)}}function hh(){let n={...this.opts};for(let i of Nh)delete n[i];return n}var Ph={log(){},warn(){},error(){}};function Yh(n){if(n===!1)return Ph;if(n===void 0)return console;if(n.log&&n.warn&&n.error)return n;throw Error("logger must implement log, warn and error methods")}var ph=/^[a-z_$][a-z0-9_$:-]*$/i;function Qh(n,i){let{RULES:r}=this;if((0,$6.eachItem)(n,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!ph.test(o))throw Error(`Keyword ${o} has invalid name`)}),!i)return;if(i.$data&&!(("code"in i)||("validate"in i)))throw Error('$data keyword must have "code" or "validate" function')}function v6(n,i,r){var o;let t=i===null||i===void 0?void 0:i.post;if(r&&t)throw Error('keyword with "post" flag cannot have "type"');let{RULES:e}=this,u=t?e.post:e.rules.find(({type:$})=>$===r);if(!u)u={type:r,rules:[]},e.rules.push(u);if(e.keywords[n]=!0,!i)return;let l={keyword:n,definition:{...i,type:(0,tv.getJSONTypes)(i.type),schemaType:(0,tv.getJSONTypes)(i.schemaType)}};if(i.before)Fh.call(this,u,l,i.before);else u.rules.push(l);e.all[n]=l,(o=i.implements)===null||o===void 0||o.forEach(($)=>this.addKeyword($))}function Fh(n,i,r){let o=n.rules.findIndex((t)=>t.keyword===r);if(o>=0)n.rules.splice(o,0,i);else n.rules.push(i),this.logger.warn(`rule ${r} is not defined`)}function Kh(n){let{metaSchema:i}=n;if(i===void 0)return;if(n.$data&&this.opts.$data)i=BS(i);n.validateSchema=this.compile(i,!0)}var Bh={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function BS(n){return{anyOf:[n,Bh]}}});var qS=P((TS)=>{Object.defineProperty(TS,"__esModule",{value:!0});var qh={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};TS.default=qh});var zS=P((mS)=>{Object.defineProperty(mS,"__esModule",{value:!0});mS.callRef=mS.getValidate=void 0;var Eh=ve(),_S=Ii(),ni=M(),Fr=Ti(),ES=al(),ov=nn(),Zh={keyword:"$ref",schemaType:"string",code(n){let{gen:i,schema:r,it:o}=n,{baseId:t,schemaEnv:e,validateName:u,opts:l,self:$}=o,{root:I}=e;if((r==="#"||r==="#/")&&t===I.baseId)return b();let g=ES.resolveRef.call($,I,t,r);if(g===void 0)throw new Eh.default(o.opts.uriResolver,t,r);if(g instanceof ES.SchemaEnv)return w(g);return f(g);function b(){if(e===I)return ev(n,u,e,e.$async);let c=i.scopeValue("root",{ref:I});return ev(n,ni._`${c}.validate`,I,I.$async)}function w(c){let S=ZS(n,c);ev(n,S,c,c.$async)}function f(c){let S=i.scopeValue("schema",l.code.source===!0?{ref:c,code:(0,ni.stringify)(c)}:{ref:c}),k=i.name("valid"),d=n.subschema({schema:c,dataTypes:[],schemaPath:ni.nil,topSchemaRef:S,errSchemaPath:r},k);n.mergeEvaluated(d),n.ok(k)}}};function ZS(n,i){let{gen:r}=n;return i.validate?r.scopeValue("validate",{ref:i.validate}):ni._`${r.scopeValue("wrapper",{ref:i})}.validate`}mS.getValidate=ZS;function ev(n,i,r,o){let{gen:t,it:e}=n,{allErrors:u,schemaEnv:l,opts:$}=e,I=$.passContext?Fr.default.this:ni.nil;if(o)g();else b();function g(){if(!l.$async)throw Error("async schema referenced by sync schema");let c=t.let("valid");t.try(()=>{if(t.code(ni._`await ${(0,_S.callValidateCode)(n,i,I)}`),f(i),!u)t.assign(c,!0)},(S)=>{if(t.if(ni._`!(${S} instanceof ${e.ValidationError})`,()=>t.throw(S)),w(S),!u)t.assign(c,!1)}),n.ok(c)}function b(){n.result((0,_S.callValidateCode)(n,i,I),()=>f(i),()=>w(i))}function w(c){let S=ni._`${c}.errors`;t.assign(Fr.default.vErrors,ni._`${Fr.default.vErrors} === null ? ${S} : ${Fr.default.vErrors}.concat(${S})`),t.assign(Fr.default.errors,ni._`${Fr.default.vErrors}.length`)}function f(c){var S;if(!e.opts.unevaluated)return;let k=(S=r===null||r===void 0?void 0:r.validate)===null||S===void 0?void 0:S.evaluated;if(e.props!==!0)if(k&&!k.dynamicProps){if(k.props!==void 0)e.props=ov.mergeEvaluated.props(t,k.props,e.props)}else{let d=t.var("props",ni._`${c}.evaluated.props`);e.props=ov.mergeEvaluated.props(t,d,e.props,ni.Name)}if(e.items!==!0)if(k&&!k.dynamicItems){if(k.items!==void 0)e.items=ov.mergeEvaluated.items(t,k.items,e.items)}else{let d=t.var("items",ni._`${c}.evaluated.items`);e.items=ov.mergeEvaluated.items(t,d,e.items,ni.Name)}}}mS.callRef=ev;mS.default=Zh});var RS=P((CS)=>{Object.defineProperty(CS,"__esModule",{value:!0});var zh=qS(),Ch=zS(),Rh=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",zh.default,Ch.default];CS.default=Rh});var aS=P((xS)=>{Object.defineProperty(xS,"__esModule",{value:!0});var uv=M(),wt=uv.operators,lv={maximum:{okStr:"<=",ok:wt.LTE,fail:wt.GT},minimum:{okStr:">=",ok:wt.GTE,fail:wt.LT},exclusiveMaximum:{okStr:"<",ok:wt.LT,fail:wt.GTE},exclusiveMinimum:{okStr:">",ok:wt.GT,fail:wt.LTE}},ah={message:({keyword:n,schemaCode:i})=>uv.str`must be ${lv[n].okStr} ${i}`,params:({keyword:n,schemaCode:i})=>uv._`{comparison: ${lv[n].okStr}, limit: ${i}}`},sh={keyword:Object.keys(lv),type:"number",schemaType:"number",$data:!0,error:ah,code(n){let{keyword:i,data:r,schemaCode:o}=n;n.fail$data(uv._`${r} ${lv[i].fail} ${o} || isNaN(${r})`)}};xS.default=sh});var nA=P((sS)=>{Object.defineProperty(sS,"__esModule",{value:!0});var we=M(),iP={message:({schemaCode:n})=>we.str`must be multiple of ${n}`,params:({schemaCode:n})=>we._`{multipleOf: ${n}}`},tP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:iP,code(n){let{gen:i,data:r,schemaCode:o,it:t}=n,e=t.opts.multipleOfPrecision,u=i.let("res"),l=e?we._`Math.abs(Math.round(${u}) - ${u}) > 1e-${e}`:we._`${u} !== parseInt(${u})`;n.fail$data(we._`(${o} === 0 || (${u} = ${r}/${o}, ${l}))`)}};sS.default=tP});var rA=P((tA)=>{Object.defineProperty(tA,"__esModule",{value:!0});function iA(n){let i=n.length,r=0,o=0,t;while(o<i)if(r++,t=n.charCodeAt(o++),t>=55296&&t<=56319&&o<i){if(t=n.charCodeAt(o),(t&64512)===56320)o++}return r}tA.default=iA;iA.code='require("ajv/dist/runtime/ucs2length").default'});var eA=P((oA)=>{Object.defineProperty(oA,"__esModule",{value:!0});var Qt=M(),eP=nn(),uP=rA(),lP={message({keyword:n,schemaCode:i}){let r=n==="maxLength"?"more":"fewer";return Qt.str`must NOT have ${r} than ${i} characters`},params:({schemaCode:n})=>Qt._`{limit: ${n}}`},vP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lP,code(n){let{keyword:i,data:r,schemaCode:o,it:t}=n,e=i==="maxLength"?Qt.operators.GT:Qt.operators.LT,u=t.opts.unicode===!1?Qt._`${r}.length`:Qt._`${(0,eP.useFunc)(n.gen,uP.default)}(${r})`;n.fail$data(Qt._`${u} ${e} ${o}`)}};oA.default=vP});var lA=P((uA)=>{Object.defineProperty(uA,"__esModule",{value:!0});var IP=Ii(),gP=nn(),Kr=M(),bP={message:({schemaCode:n})=>Kr.str`must match pattern "${n}"`,params:({schemaCode:n})=>Kr._`{pattern: ${n}}`},wP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:bP,code(n){let{gen:i,data:r,$data:o,schema:t,schemaCode:e,it:u}=n,l=u.opts.unicodeRegExp?"u":"";if(o){let{regExp:$}=u.opts.code,I=$.code==="new RegExp"?Kr._`new RegExp`:(0,gP.useFunc)(i,$),g=i.let("valid");i.try(()=>i.assign(g,Kr._`${I}(${e}, ${l}).test(${r})`),()=>i.assign(g,!1)),n.fail$data(Kr._`!${g}`)}else{let $=(0,IP.usePattern)(n,t);n.fail$data(Kr._`!${$}.test(${r})`)}}};uA.default=wP});var $A=P((vA)=>{Object.defineProperty(vA,"__esModule",{value:!0});var fe=M(),cP={message({keyword:n,schemaCode:i}){let r=n==="maxProperties"?"more":"fewer";return fe.str`must NOT have ${r} than ${i} properties`},params:({schemaCode:n})=>fe._`{limit: ${n}}`},UP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cP,code(n){let{keyword:i,data:r,schemaCode:o}=n,t=i==="maxProperties"?fe.operators.GT:fe.operators.LT;n.fail$data(fe._`Object.keys(${r}).length ${t} ${o}`)}};vA.default=UP});var gA=P((IA)=>{Object.defineProperty(IA,"__esModule",{value:!0});var ce=Ii(),Ue=M(),SP=nn(),AP={message:({params:{missingProperty:n}})=>Ue.str`must have required property '${n}'`,params:({params:{missingProperty:n}})=>Ue._`{missingProperty: ${n}}`},OP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:AP,code(n){let{gen:i,schema:r,schemaCode:o,data:t,$data:e,it:u}=n,{opts:l}=u;if(!e&&r.length===0)return;let $=r.length>=l.loopRequired;if(u.allErrors)I();else g();if(l.strictRequired){let f=n.parentSchema.properties,{definedProperties:c}=n.it;for(let S of r)if((f===null||f===void 0?void 0:f[S])===void 0&&!c.has(S)){let k=u.schemaEnv.baseId+u.errSchemaPath,d=`required property "${S}" is not defined at "${k}" (strictRequired)`;(0,SP.checkStrictMode)(u,d,u.opts.strictRequired)}}function I(){if($||e)n.block$data(Ue.nil,b);else for(let f of r)(0,ce.checkReportMissingProp)(n,f)}function g(){let f=i.let("missing");if($||e){let c=i.let("valid",!0);n.block$data(c,()=>w(f,c)),n.ok(c)}else i.if((0,ce.checkMissingProp)(n,r,f)),(0,ce.reportMissingProp)(n,f),i.else()}function b(){i.forOf("prop",o,(f)=>{n.setParams({missingProperty:f}),i.if((0,ce.noPropertyInData)(i,t,f,l.ownProperties),()=>n.error())})}function w(f,c){n.setParams({missingProperty:f}),i.forOf(f,o,()=>{i.assign(c,(0,ce.propertyInData)(i,t,f,l.ownProperties)),i.if((0,Ue.not)(c),()=>{n.error(),i.break()})},Ue.nil)}}};IA.default=OP});var wA=P((bA)=>{Object.defineProperty(bA,"__esModule",{value:!0});var De=M(),dP={message({keyword:n,schemaCode:i}){let r=n==="maxItems"?"more":"fewer";return De.str`must NOT have ${r} than ${i} items`},params:({schemaCode:n})=>De._`{limit: ${n}}`},LP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:dP,code(n){let{keyword:i,data:r,schemaCode:o}=n,t=i==="maxItems"?De.operators.GT:De.operators.LT;n.fail$data(De._`${r}.length ${t} ${o}`)}};bA.default=LP});var vv=P((cA)=>{Object.defineProperty(cA,"__esModule",{value:!0});var fA=Mc();fA.code='require("ajv/dist/runtime/equal").default';cA.default=fA});var DA=P((UA)=>{Object.defineProperty(UA,"__esModule",{value:!0});var I6=re(),Kn=M(),GP=nn(),jP=vv(),WP={message:({params:{i:n,j:i}})=>Kn.str`must NOT have duplicate items (items ## ${i} and ${n} are identical)`,params:({params:{i:n,j:i}})=>Kn._`{i: ${n}, j: ${i}}`},JP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:WP,code(n){let{gen:i,data:r,$data:o,schema:t,parentSchema:e,schemaCode:u,it:l}=n;if(!o&&!t)return;let $=i.let("valid"),I=e.items?(0,I6.getSchemaTypes)(e.items):[];n.block$data($,g,Kn._`${u} === false`),n.ok($);function g(){let c=i.let("i",Kn._`${r}.length`),S=i.let("j");n.setParams({i:c,j:S}),i.assign($,!0),i.if(Kn._`${c} > 1`,()=>(b()?w:f)(c,S))}function b(){return I.length>0&&!I.some((c)=>c==="object"||c==="array")}function w(c,S){let k=i.name("item"),d=(0,I6.checkDataTypes)(I,k,l.opts.strictNumbers,I6.DataType.Wrong),p=i.const("indices",Kn._`{}`);i.for(Kn._`;${c}--;`,()=>{if(i.let(k,Kn._`${r}[${c}]`),i.if(d,Kn._`continue`),I.length>1)i.if(Kn._`typeof ${k} == "string"`,Kn._`${k} += "_"`);i.if(Kn._`typeof ${p}[${k}] == "number"`,()=>{i.assign(S,Kn._`${p}[${k}]`),n.error(),i.assign($,!1).break()}).code(Kn._`${p}[${k}] = ${c}`)})}function f(c,S){let k=(0,GP.useFunc)(i,jP.default),d=i.name("outer");i.label(d).for(Kn._`;${c}--;`,()=>i.for(Kn._`${S} = ${c}; ${S}--;`,()=>i.if(Kn._`${k}(${r}[${c}], ${r}[${S}])`,()=>{n.error(),i.assign($,!1).break(d)})))}}};UA.default=JP});var AA=P((SA)=>{Object.defineProperty(SA,"__esModule",{value:!0});var g6=M(),XP=nn(),hP=vv(),PP={message:"must be equal to constant",params:({schemaCode:n})=>g6._`{allowedValue: ${n}}`},YP={keyword:"const",$data:!0,error:PP,code(n){let{gen:i,data:r,$data:o,schemaCode:t,schema:e}=n;if(o||e&&typeof e=="object")n.fail$data(g6._`!${(0,XP.useFunc)(i,hP.default)}(${r}, ${t})`);else n.fail(g6._`${e} !== ${r}`)}};SA.default=YP});var kA=P((OA)=>{Object.defineProperty(OA,"__esModule",{value:!0});var Se=M(),QP=nn(),FP=vv(),KP={message:"must be equal to one of the allowed values",params:({schemaCode:n})=>Se._`{allowedValues: ${n}}`},BP={keyword:"enum",schemaType:"array",$data:!0,error:KP,code(n){let{gen:i,data:r,$data:o,schema:t,schemaCode:e,it:u}=n;if(!o&&t.length===0)throw Error("enum must have non-empty array");let l=t.length>=u.opts.loopEnum,$,I=()=>$!==null&&$!==void 0?$:$=(0,QP.useFunc)(i,FP.default),g;if(l||o)g=i.let("valid"),n.block$data(g,b);else{if(!Array.isArray(t))throw Error("ajv implementation error");let f=i.const("vSchema",e);g=(0,Se.or)(...t.map((c,S)=>w(f,S)))}n.pass(g);function b(){i.assign(g,!1),i.forOf("v",e,(f)=>i.if(Se._`${I()}(${r}, ${f})`,()=>i.assign(g,!0).break()))}function w(f,c){let S=t[c];return typeof S==="object"&&S!==null?Se._`${I()}(${r}, ${f}[${c}])`:Se._`${r} === ${S}`}}};OA.default=BP});var LA=P((dA)=>{Object.defineProperty(dA,"__esModule",{value:!0});var TP=aS(),qP=nA(),_P=eA(),EP=lA(),ZP=$A(),mP=gA(),MP=wA(),zP=DA(),CP=AA(),RP=kA(),xP=[TP.default,qP.default,_P.default,EP.default,ZP.default,mP.default,MP.default,zP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CP.default,RP.default];dA.default=xP});var w6=P((yA)=>{Object.defineProperty(yA,"__esModule",{value:!0});yA.validateAdditionalItems=void 0;var Ft=M(),b6=nn(),sP={message:({params:{len:n}})=>Ft.str`must NOT have more than ${n} items`,params:({params:{len:n}})=>Ft._`{limit: ${n}}`},nY={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:sP,code(n){let{parentSchema:i,it:r}=n,{items:o}=i;if(!Array.isArray(o)){(0,b6.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}NA(n,o)}};function NA(n,i){let{gen:r,schema:o,data:t,keyword:e,it:u}=n;u.items=!0;let l=r.const("len",Ft._`${t}.length`);if(o===!1)n.setParams({len:i.length}),n.pass(Ft._`${l} <= ${i.length}`);else if(typeof o=="object"&&!(0,b6.alwaysValidSchema)(u,o)){let I=r.var("valid",Ft._`${l} <= ${i.length}`);r.if((0,Ft.not)(I),()=>$(I)),n.ok(I)}function $(I){r.forRange("i",i.length,l,(g)=>{if(n.subschema({keyword:e,dataProp:g,dataPropType:b6.Type.Num},I),!u.allErrors)r.if((0,Ft.not)(I),()=>r.break())})}}yA.validateAdditionalItems=NA;yA.default=nY});var f6=P((JA)=>{Object.defineProperty(JA,"__esModule",{value:!0});JA.validateTuple=void 0;var jA=M(),$v=nn(),tY=Ii(),rY={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(n){let{schema:i,it:r}=n;if(Array.isArray(i))return WA(n,"additionalItems",i);if(r.items=!0,(0,$v.alwaysValidSchema)(r,i))return;n.ok((0,tY.validateArray)(n))}};function WA(n,i,r=n.schema){let{gen:o,parentSchema:t,data:e,keyword:u,it:l}=n;if(g(t),l.opts.unevaluated&&r.length&&l.items!==!0)l.items=$v.mergeEvaluated.items(o,r.length,l.items);let $=o.name("valid"),I=o.const("len",jA._`${e}.length`);r.forEach((b,w)=>{if((0,$v.alwaysValidSchema)(l,b))return;o.if(jA._`${I} > ${w}`,()=>n.subschema({keyword:u,schemaProp:w,dataProp:w},$)),n.ok($)});function g(b){let{opts:w,errSchemaPath:f}=l,c=r.length,S=c===b.minItems&&(c===b.maxItems||b[i]===!1);if(w.strictTuples&&!S){let k=`"${u}" is ${c}-tuple, but minItems or maxItems/${i} are not specified or different at path "${f}"`;(0,$v.checkStrictMode)(l,k,w.strictTuples)}}}JA.validateTuple=WA;JA.default=rY});var hA=P((XA)=>{Object.defineProperty(XA,"__esModule",{value:!0});var eY=f6(),uY={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,eY.validateTuple)(n,"items")};XA.default=uY});var pA=P((YA)=>{Object.defineProperty(YA,"__esModule",{value:!0});var PA=M(),vY=nn(),$Y=Ii(),IY=w6(),gY={message:({params:{len:n}})=>PA.str`must NOT have more than ${n} items`,params:({params:{len:n}})=>PA._`{limit: ${n}}`},bY={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gY,code(n){let{schema:i,parentSchema:r,it:o}=n,{prefixItems:t}=r;if(o.items=!0,(0,vY.alwaysValidSchema)(o,i))return;if(t)(0,IY.validateAdditionalItems)(n,t);else n.ok((0,$Y.validateArray)(n))}};YA.default=bY});var FA=P((QA)=>{Object.defineProperty(QA,"__esModule",{value:!0});var gi=M(),Iv=nn(),fY={message:({params:{min:n,max:i}})=>i===void 0?gi.str`must contain at least ${n} valid item(s)`:gi.str`must contain at least ${n} and no more than ${i} valid item(s)`,params:({params:{min:n,max:i}})=>i===void 0?gi._`{minContains: ${n}}`:gi._`{minContains: ${n}, maxContains: ${i}}`},cY={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:fY,code(n){let{gen:i,schema:r,parentSchema:o,data:t,it:e}=n,u,l,{minContains:$,maxContains:I}=o;if(e.opts.next)u=$===void 0?1:$,l=I;else u=1;let g=i.const("len",gi._`${t}.length`);if(n.setParams({min:u,max:l}),l===void 0&&u===0){(0,Iv.checkStrictMode)(e,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&u>l){(0,Iv.checkStrictMode)(e,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,Iv.alwaysValidSchema)(e,r)){let S=gi._`${g} >= ${u}`;if(l!==void 0)S=gi._`${S} && ${g} <= ${l}`;n.pass(S);return}e.items=!0;let b=i.name("valid");if(l===void 0&&u===1)f(b,()=>i.if(b,()=>i.break()));else if(u===0){if(i.let(b,!0),l!==void 0)i.if(gi._`${t}.length > 0`,w)}else i.let(b,!1),w();n.result(b,()=>n.reset());function w(){let S=i.name("_valid"),k=i.let("count",0);f(S,()=>i.if(S,()=>c(k)))}function f(S,k){i.forRange("i",0,g,(d)=>{n.subschema({keyword:"contains",dataProp:d,dataPropType:Iv.Type.Num,compositeRule:!0},S),k()})}function c(S){if(i.code(gi._`${S}++`),l===void 0)i.if(gi._`${S} >= ${u}`,()=>i.assign(b,!0).break());else if(i.if(gi._`${S} > ${l}`,()=>i.assign(b,!1).break()),u===1)i.assign(b,!0);else i.if(gi._`${S} >= ${u}`,()=>i.assign(b,!0))}}};QA.default=cY});var _A=P((VA)=>{Object.defineProperty(VA,"__esModule",{value:!0});VA.validateSchemaDeps=VA.validatePropertyDeps=VA.error=void 0;var c6=M(),DY=nn(),Ae=Ii();VA.error={message:({params:{property:n,depsCount:i,deps:r}})=>{let o=i===1?"property":"properties";return c6.str`must have ${o} ${r} when property ${n} is present`},params:({params:{property:n,depsCount:i,deps:r,missingProperty:o}})=>c6._`{property: ${n},
|
||
missingProperty: ${o},
|
||
depsCount: ${i},
|
||
deps: ${r}}`};var SY={keyword:"dependencies",type:"object",schemaType:"object",error:VA.error,code(n){let[i,r]=AY(n);KA(n,i),BA(n,r)}};function AY({schema:n}){let i={},r={};for(let o in n){if(o==="__proto__")continue;let t=Array.isArray(n[o])?i:r;t[o]=n[o]}return[i,r]}function KA(n,i=n.schema){let{gen:r,data:o,it:t}=n;if(Object.keys(i).length===0)return;let e=r.let("missing");for(let u in i){let l=i[u];if(l.length===0)continue;let $=(0,Ae.propertyInData)(r,o,u,t.opts.ownProperties);if(n.setParams({property:u,depsCount:l.length,deps:l.join(", ")}),t.allErrors)r.if($,()=>{for(let I of l)(0,Ae.checkReportMissingProp)(n,I)});else r.if(c6._`${$} && (${(0,Ae.checkMissingProp)(n,l,e)})`),(0,Ae.reportMissingProp)(n,e),r.else()}}VA.validatePropertyDeps=KA;function BA(n,i=n.schema){let{gen:r,data:o,keyword:t,it:e}=n,u=r.name("valid");for(let l in i){if((0,DY.alwaysValidSchema)(e,i[l]))continue;r.if((0,Ae.propertyInData)(r,o,l,e.opts.ownProperties),()=>{let $=n.subschema({keyword:t,schemaProp:l},u);n.mergeValidEvaluated($,u)},()=>r.var(u,!0)),n.ok(u)}}VA.validateSchemaDeps=BA;VA.default=SY});var mA=P((ZA)=>{Object.defineProperty(ZA,"__esModule",{value:!0});var EA=M(),dY=nn(),LY={message:"property name must be valid",params:({params:n})=>EA._`{propertyName: ${n.propertyName}}`},NY={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:LY,code(n){let{gen:i,schema:r,data:o,it:t}=n;if((0,dY.alwaysValidSchema)(t,r))return;let e=i.name("valid");i.forIn("key",o,(u)=>{n.setParams({propertyName:u}),n.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},e),i.if((0,EA.not)(e),()=>{if(n.error(!0),!t.allErrors)i.break()})}),n.ok(e)}};ZA.default=NY});var U6=P((MA)=>{Object.defineProperty(MA,"__esModule",{value:!0});var gv=Ii(),Ai=M(),GY=Ti(),bv=nn(),jY={message:"must NOT have additional properties",params:({params:n})=>Ai._`{additionalProperty: ${n.additionalProperty}}`},WY={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jY,code(n){let{gen:i,schema:r,parentSchema:o,data:t,errsCount:e,it:u}=n;if(!e)throw Error("ajv implementation error");let{allErrors:l,opts:$}=u;if(u.props=!0,$.removeAdditional!=="all"&&(0,bv.alwaysValidSchema)(u,r))return;let I=(0,gv.allSchemaProperties)(o.properties),g=(0,gv.allSchemaProperties)(o.patternProperties);b(),n.ok(Ai._`${e} === ${GY.default.errors}`);function b(){i.forIn("key",t,(k)=>{if(!I.length&&!g.length)c(k);else i.if(w(k),()=>c(k))})}function w(k){let d;if(I.length>8){let p=(0,bv.schemaRefOrVal)(u,o.properties,"properties");d=(0,gv.isOwnProperty)(i,p,k)}else if(I.length)d=(0,Ai.or)(...I.map((p)=>Ai._`${k} === ${p}`));else d=Ai.nil;if(g.length)d=(0,Ai.or)(d,...g.map((p)=>Ai._`${(0,gv.usePattern)(n,p)}.test(${k})`));return(0,Ai.not)(d)}function f(k){i.code(Ai._`delete ${t}[${k}]`)}function c(k){if($.removeAdditional==="all"||$.removeAdditional&&r===!1){f(k);return}if(r===!1){if(n.setParams({additionalProperty:k}),n.error(),!l)i.break();return}if(typeof r=="object"&&!(0,bv.alwaysValidSchema)(u,r)){let d=i.name("valid");if($.removeAdditional==="failing")S(k,d,!1),i.if((0,Ai.not)(d),()=>{n.reset(),f(k)});else if(S(k,d),!l)i.if((0,Ai.not)(d),()=>i.break())}}function S(k,d,p){let h={keyword:"additionalProperties",dataProp:k,dataPropType:bv.Type.Str};if(p===!1)Object.assign(h,{compositeRule:!0,createErrors:!1,allErrors:!1});n.subschema(h,d)}}};MA.default=WY});var xA=P((RA)=>{Object.defineProperty(RA,"__esModule",{value:!0});var HY=le(),zA=Ii(),D6=nn(),CA=U6(),XY={keyword:"properties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,parentSchema:o,data:t,it:e}=n;if(e.opts.removeAdditional==="all"&&o.additionalProperties===void 0)CA.default.code(new HY.KeywordCxt(e,CA.default,"additionalProperties"));let u=(0,zA.allSchemaProperties)(r);for(let b of u)e.definedProperties.add(b);if(e.opts.unevaluated&&u.length&&e.props!==!0)e.props=D6.mergeEvaluated.props(i,(0,D6.toHash)(u),e.props);let l=u.filter((b)=>!(0,D6.alwaysValidSchema)(e,r[b]));if(l.length===0)return;let $=i.name("valid");for(let b of l){if(I(b))g(b);else{if(i.if((0,zA.propertyInData)(i,t,b,e.opts.ownProperties)),g(b),!e.allErrors)i.else().var($,!0);i.endIf()}n.it.definedProperties.add(b),n.ok($)}function I(b){return e.opts.useDefaults&&!e.compositeRule&&r[b].default!==void 0}function g(b){n.subschema({keyword:"properties",schemaProp:b,dataProp:b},$)}}};RA.default=XY});var tO=P((iO)=>{Object.defineProperty(iO,"__esModule",{value:!0});var aA=Ii(),wv=M(),sA=nn(),nO=nn(),PY={keyword:"patternProperties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,data:o,parentSchema:t,it:e}=n,{opts:u}=e,l=(0,aA.allSchemaProperties)(r),$=l.filter((S)=>(0,sA.alwaysValidSchema)(e,r[S]));if(l.length===0||$.length===l.length&&(!e.opts.unevaluated||e.props===!0))return;let I=u.strictSchema&&!u.allowMatchingProperties&&t.properties,g=i.name("valid");if(e.props!==!0&&!(e.props instanceof wv.Name))e.props=(0,nO.evaluatedPropsToName)(i,e.props);let{props:b}=e;w();function w(){for(let S of l){if(I)f(S);if(e.allErrors)c(S);else i.var(g,!0),c(S),i.if(g)}}function f(S){for(let k in I)if(new RegExp(S).test(k))(0,sA.checkStrictMode)(e,`property ${k} matches pattern ${S} (use allowMatchingProperties)`)}function c(S){i.forIn("key",o,(k)=>{i.if(wv._`${(0,aA.usePattern)(n,S)}.test(${k})`,()=>{let d=$.includes(S);if(!d)n.subschema({keyword:"patternProperties",schemaProp:S,dataProp:k,dataPropType:nO.Type.Str},g);if(e.opts.unevaluated&&b!==!0)i.assign(wv._`${b}[${k}]`,!0);else if(!d&&!e.allErrors)i.if((0,wv.not)(g),()=>i.break())})})}}};iO.default=PY});var oO=P((rO)=>{Object.defineProperty(rO,"__esModule",{value:!0});var pY=nn(),QY={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:i,schema:r,it:o}=n;if((0,pY.alwaysValidSchema)(o,r)){n.fail();return}let t=i.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},t),n.failResult(t,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};rO.default=QY});var uO=P((eO)=>{Object.defineProperty(eO,"__esModule",{value:!0});var KY=Ii(),BY={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:KY.validateUnion,error:{message:"must match a schema in anyOf"}};eO.default=BY});var vO=P((lO)=>{Object.defineProperty(lO,"__esModule",{value:!0});var fv=M(),TY=nn(),qY={message:"must match exactly one schema in oneOf",params:({params:n})=>fv._`{passingSchemas: ${n.passing}}`},_Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:qY,code(n){let{gen:i,schema:r,parentSchema:o,it:t}=n;if(!Array.isArray(r))throw Error("ajv implementation error");if(t.opts.discriminator&&o.discriminator)return;let e=r,u=i.let("valid",!1),l=i.let("passing",null),$=i.name("_valid");n.setParams({passing:l}),i.block(I),n.result(u,()=>n.reset(),()=>n.error(!0));function I(){e.forEach((g,b)=>{let w;if((0,TY.alwaysValidSchema)(t,g))i.var($,!0);else w=n.subschema({keyword:"oneOf",schemaProp:b,compositeRule:!0},$);if(b>0)i.if(fv._`${$} && ${u}`).assign(u,!1).assign(l,fv._`[${l}, ${b}]`).else();i.if($,()=>{if(i.assign(u,!0),i.assign(l,b),w)n.mergeEvaluated(w,fv.Name)})})}}};lO.default=_Y});var IO=P(($O)=>{Object.defineProperty($O,"__esModule",{value:!0});var ZY=nn(),mY={keyword:"allOf",schemaType:"array",code(n){let{gen:i,schema:r,it:o}=n;if(!Array.isArray(r))throw Error("ajv implementation error");let t=i.name("valid");r.forEach((e,u)=>{if((0,ZY.alwaysValidSchema)(o,e))return;let l=n.subschema({keyword:"allOf",schemaProp:u},t);n.ok(t),n.mergeEvaluated(l)})}};$O.default=mY});var fO=P((wO)=>{Object.defineProperty(wO,"__esModule",{value:!0});var cv=M(),bO=nn(),zY={message:({params:n})=>cv.str`must match "${n.ifClause}" schema`,params:({params:n})=>cv._`{failingKeyword: ${n.ifClause}}`},CY={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:zY,code(n){let{gen:i,parentSchema:r,it:o}=n;if(r.then===void 0&&r.else===void 0)(0,bO.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let t=gO(o,"then"),e=gO(o,"else");if(!t&&!e)return;let u=i.let("valid",!0),l=i.name("_valid");if($(),n.reset(),t&&e){let g=i.let("ifClause");n.setParams({ifClause:g}),i.if(l,I("then",g),I("else",g))}else if(t)i.if(l,I("then"));else i.if((0,cv.not)(l),I("else"));n.pass(u,()=>n.error(!0));function $(){let g=n.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);n.mergeEvaluated(g)}function I(g,b){return()=>{let w=n.subschema({keyword:g},l);if(i.assign(u,l),n.mergeValidEvaluated(w,u),b)i.assign(b,cv._`${g}`);else n.setParams({ifClause:g})}}}};function gO(n,i){let r=n.schema[i];return r!==void 0&&!(0,bO.alwaysValidSchema)(n,r)}wO.default=CY});var UO=P((cO)=>{Object.defineProperty(cO,"__esModule",{value:!0});var xY=nn(),aY={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:i,it:r}){if(i.if===void 0)(0,xY.checkStrictMode)(r,`"${n}" without "if" is ignored`)}};cO.default=aY});var SO=P((DO)=>{Object.defineProperty(DO,"__esModule",{value:!0});var np=w6(),ip=hA(),tp=f6(),rp=pA(),op=FA(),ep=_A(),up=mA(),lp=U6(),vp=xA(),$p=tO(),Ip=oO(),gp=uO(),bp=vO(),wp=IO(),fp=fO(),cp=UO();function Up(n=!1){let i=[Ip.default,gp.default,bp.default,wp.default,fp.default,cp.default,up.default,lp.default,ep.default,vp.default,$p.default];if(n)i.push(ip.default,rp.default);else i.push(np.default,tp.default);return i.push(op.default),i}DO.default=Up});var OO=P((AO)=>{Object.defineProperty(AO,"__esModule",{value:!0});var Ln=M(),Sp={message:({schemaCode:n})=>Ln.str`must match format "${n}"`,params:({schemaCode:n})=>Ln._`{format: ${n}}`},Ap={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Sp,code(n,i){let{gen:r,data:o,$data:t,schema:e,schemaCode:u,it:l}=n,{opts:$,errSchemaPath:I,schemaEnv:g,self:b}=l;if(!$.validateFormats)return;if(t)w();else f();function w(){let c=r.scopeValue("formats",{ref:b.formats,code:$.code.formats}),S=r.const("fDef",Ln._`${c}[${u}]`),k=r.let("fType"),d=r.let("format");r.if(Ln._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>r.assign(k,Ln._`${S}.type || "string"`).assign(d,Ln._`${S}.validate`),()=>r.assign(k,Ln._`"string"`).assign(d,S)),n.fail$data((0,Ln.or)(p(),h()));function p(){if($.strictSchema===!1)return Ln.nil;return Ln._`${u} && !${d}`}function h(){let j=g.$async?Ln._`(${S}.async ? await ${d}(${o}) : ${d}(${o}))`:Ln._`${d}(${o})`,L=Ln._`(typeof ${d} == "function" ? ${j} : ${d}.test(${o}))`;return Ln._`${d} && ${d} !== true && ${k} === ${i} && !${L}`}}function f(){let c=b.formats[e];if(!c){p();return}if(c===!0)return;let[S,k,d]=h(c);if(S===i)n.pass(j());function p(){if($.strictSchema===!1){b.logger.warn(L());return}throw Error(L());function L(){return`unknown format "${e}" ignored in schema at path "${I}"`}}function h(L){let q=L instanceof RegExp?(0,Ln.regexpCode)(L):$.code.formats?Ln._`${$.code.formats}${(0,Ln.getProperty)(e)}`:void 0,x=r.scopeValue("formats",{key:e,ref:L,code:q});if(typeof L=="object"&&!(L instanceof RegExp))return[L.type||"string",L.validate,Ln._`${x}.validate`];return["string",L,x]}function j(){if(typeof c=="object"&&!(c instanceof RegExp)&&c.async){if(!g.$async)throw Error("async format in sync schema");return Ln._`await ${d}(${o})`}return typeof k=="function"?Ln._`${d}(${o})`:Ln._`${d}.test(${o})`}}}};AO.default=Ap});var dO=P((kO)=>{Object.defineProperty(kO,"__esModule",{value:!0});var kp=OO(),dp=[kp.default];kO.default=dp});var yO=P((LO)=>{Object.defineProperty(LO,"__esModule",{value:!0});LO.contentVocabulary=LO.metadataVocabulary=void 0;LO.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];LO.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var WO=P((jO)=>{Object.defineProperty(jO,"__esModule",{value:!0});var yp=RS(),Gp=LA(),jp=SO(),Wp=dO(),GO=yO(),Jp=[yp.default,Gp.default,(0,jp.default)(),Wp.default,GO.metadataVocabulary,GO.contentVocabulary];jO.default=Jp});var hO=P((HO)=>{Object.defineProperty(HO,"__esModule",{value:!0});HO.DiscrError=void 0;var JO;(function(n){n.Tag="tag",n.Mapping="mapping"})(JO||(HO.DiscrError=JO={}))});var pO=P((YO)=>{Object.defineProperty(YO,"__esModule",{value:!0});var Br=M(),S6=hO(),PO=al(),Xp=ve(),hp=nn(),Pp={message:({params:{discrError:n,tagName:i}})=>n===S6.DiscrError.Tag?`tag "${i}" must be string`:`value of tag "${i}" must be in oneOf`,params:({params:{discrError:n,tag:i,tagName:r}})=>Br._`{error: ${n}, tag: ${r}, tagValue: ${i}}`},Yp={keyword:"discriminator",type:"object",schemaType:"object",error:Pp,code(n){let{gen:i,data:r,schema:o,parentSchema:t,it:e}=n,{oneOf:u}=t;if(!e.opts.discriminator)throw Error("discriminator: requires discriminator option");let l=o.propertyName;if(typeof l!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!u)throw Error("discriminator: requires oneOf keyword");let $=i.let("valid",!1),I=i.const("tag",Br._`${r}${(0,Br.getProperty)(l)}`);i.if(Br._`typeof ${I} == "string"`,()=>g(),()=>n.error(!1,{discrError:S6.DiscrError.Tag,tag:I,tagName:l})),n.ok($);function g(){let f=w();i.if(!1);for(let c in f)i.elseIf(Br._`${I} === ${c}`),i.assign($,b(f[c]));i.else(),n.error(!1,{discrError:S6.DiscrError.Mapping,tag:I,tagName:l}),i.endIf()}function b(f){let c=i.name("valid"),S=n.subschema({keyword:"oneOf",schemaProp:f},c);return n.mergeEvaluated(S,Br.Name),c}function w(){var f;let c={},S=d(t),k=!0;for(let j=0;j<u.length;j++){let L=u[j];if((L===null||L===void 0?void 0:L.$ref)&&!(0,hp.schemaHasRulesButRef)(L,e.self.RULES)){let x=L.$ref;if(L=PO.resolveRef.call(e.self,e.schemaEnv.root,e.baseId,x),L instanceof PO.SchemaEnv)L=L.schema;if(L===void 0)throw new Xp.default(e.opts.uriResolver,e.baseId,x)}let q=(f=L===null||L===void 0?void 0:L.properties)===null||f===void 0?void 0:f[l];if(typeof q!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);k=k&&(S||d(L)),p(q,j)}if(!k)throw Error(`discriminator: "${l}" must be required`);return c;function d({required:j}){return Array.isArray(j)&&j.includes(l)}function p(j,L){if(j.const)h(j.const,L);else if(j.enum)for(let q of j.enum)h(q,L);else throw Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function h(j,L){if(typeof j!="string"||j in c)throw Error(`discriminator: "${l}" values must be unique strings`);c[j]=L}}}};YO.default=Yp});var QO=P((uZ,Qp)=>{Qp.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 O6=P((ii,A6)=>{Object.defineProperty(ii,"__esModule",{value:!0});ii.MissingRefError=ii.ValidationError=ii.CodeGen=ii.Name=ii.nil=ii.stringify=ii.str=ii._=ii.KeywordCxt=ii.Ajv=void 0;var Fp=VS(),Kp=WO(),Bp=pO(),FO=QO(),Vp=["/properties"],Uv="http://json-schema.org/draft-07/schema";class Oe extends Fp.default{_addVocabularies(){if(super._addVocabularies(),Kp.default.forEach((n)=>this.addVocabulary(n)),this.opts.discriminator)this.addKeyword(Bp.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let n=this.opts.$data?this.$dataMetaSchema(FO,Vp):FO;this.addMetaSchema(n,Uv,!1),this.refs["http://json-schema.org/schema"]=Uv}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Uv)?Uv:void 0)}}ii.Ajv=Oe;A6.exports=ii=Oe;A6.exports.Ajv=Oe;Object.defineProperty(ii,"__esModule",{value:!0});ii.default=Oe;var Tp=le();Object.defineProperty(ii,"KeywordCxt",{enumerable:!0,get:function(){return Tp.KeywordCxt}});var Vr=M();Object.defineProperty(ii,"_",{enumerable:!0,get:function(){return Vr._}});Object.defineProperty(ii,"str",{enumerable:!0,get:function(){return Vr.str}});Object.defineProperty(ii,"stringify",{enumerable:!0,get:function(){return Vr.stringify}});Object.defineProperty(ii,"nil",{enumerable:!0,get:function(){return Vr.nil}});Object.defineProperty(ii,"Name",{enumerable:!0,get:function(){return Vr.Name}});Object.defineProperty(ii,"CodeGen",{enumerable:!0,get:function(){return Vr.CodeGen}});var qp=Rl();Object.defineProperty(ii,"ValidationError",{enumerable:!0,get:function(){return qp.default}});var _p=ve();Object.defineProperty(ii,"MissingRefError",{enumerable:!0,get:function(){return _p.default}})});var MO=P((ZO)=>{Object.defineProperty(ZO,"__esModule",{value:!0});ZO.formatNames=ZO.fastFormats=ZO.fullFormats=void 0;function Hi(n,i){return{validate:n,compare:i}}ZO.fullFormats={date:Hi(TO,N6),time:Hi(d6(!0),y6),"date-time":Hi(KO(!0),_O),"iso-time":Hi(d6(),qO),"iso-date-time":Hi(KO(),EO),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xp,"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:o7,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:ap,int32:{type:"number",validate:i7},int64:{type:"number",validate:t7},float:{type:"number",validate:VO},double:{type:"number",validate:VO},password:!0,binary:!0};ZO.fastFormats={...ZO.fullFormats,date:Hi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,N6),time:Hi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,y6),"date-time":Hi(/^\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,_O),"iso-time":Hi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,qO),"iso-date-time":Hi(/^\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,EO),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};ZO.formatNames=Object.keys(ZO.fullFormats);function mp(n){return n%4===0&&(n%100!==0||n%400===0)}var Mp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,zp=[0,31,28,31,30,31,30,31,31,30,31,30,31];function TO(n){let i=Mp.exec(n);if(!i)return!1;let r=+i[1],o=+i[2],t=+i[3];return o>=1&&o<=12&&t>=1&&t<=(o===2&&mp(r)?29:zp[o])}function N6(n,i){if(!(n&&i))return;if(n>i)return 1;if(n<i)return-1;return 0}var k6=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function d6(n){return function(r){let o=k6.exec(r);if(!o)return!1;let t=+o[1],e=+o[2],u=+o[3],l=o[4],$=o[5]==="-"?-1:1,I=+(o[6]||0),g=+(o[7]||0);if(I>23||g>59||n&&!l)return!1;if(t<=23&&e<=59&&u<60)return!0;let b=e-g*$,w=t-I*$-(b<0?1:0);return(w===23||w===-1)&&(b===59||b===-1)&&u<61}}function y6(n,i){if(!(n&&i))return;let r=new Date("2020-01-01T"+n).valueOf(),o=new Date("2020-01-01T"+i).valueOf();if(!(r&&o))return;return r-o}function qO(n,i){if(!(n&&i))return;let r=k6.exec(n),o=k6.exec(i);if(!(r&&o))return;if(n=r[1]+r[2]+r[3],i=o[1]+o[2]+o[3],n>i)return 1;if(n<i)return-1;return 0}var L6=/t|\s/i;function KO(n){let i=d6(n);return function(o){let t=o.split(L6);return t.length===2&&TO(t[0])&&i(t[1])}}function _O(n,i){if(!(n&&i))return;let r=new Date(n).valueOf(),o=new Date(i).valueOf();if(!(r&&o))return;return r-o}function EO(n,i){if(!(n&&i))return;let[r,o]=n.split(L6),[t,e]=i.split(L6),u=N6(r,t);if(u===void 0)return;return u||y6(o,e)}var Cp=/\/|:/,Rp=/^(?:[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 xp(n){return Cp.test(n)&&Rp.test(n)}var BO=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function ap(n){return BO.lastIndex=0,BO.test(n)}var sp=-2147483648,n7=2147483647;function i7(n){return Number.isInteger(n)&&n<=n7&&n>=sp}function t7(n){return Number.isInteger(n)}function VO(){return!0}var r7=/[^\\]\\Z/;function o7(n){if(r7.test(n))return!1;try{return new RegExp(n),!0}catch(i){return!1}}});var CO=P((zO)=>{Object.defineProperty(zO,"__esModule",{value:!0});zO.formatLimitDefinition=void 0;var u7=O6(),Oi=M(),ft=Oi.operators,Dv={formatMaximum:{okStr:"<=",ok:ft.LTE,fail:ft.GT},formatMinimum:{okStr:">=",ok:ft.GTE,fail:ft.LT},formatExclusiveMaximum:{okStr:"<",ok:ft.LT,fail:ft.GTE},formatExclusiveMinimum:{okStr:">",ok:ft.GT,fail:ft.LTE}},l7={message:({keyword:n,schemaCode:i})=>Oi.str`should be ${Dv[n].okStr} ${i}`,params:({keyword:n,schemaCode:i})=>Oi._`{comparison: ${Dv[n].okStr}, limit: ${i}}`};zO.formatLimitDefinition={keyword:Object.keys(Dv),type:"string",schemaType:"string",$data:!0,error:l7,code(n){let{gen:i,data:r,schemaCode:o,keyword:t,it:e}=n,{opts:u,self:l}=e;if(!u.validateFormats)return;let $=new u7.KeywordCxt(e,l.RULES.all.format.definition,"format");if($.$data)I();else g();function I(){let w=i.scopeValue("formats",{ref:l.formats,code:u.code.formats}),f=i.const("fmt",Oi._`${w}[${$.schemaCode}]`);n.fail$data((0,Oi.or)(Oi._`typeof ${f} != "object"`,Oi._`${f} instanceof RegExp`,Oi._`typeof ${f}.compare != "function"`,b(f)))}function g(){let w=$.schema,f=l.formats[w];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${t}": format "${w}" does not define "compare" function`);let c=i.scopeValue("formats",{key:w,ref:f,code:u.code.formats?Oi._`${u.code.formats}${(0,Oi.getProperty)(w)}`:void 0});n.fail$data(b(c))}function b(w){return Oi._`${w}.compare(${r}, ${o}) ${Dv[t].fail} 0`}},dependencies:["format"]};var v7=(n)=>{return n.addKeyword(zO.formatLimitDefinition),n};zO.default=v7});var sO=P((ke,aO)=>{Object.defineProperty(ke,"__esModule",{value:!0});var Tr=MO(),I7=CO(),W6=M(),RO=new W6.Name("fullFormats"),g7=new W6.Name("fastFormats"),J6=(n,i={keywords:!0})=>{if(Array.isArray(i))return xO(n,i,Tr.fullFormats,RO),n;let[r,o]=i.mode==="fast"?[Tr.fastFormats,g7]:[Tr.fullFormats,RO],t=i.formats||Tr.formatNames;if(xO(n,t,r,o),i.keywords)(0,I7.default)(n);return n};J6.get=(n,i="full")=>{let o=(i==="fast"?Tr.fastFormats:Tr.fullFormats)[n];if(!o)throw Error(`Unknown format "${n}"`);return o};function xO(n,i,r,o){var t,e;(t=(e=n.opts.code).formats)!==null&&t!==void 0||(e.formats=W6._`require("ajv-formats/dist/formats").${o}`);for(let u of i)n.addFormat(u,r[u])}aO.exports=ke=J6;Object.defineProperty(ke,"__esModule",{value:!0});ke.default=J6});import{dirname as Ze,resolve as $y}from"node:path";import{fileURLToPath as YF}from"node:url";var Ki={};pi(Ki,{version:()=>kI,util:()=>G,treeifyError:()=>G$,toJSONSchema:()=>Eu,toDotPath:()=>s4,safeParseAsync:()=>bo,safeParse:()=>at,safeEncodeAsync:()=>u0,safeEncode:()=>o0,safeDecodeAsync:()=>l0,safeDecode:()=>e0,registry:()=>cu,regexes:()=>oi,process:()=>un,prettifyError:()=>j$,parseAsync:()=>go,parse:()=>Io,meta:()=>ww,locales:()=>No,isValidJWT:()=>J0,isValidBase64URL:()=>W0,isValidBase64:()=>_I,initializeContext:()=>it,globalRegistry:()=>hn,globalConfig:()=>dt,formatError:()=>$o,flattenError:()=>vo,finalize:()=>rt,extractDefs:()=>tt,encodeAsync:()=>t0,encode:()=>n0,describe:()=>bw,decodeAsync:()=>r0,decode:()=>i0,createToJSONSchemaMethod:()=>cw,createStandardJSONSchemaMethod:()=>cr,config:()=>kn,clone:()=>qn,_xor:()=>Lj,_xid:()=>Gu,_void:()=>rw,_uuidv7:()=>Ou,_uuidv6:()=>Au,_uuidv4:()=>Su,_uuid:()=>Du,_url:()=>Go,_uppercase:()=>or,_unknown:()=>iw,_union:()=>dj,_undefined:()=>ab,_ulid:()=>yu,_uint64:()=>Rb,_uint32:()=>Eb,_tuple:()=>Gj,_trim:()=>Ir,_transform:()=>Pj,_toUpperCase:()=>br,_toLowerCase:()=>gr,_templateLiteral:()=>qj,_symbol:()=>xb,_superRefine:()=>gw,_success:()=>Kj,_stringbool:()=>fw,_stringFormat:()=>fr,_string:()=>Hb,_startsWith:()=>ur,_slugify:()=>wr,_size:()=>jt,_set:()=>Jj,_safeParseAsync:()=>st,_safeParse:()=>xt,_safeEncodeAsync:()=>nu,_safeEncode:()=>ae,_safeDecodeAsync:()=>iu,_safeDecode:()=>se,_regex:()=>tr,_refine:()=>Iw,_record:()=>jj,_readonly:()=>Tj,_property:()=>Vu,_promise:()=>Ej,_positive:()=>Qu,_pipe:()=>Vj,_parseAsync:()=>Rt,_parse:()=>Ct,_overwrite:()=>fi,_optional:()=>Yj,_number:()=>Kb,_nullable:()=>pj,_null:()=>sb,_normalize:()=>$r,_nonpositive:()=>Ku,_nonoptional:()=>Fj,_nonnegative:()=>Bu,_never:()=>tw,_negative:()=>Fu,_nativeEnum:()=>Xj,_nanoid:()=>du,_nan:()=>uw,_multipleOf:()=>si,_minSize:()=>ji,_minLength:()=>Fi,_min:()=>En,_mime:()=>vr,_maxSize:()=>nt,_maxLength:()=>Wt,_max:()=>ei,_map:()=>Wj,_mac:()=>hb,_lte:()=>ei,_lt:()=>yi,_lowercase:()=>rr,_literal:()=>hj,_length:()=>Jt,_lazy:()=>_j,_ksuid:()=>ju,_jwt:()=>pu,_isoTime:()=>Qb,_isoDuration:()=>Fb,_isoDateTime:()=>Yb,_isoDate:()=>pb,_ipv6:()=>Ju,_ipv4:()=>Wu,_intersection:()=>yj,_int64:()=>Cb,_int32:()=>_b,_int:()=>Vb,_includes:()=>er,_guid:()=>yo,_gte:()=>En,_gt:()=>Gi,_float64:()=>qb,_float32:()=>Tb,_file:()=>vw,_enum:()=>Hj,_endsWith:()=>lr,_encodeAsync:()=>Re,_encode:()=>ze,_emoji:()=>ku,_email:()=>Uu,_e164:()=>Yu,_discriminatedUnion:()=>Nj,_default:()=>Qj,_decodeAsync:()=>xe,_decode:()=>Ce,_date:()=>ow,_custom:()=>$w,_cuid2:()=>Nu,_cuid:()=>Lu,_coercedString:()=>Xb,_coercedNumber:()=>Bb,_coercedDate:()=>ew,_coercedBoolean:()=>mb,_coercedBigint:()=>zb,_cidrv6:()=>Xu,_cidrv4:()=>Hu,_check:()=>K0,_catch:()=>Bj,_boolean:()=>Zb,_bigint:()=>Mb,_base64url:()=>Pu,_base64:()=>hu,_array:()=>lw,_any:()=>nw,TimePrecision:()=>Pb,NEVER:()=>f$,JSONSchemaGenerator:()=>sw,JSONSchema:()=>B0,Doc:()=>eu,$output:()=>jb,$input:()=>Wb,$constructor:()=>U,$brand:()=>c$,$ZodXor:()=>lg,$ZodXID:()=>hI,$ZodVoid:()=>rg,$ZodUnknown:()=>ig,$ZodUnion:()=>Do,$ZodUndefined:()=>aI,$ZodUUID:()=>NI,$ZodURL:()=>GI,$ZodULID:()=>XI,$ZodType:()=>B,$ZodTuple:()=>bu,$ZodTransform:()=>Ug,$ZodTemplateLiteral:()=>jg,$ZodSymbol:()=>xI,$ZodSuccess:()=>dg,$ZodStringFormat:()=>$n,$ZodString:()=>Gt,$ZodSet:()=>bg,$ZodRegistry:()=>Jb,$ZodRecord:()=>Ig,$ZodRealError:()=>Rn,$ZodReadonly:()=>Gg,$ZodPromise:()=>Jg,$ZodPreprocess:()=>yg,$ZodPrefault:()=>Og,$ZodPipe:()=>fu,$ZodOptional:()=>wu,$ZodObjectJIT:()=>ug,$ZodObject:()=>h0,$ZodNumberFormat:()=>CI,$ZodNumber:()=>Iu,$ZodNullable:()=>Sg,$ZodNull:()=>sI,$ZodNonOptional:()=>kg,$ZodNever:()=>tg,$ZodNanoID:()=>WI,$ZodNaN:()=>Ng,$ZodMap:()=>gg,$ZodMAC:()=>VI,$ZodLiteral:()=>fg,$ZodLazy:()=>Hg,$ZodKSUID:()=>PI,$ZodJWT:()=>MI,$ZodIntersection:()=>$g,$ZodISOTime:()=>QI,$ZodISODuration:()=>FI,$ZodISODateTime:()=>YI,$ZodISODate:()=>pI,$ZodIPv6:()=>BI,$ZodIPv4:()=>KI,$ZodGUID:()=>LI,$ZodFunction:()=>Wg,$ZodFile:()=>cg,$ZodExactOptional:()=>Dg,$ZodError:()=>lo,$ZodEnum:()=>wg,$ZodEncodeError:()=>Lt,$ZodEmoji:()=>jI,$ZodEmail:()=>yI,$ZodE164:()=>mI,$ZodDiscriminatedUnion:()=>vg,$ZodDefault:()=>Ag,$ZodDate:()=>og,$ZodCustomStringFormat:()=>zI,$ZodCustom:()=>Xg,$ZodCodec:()=>So,$ZodCheckUpperCase:()=>fI,$ZodCheckStringFormat:()=>nr,$ZodCheckStartsWith:()=>UI,$ZodCheckSizeEquals:()=>vI,$ZodCheckRegex:()=>bI,$ZodCheckProperty:()=>SI,$ZodCheckOverwrite:()=>OI,$ZodCheckNumberFormat:()=>oI,$ZodCheckMultipleOf:()=>rI,$ZodCheckMinSize:()=>lI,$ZodCheckMinLength:()=>II,$ZodCheckMimeType:()=>AI,$ZodCheckMaxSize:()=>uI,$ZodCheckMaxLength:()=>$I,$ZodCheckLowerCase:()=>wI,$ZodCheckLessThan:()=>ru,$ZodCheckLengthEquals:()=>gI,$ZodCheckIncludes:()=>cI,$ZodCheckGreaterThan:()=>ou,$ZodCheckEndsWith:()=>DI,$ZodCheckBigIntFormat:()=>eI,$ZodCheck:()=>wn,$ZodCatch:()=>Lg,$ZodCUID2:()=>HI,$ZodCUID:()=>JI,$ZodCIDRv6:()=>qI,$ZodCIDRv4:()=>TI,$ZodBoolean:()=>Uo,$ZodBigIntFormat:()=>RI,$ZodBigInt:()=>gu,$ZodBase64URL:()=>ZI,$ZodBase64:()=>EI,$ZodAsyncError:()=>Ni,$ZodArray:()=>eg,$ZodAny:()=>ng});var M4,f$=Object.freeze({status:"aborted"});function U(n,i,r){function o(l,$){if(!l._zod)Object.defineProperty(l,"_zod",{value:{def:$,constr:u,traits:new Set},enumerable:!1});if(l._zod.traits.has(n))return;l._zod.traits.add(n),i(l,$);let I=u.prototype,g=Object.keys(I);for(let b=0;b<g.length;b++){let w=g[b];if(!(w in l))l[w]=I[w].bind(l)}}let t=r?.Parent??Object;class e extends t{}Object.defineProperty(e,"name",{value:n});function u(l){var $;let I=r?.Parent?new e:this;o(I,l),($=I._zod).deferred??($.deferred=[]);for(let g of I._zod.deferred)g();return I}return Object.defineProperty(u,"init",{value:o}),Object.defineProperty(u,Symbol.hasInstance,{value:(l)=>{if(r?.Parent&&l instanceof r.Parent)return!0;return l?._zod?.traits?.has(n)}}),Object.defineProperty(u,"name",{value:n}),u}var c$=Symbol("zod_brand");class Ni extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Lt extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}(M4=globalThis).__zod_globalConfig??(M4.__zod_globalConfig={});var dt=globalThis.__zod_globalConfig;function kn(n){if(n)Object.assign(dt,n);return dt}var G={};pi(G,{unwrapMessage:()=>io,uint8ArrayToHex:()=>Cy,uint8ArrayToBase64url:()=>My,uint8ArrayToBase64:()=>R4,stringifyPrimitive:()=>N,slugify:()=>S$,shallowClone:()=>O$,safeExtend:()=>Ty,required:()=>Ey,randomString:()=>Yy,propertyKeyTypes:()=>oo,promiseAllObject:()=>Py,primitiveTypes:()=>k$,prefixIssues:()=>Cn,pick:()=>Ky,partial:()=>_y,parsedType:()=>y,optionalKeys:()=>d$,omit:()=>By,objectClone:()=>Hy,numKeys:()=>py,nullish:()=>Ci,normalizeParams:()=>W,mergeDefs:()=>Qi,merge:()=>qy,jsonStringifyReplacer:()=>mt,joinValues:()=>A,issue:()=>zt,isPlainObject:()=>xi,isObject:()=>Nt,hexToUint8Array:()=>zy,getSizableOrigin:()=>eo,getParsedType:()=>Qy,getLengthableOrigin:()=>uo,getEnumValues:()=>to,getElementAtPath:()=>hy,floatSafeRemainder:()=>D$,finalizeIssue:()=>_n,extend:()=>Vy,explicitlyAborted:()=>y$,escapeRegex:()=>li,esc:()=>me,defineLazy:()=>z,createTransparentProxy:()=>Fy,cloneDef:()=>Xy,clone:()=>qn,cleanRegex:()=>ro,cleanEnum:()=>Zy,captureStackTrace:()=>Me,cached:()=>Mt,base64urlToUint8Array:()=>my,base64ToUint8Array:()=>C4,assignProp:()=>Ri,assertNotEqual:()=>Gy,assertNever:()=>Wy,assertIs:()=>jy,assertEqual:()=>yy,assert:()=>Jy,allowsEval:()=>A$,aborted:()=>ai,NUMBER_FORMAT_RANGES:()=>L$,Class:()=>x4,BIGINT_FORMAT_RANGES:()=>N$});function yy(n){return n}function Gy(n){return n}function jy(n){}function Wy(n){throw Error("Unexpected value in exhaustive check")}function Jy(n){}function to(n){let i=Object.values(n).filter((o)=>typeof o==="number");return Object.entries(n).filter(([o,t])=>i.indexOf(+o)===-1).map(([o,t])=>t)}function A(n,i="|"){return n.map((r)=>N(r)).join(i)}function mt(n,i){if(typeof i==="bigint")return i.toString();return i}function Mt(n){return{get value(){{let r=n();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Ci(n){return n===null||n===void 0}function ro(n){let i=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;return n.slice(i,r)}function D$(n,i){let r=n/i,o=Math.round(r),t=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<t)return 0;return r-o}var z4=Symbol("evaluating");function z(n,i,r){let o=void 0;Object.defineProperty(n,i,{get(){if(o===z4)return;if(o===void 0)o=z4,o=r();return o},set(t){Object.defineProperty(n,i,{value:t})},configurable:!0})}function Hy(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function Ri(n,i,r){Object.defineProperty(n,i,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qi(...n){let i={};for(let r of n){let o=Object.getOwnPropertyDescriptors(r);Object.assign(i,o)}return Object.defineProperties({},i)}function Xy(n){return Qi(n._zod.def)}function hy(n,i){if(!i)return n;return i.reduce((r,o)=>r?.[o],n)}function Py(n){let i=Object.keys(n),r=i.map((o)=>n[o]);return Promise.all(r).then((o)=>{let t={};for(let e=0;e<i.length;e++)t[i[e]]=o[e];return t})}function Yy(n=10){let r="";for(let o=0;o<n;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function me(n){return JSON.stringify(n)}function S$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Me="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Nt(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var A$=Mt(()=>{if(dt.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function xi(n){if(Nt(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let r=i.prototype;if(Nt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function O$(n){if(xi(n))return{...n};if(Array.isArray(n))return[...n];if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);return n}function py(n){let i=0;for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))i++;return i}var Qy=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},oo=new Set(["string","number","symbol"]),k$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function li(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(n,i,r){let o=new n._zod.constr(i??n._zod.def);if(!i||r?.parent)o._zod.parent=n;return o}function W(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function Fy(n){let i;return new Proxy({},{get(r,o,t){return i??(i=n()),Reflect.get(i,o,t)},set(r,o,t,e){return i??(i=n()),Reflect.set(i,o,t,e)},has(r,o){return i??(i=n()),Reflect.has(i,o)},deleteProperty(r,o){return i??(i=n()),Reflect.deleteProperty(i,o)},ownKeys(r){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(r,o){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,o)},defineProperty(r,o,t){return i??(i=n()),Reflect.defineProperty(i,o,t)}})}function N(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function d$(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var L$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},N$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ky(n,i){let r=n._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=Qi(n._zod.def,{get shape(){let u={};for(let l in i){if(!(l in r.shape))throw Error(`Unrecognized key: "${l}"`);if(!i[l])continue;u[l]=r.shape[l]}return Ri(this,"shape",u),u},checks:[]});return qn(n,e)}function By(n,i){let r=n._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=Qi(n._zod.def,{get shape(){let u={...n._zod.def.shape};for(let l in i){if(!(l in r.shape))throw Error(`Unrecognized key: "${l}"`);if(!i[l])continue;delete u[l]}return Ri(this,"shape",u),u},checks:[]});return qn(n,e)}function Vy(n,i){if(!xi(i))throw Error("Invalid input to extend: expected a plain object");let r=n._zod.def.checks;if(r&&r.length>0){let e=n._zod.def.shape;for(let u in i)if(Object.getOwnPropertyDescriptor(e,u)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let t=Qi(n._zod.def,{get shape(){let e={...n._zod.def.shape,...i};return Ri(this,"shape",e),e}});return qn(n,t)}function Ty(n,i){if(!xi(i))throw Error("Invalid input to safeExtend: expected a plain object");let r=Qi(n._zod.def,{get shape(){let o={...n._zod.def.shape,...i};return Ri(this,"shape",o),o}});return qn(n,r)}function qy(n,i){if(n._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Qi(n._zod.def,{get shape(){let o={...n._zod.def.shape,...i._zod.def.shape};return Ri(this,"shape",o),o},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return qn(n,r)}function _y(n,i,r){let t=i._zod.def.checks;if(t&&t.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let u=Qi(i._zod.def,{get shape(){let l=i._zod.def.shape,$={...l};if(r)for(let I in r){if(!(I in l))throw Error(`Unrecognized key: "${I}"`);if(!r[I])continue;$[I]=n?new n({type:"optional",innerType:l[I]}):l[I]}else for(let I in l)$[I]=n?new n({type:"optional",innerType:l[I]}):l[I];return Ri(this,"shape",$),$},checks:[]});return qn(i,u)}function Ey(n,i,r){let o=Qi(i._zod.def,{get shape(){let t=i._zod.def.shape,e={...t};if(r)for(let u in r){if(!(u in e))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;e[u]=new n({type:"nonoptional",innerType:t[u]})}else for(let u in t)e[u]=new n({type:"nonoptional",innerType:t[u]});return Ri(this,"shape",e),e}});return qn(i,o)}function ai(n,i=0){if(n.aborted===!0)return!0;for(let r=i;r<n.issues.length;r++)if(n.issues[r]?.continue!==!0)return!0;return!1}function y$(n,i=0){if(n.aborted===!0)return!0;for(let r=i;r<n.issues.length;r++)if(n.issues[r]?.continue===!1)return!0;return!1}function Cn(n,i){return i.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(n),r})}function io(n){return typeof n==="string"?n:n?.message}function _n(n,i,r){let o=n.message?n.message:io(n.inst?._zod.def?.error?.(n))??io(i?.error?.(n))??io(r.customError?.(n))??io(r.localeError?.(n))??"Invalid input",{inst:t,continue:e,input:u,...l}=n;if(l.path??(l.path=[]),l.message=o,i?.reportInput)l.input=u;return l}function eo(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function uo(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function y(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let r=n;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return i}function zt(...n){let[i,r,o]=n;if(typeof i==="string")return{message:i,code:"custom",input:r,inst:o};return{...i}}function Zy(n){return Object.entries(n).filter(([i,r])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function C4(n){let i=atob(n),r=new Uint8Array(i.length);for(let o=0;o<i.length;o++)r[o]=i.charCodeAt(o);return r}function R4(n){let i="";for(let r=0;r<n.length;r++)i+=String.fromCharCode(n[r]);return btoa(i)}function my(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-i.length%4)%4);return C4(i+r)}function My(n){return R4(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zy(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(i.length/2);for(let o=0;o<i.length;o+=2)r[o/2]=Number.parseInt(i.slice(o,o+2),16);return r}function Cy(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class x4{constructor(...n){}}var a4=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,mt,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},lo=U("$ZodError",a4),Rn=U("$ZodError",a4,{Parent:Error});function vo(n,i=(r)=>r.message){let r={},o=[];for(let t of n.issues)if(t.path.length>0)r[t.path[0]]=r[t.path[0]]||[],r[t.path[0]].push(i(t));else o.push(i(t));return{formErrors:o,fieldErrors:r}}function $o(n,i=(r)=>r.message){let r={_errors:[]},o=(t,e=[])=>{for(let u of t.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map((l)=>o({issues:l},[...e,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...e,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...e,...u.path]);else{let l=[...e,...u.path];if(l.length===0)r._errors.push(i(u));else{let $=r,I=0;while(I<l.length){let g=l[I];if(I!==l.length-1)$[g]=$[g]||{_errors:[]};else $[g]=$[g]||{_errors:[]},$[g]._errors.push(i(u));$=$[g],I++}}}};return o(n),r}function G$(n,i=(r)=>r.message){let r={errors:[]},o=(t,e=[])=>{var u,l;for(let $ of t.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((I)=>o({issues:I},[...e,...$.path]));else if($.code==="invalid_key")o({issues:$.issues},[...e,...$.path]);else if($.code==="invalid_element")o({issues:$.issues},[...e,...$.path]);else{let I=[...e,...$.path];if(I.length===0){r.errors.push(i($));continue}let g=r,b=0;while(b<I.length){let w=I[b],f=b===I.length-1;if(typeof w==="string")g.properties??(g.properties={}),(u=g.properties)[w]??(u[w]={errors:[]}),g=g.properties[w];else g.items??(g.items=[]),(l=g.items)[w]??(l[w]={errors:[]}),g=g.items[w];if(f)g.errors.push(i($));b++}}};return o(n),r}function s4(n){let i=[],r=n.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")i.push(`[${o}]`);else if(typeof o==="symbol")i.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))i.push(`[${JSON.stringify(o)}]`);else{if(i.length)i.push(".");i.push(o)}return i.join("")}function j$(n){let i=[],r=[...n.issues].sort((o,t)=>(o.path??[]).length-(t.path??[]).length);for(let o of r)if(i.push(`✖ ${o.message}`),o.path?.length)i.push(` → at ${s4(o.path)}`);return i.join(`
|
||
`)}var Ct=(n)=>(i,r,o,t)=>{let e=o?{...o,async:!1}:{async:!1},u=i._zod.run({value:r,issues:[]},e);if(u instanceof Promise)throw new Ni;if(u.issues.length){let l=new(t?.Err??n)(u.issues.map(($)=>_n($,e,kn())));throw Me(l,t?.callee),l}return u.value},Io=Ct(Rn),Rt=(n)=>async(i,r,o,t)=>{let e=o?{...o,async:!0}:{async:!0},u=i._zod.run({value:r,issues:[]},e);if(u instanceof Promise)u=await u;if(u.issues.length){let l=new(t?.Err??n)(u.issues.map(($)=>_n($,e,kn())));throw Me(l,t?.callee),l}return u.value},go=Rt(Rn),xt=(n)=>(i,r,o)=>{let t=o?{...o,async:!1}:{async:!1},e=i._zod.run({value:r,issues:[]},t);if(e instanceof Promise)throw new Ni;return e.issues.length?{success:!1,error:new(n??lo)(e.issues.map((u)=>_n(u,t,kn())))}:{success:!0,data:e.value}},at=xt(Rn),st=(n)=>async(i,r,o)=>{let t=o?{...o,async:!0}:{async:!0},e=i._zod.run({value:r,issues:[]},t);if(e instanceof Promise)e=await e;return e.issues.length?{success:!1,error:new n(e.issues.map((u)=>_n(u,t,kn())))}:{success:!0,data:e.value}},bo=st(Rn),ze=(n)=>(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Ct(n)(i,r,t)},n0=ze(Rn),Ce=(n)=>(i,r,o)=>{return Ct(n)(i,r,o)},i0=Ce(Rn),Re=(n)=>async(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Rt(n)(i,r,t)},t0=Re(Rn),xe=(n)=>async(i,r,o)=>{return Rt(n)(i,r,o)},r0=xe(Rn),ae=(n)=>(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return xt(n)(i,r,t)},o0=ae(Rn),se=(n)=>(i,r,o)=>{return xt(n)(i,r,o)},e0=se(Rn),nu=(n)=>async(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return st(n)(i,r,t)},u0=nu(Rn),iu=(n)=>async(i,r,o)=>{return st(n)(i,r,o)},l0=iu(Rn);var oi={};pi(oi,{xid:()=>X$,uuid7:()=>nG,uuid6:()=>sy,uuid4:()=>ay,uuid:()=>yt,uppercase:()=>tI,unicodeEmail:()=>v0,undefined:()=>nI,ulid:()=>H$,time:()=>M$,string:()=>C$,sha512_hex:()=>kG,sha512_base64url:()=>LG,sha512_base64:()=>dG,sha384_hex:()=>SG,sha384_base64url:()=>OG,sha384_base64:()=>AG,sha256_hex:()=>cG,sha256_base64url:()=>DG,sha256_base64:()=>UG,sha1_hex:()=>bG,sha1_base64url:()=>fG,sha1_base64:()=>wG,rfc5322Email:()=>tG,number:()=>wo,null:()=>s$,nanoid:()=>P$,md5_hex:()=>$G,md5_base64url:()=>gG,md5_base64:()=>IG,mac:()=>V$,lowercase:()=>iI,ksuid:()=>h$,ipv6:()=>B$,ipv4:()=>K$,integer:()=>x$,idnEmail:()=>rG,httpProtocol:()=>E$,html5Email:()=>iG,hostname:()=>uG,hex:()=>vG,guid:()=>p$,extendedDuration:()=>xy,emoji:()=>F$,email:()=>Q$,e164:()=>Z$,duration:()=>Y$,domain:()=>lG,datetime:()=>z$,date:()=>m$,cuid2:()=>J$,cuid:()=>W$,cidrv6:()=>q$,cidrv4:()=>T$,browserEmail:()=>oG,boolean:()=>a$,bigint:()=>R$,base64url:()=>tu,base64:()=>_$});var W$=/^[cC][0-9a-z]{6,}$/,J$=/^[0-9a-z]+$/,H$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,X$=/^[0-9a-vA-V]{20}$/,h$=/^[A-Za-z0-9]{27}$/,P$=/^[a-zA-Z0-9_-]{21}$/,Y$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xy=/^[-+]?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)?)??$/,p$=/^([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})$/,yt=(n)=>{if(!n)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},ay=yt(4),sy=yt(6),nG=yt(7),Q$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,iG=/^[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])?)*$/,tG=/^(([^<>()\[\]\\.,;:\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,}))$/,v0=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,rG=v0,oG=/^[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])?)*$/,eG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function F$(){return new RegExp(eG,"u")}var K$=/^(?:(?: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])$/,B$=/^(([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}|:))$/,V$=(n)=>{let i=li(n??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},T$=/^((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])$/,q$=/^(([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])$/,_$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tu=/^[A-Za-z0-9_-]*$/,uG=/^(?=.{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])?)*\.?$/,lG=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,E$=/^https?$/,Z$=/^\+[1-9]\d{6,14}$/,$0="(?:(?:\\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])))",m$=new RegExp(`^${$0}$`);function I0(n){return typeof n.precision==="number"?n.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":n.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${n.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function M$(n){return new RegExp(`^${I0(n)}$`)}function z$(n){let i=I0({precision:n.precision}),r=["Z"];if(n.local)r.push("");if(n.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${i}(?:${r.join("|")})`;return new RegExp(`^${$0}T(?:${o})$`)}var C$=(n)=>{let i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},R$=/^-?\d+n?$/,x$=/^-?\d+$/,wo=/^-?\d+(?:\.\d+)?$/,a$=/^(?:true|false)$/i,s$=/^null$/i;var nI=/^undefined$/i;var iI=/^[^A-Z]*$/,tI=/^[^a-z]*$/,vG=/^[0-9a-fA-F]*$/;function fo(n,i){return new RegExp(`^[A-Za-z0-9+/]{${n}}${i}$`)}function co(n){return new RegExp(`^[A-Za-z0-9_-]{${n}}$`)}var $G=/^[0-9a-fA-F]{32}$/,IG=fo(22,"=="),gG=co(22),bG=/^[0-9a-fA-F]{40}$/,wG=fo(27,"="),fG=co(27),cG=/^[0-9a-fA-F]{64}$/,UG=fo(43,"="),DG=co(43),SG=/^[0-9a-fA-F]{96}$/,AG=fo(64,""),OG=co(64),kG=/^[0-9a-fA-F]{128}$/,dG=fo(86,"=="),LG=co(86);var wn=U("$ZodCheck",(n,i)=>{var r;n._zod??(n._zod={}),n._zod.def=i,(r=n._zod).onattach??(r.onattach=[])}),b0={number:"number",bigint:"bigint",object:"date"},ru=U("$ZodCheckLessThan",(n,i)=>{wn.init(n,i);let r=b0[typeof i.value];n._zod.onattach.push((o)=>{let t=o._zod.bag,e=(i.inclusive?t.maximum:t.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(i.value<e)if(i.inclusive)t.maximum=i.value;else t.exclusiveMaximum=i.value}),n._zod.check=(o)=>{if(i.inclusive?o.value<=i.value:o.value<i.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof i.value==="object"?i.value.getTime():i.value,input:o.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),ou=U("$ZodCheckGreaterThan",(n,i)=>{wn.init(n,i);let r=b0[typeof i.value];n._zod.onattach.push((o)=>{let t=o._zod.bag,e=(i.inclusive?t.minimum:t.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(i.value>e)if(i.inclusive)t.minimum=i.value;else t.exclusiveMinimum=i.value}),n._zod.check=(o)=>{if(i.inclusive?o.value>=i.value:o.value>i.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof i.value==="object"?i.value.getTime():i.value,input:o.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),rI=U("$ZodCheckMultipleOf",(n,i)=>{wn.init(n,i),n._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=i.value)}),n._zod.check=(r)=>{if(typeof r.value!==typeof i.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%i.value===BigInt(0):D$(r.value,i.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:i.value,input:r.value,inst:n,continue:!i.abort})}}),oI=U("$ZodCheckNumberFormat",(n,i)=>{wn.init(n,i),i.format=i.format||"float64";let r=i.format?.includes("int"),o=r?"int":"number",[t,e]=L$[i.format];n._zod.onattach.push((u)=>{let l=u._zod.bag;if(l.format=i.format,l.minimum=t,l.maximum=e,r)l.pattern=x$}),n._zod.check=(u)=>{let l=u.value;if(r){if(!Number.isInteger(l)){u.issues.push({expected:o,format:i.format,code:"invalid_type",continue:!1,input:l,inst:n});return}if(!Number.isSafeInteger(l)){if(l>0)u.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:o,inclusive:!0,continue:!i.abort});else u.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:o,inclusive:!0,continue:!i.abort});return}}if(l<t)u.issues.push({origin:"number",input:l,code:"too_small",minimum:t,inclusive:!0,inst:n,continue:!i.abort});if(l>e)u.issues.push({origin:"number",input:l,code:"too_big",maximum:e,inclusive:!0,inst:n,continue:!i.abort})}}),eI=U("$ZodCheckBigIntFormat",(n,i)=>{wn.init(n,i);let[r,o]=N$[i.format];n._zod.onattach.push((t)=>{let e=t._zod.bag;e.format=i.format,e.minimum=r,e.maximum=o}),n._zod.check=(t)=>{let e=t.value;if(e<r)t.issues.push({origin:"bigint",input:e,code:"too_small",minimum:r,inclusive:!0,inst:n,continue:!i.abort});if(e>o)t.issues.push({origin:"bigint",input:e,code:"too_big",maximum:o,inclusive:!0,inst:n,continue:!i.abort})}}),uI=U("$ZodCheckMaxSize",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.size!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<t)o._zod.bag.maximum=i.maximum}),n._zod.check=(o)=>{let t=o.value;if(t.size<=i.maximum)return;o.issues.push({origin:eo(t),code:"too_big",maximum:i.maximum,inclusive:!0,input:t,inst:n,continue:!i.abort})}}),lI=U("$ZodCheckMinSize",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.size!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>t)o._zod.bag.minimum=i.minimum}),n._zod.check=(o)=>{let t=o.value;if(t.size>=i.minimum)return;o.issues.push({origin:eo(t),code:"too_small",minimum:i.minimum,inclusive:!0,input:t,inst:n,continue:!i.abort})}}),vI=U("$ZodCheckSizeEquals",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.size!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag;t.minimum=i.size,t.maximum=i.size,t.size=i.size}),n._zod.check=(o)=>{let t=o.value,e=t.size;if(e===i.size)return;let u=e>i.size;o.issues.push({origin:eo(t),...u?{code:"too_big",maximum:i.size}:{code:"too_small",minimum:i.size},inclusive:!0,exact:!0,input:o.value,inst:n,continue:!i.abort})}}),$I=U("$ZodCheckMaxLength",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.length!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<t)o._zod.bag.maximum=i.maximum}),n._zod.check=(o)=>{let t=o.value;if(t.length<=i.maximum)return;let u=uo(t);o.issues.push({origin:u,code:"too_big",maximum:i.maximum,inclusive:!0,input:t,inst:n,continue:!i.abort})}}),II=U("$ZodCheckMinLength",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.length!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>t)o._zod.bag.minimum=i.minimum}),n._zod.check=(o)=>{let t=o.value;if(t.length>=i.minimum)return;let u=uo(t);o.issues.push({origin:u,code:"too_small",minimum:i.minimum,inclusive:!0,input:t,inst:n,continue:!i.abort})}}),gI=U("$ZodCheckLengthEquals",(n,i)=>{var r;wn.init(n,i),(r=n._zod.def).when??(r.when=(o)=>{let t=o.value;return!Ci(t)&&t.length!==void 0}),n._zod.onattach.push((o)=>{let t=o._zod.bag;t.minimum=i.length,t.maximum=i.length,t.length=i.length}),n._zod.check=(o)=>{let t=o.value,e=t.length;if(e===i.length)return;let u=uo(t),l=e>i.length;o.issues.push({origin:u,...l?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:o.value,inst:n,continue:!i.abort})}}),nr=U("$ZodCheckStringFormat",(n,i)=>{var r,o;if(wn.init(n,i),n._zod.onattach.push((t)=>{let e=t._zod.bag;if(e.format=i.format,i.pattern)e.patterns??(e.patterns=new Set),e.patterns.add(i.pattern)}),i.pattern)(r=n._zod).check??(r.check=(t)=>{if(i.pattern.lastIndex=0,i.pattern.test(t.value))return;t.issues.push({origin:"string",code:"invalid_format",format:i.format,input:t.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})});else(o=n._zod).check??(o.check=()=>{})}),bI=U("$ZodCheckRegex",(n,i)=>{nr.init(n,i),n._zod.check=(r)=>{if(i.pattern.lastIndex=0,i.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),wI=U("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=iI),nr.init(n,i)}),fI=U("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=tI),nr.init(n,i)}),cI=U("$ZodCheckIncludes",(n,i)=>{wn.init(n,i);let r=li(i.includes),o=new RegExp(typeof i.position==="number"?`^.{${i.position}}${r}`:r);i.pattern=o,n._zod.onattach.push((t)=>{let e=t._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(o)}),n._zod.check=(t)=>{if(t.value.includes(i.includes,i.position))return;t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:t.value,inst:n,continue:!i.abort})}}),UI=U("$ZodCheckStartsWith",(n,i)=>{wn.init(n,i);let r=new RegExp(`^${li(i.prefix)}.*`);i.pattern??(i.pattern=r),n._zod.onattach.push((o)=>{let t=o._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),n._zod.check=(o)=>{if(o.value.startsWith(i.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:o.value,inst:n,continue:!i.abort})}}),DI=U("$ZodCheckEndsWith",(n,i)=>{wn.init(n,i);let r=new RegExp(`.*${li(i.suffix)}$`);i.pattern??(i.pattern=r),n._zod.onattach.push((o)=>{let t=o._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),n._zod.check=(o)=>{if(o.value.endsWith(i.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:o.value,inst:n,continue:!i.abort})}});function g0(n,i,r){if(n.issues.length)i.issues.push(...Cn(r,n.issues))}var SI=U("$ZodCheckProperty",(n,i)=>{wn.init(n,i),n._zod.check=(r)=>{let o=i.schema._zod.run({value:r.value[i.property],issues:[]},{});if(o instanceof Promise)return o.then((t)=>g0(t,r,i.property));g0(o,r,i.property);return}}),AI=U("$ZodCheckMimeType",(n,i)=>{wn.init(n,i);let r=new Set(i.mime);n._zod.onattach.push((o)=>{o._zod.bag.mime=i.mime}),n._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:i.mime,input:o.value.type,inst:n,continue:!i.abort})}}),OI=U("$ZodCheckOverwrite",(n,i)=>{wn.init(n,i),n._zod.check=(r)=>{r.value=i.tx(r.value)}});class eu{constructor(n=[]){if(this.content=[],this.indent=0,this)this.args=n}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n==="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let r=n.split(`
|
||
`).filter((e)=>e),o=Math.min(...r.map((e)=>e.length-e.trimStart().length)),t=r.map((e)=>e.slice(o)).map((e)=>" ".repeat(this.indent*2)+e);for(let e of t)this.content.push(e)}compile(){let n=Function,i=this?.args,o=[...(this?.content??[""]).map((t)=>` ${t}`)];return new n(...i,o.join(`
|
||
`))}}var kI={major:4,minor:4,patch:3};var B=U("$ZodType",(n,i)=>{var r;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=kI;let o=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))o.unshift(n);for(let t of o)for(let e of t._zod.onattach)e(n);if(o.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let t=(u,l,$)=>{let I=ai(u),g;for(let b of l){if(b._zod.def.when){if(y$(u))continue;if(!b._zod.def.when(u))continue}else if(I)continue;let w=u.issues.length,f=b._zod.check(u);if(f instanceof Promise&&$?.async===!1)throw new Ni;if(g||f instanceof Promise)g=(g??Promise.resolve()).then(async()=>{if(await f,u.issues.length===w)return;if(!I)I=ai(u,w)});else{if(u.issues.length===w)continue;if(!I)I=ai(u,w)}}if(g)return g.then(()=>{return u});return u},e=(u,l,$)=>{if(ai(u))return u.aborted=!0,u;let I=t(l,o,$);if(I instanceof Promise){if($.async===!1)throw new Ni;return I.then((g)=>n._zod.parse(g,$))}return n._zod.parse(I,$)};n._zod.run=(u,l)=>{if(l.skipChecks)return n._zod.parse(u,l);if(l.direction==="backward"){let I=n._zod.parse({value:u.value,issues:[]},{...l,skipChecks:!0});if(I instanceof Promise)return I.then((g)=>{return e(g,u,l)});return e(I,u,l)}let $=n._zod.parse(u,l);if($ instanceof Promise){if(l.async===!1)throw new Ni;return $.then((I)=>t(I,o,l))}return t($,o,l)}}z(n,"~standard",()=>({validate:(t)=>{try{let e=at(n,t);return e.success?{value:e.data}:{issues:e.error?.issues}}catch(e){return bo(n,t).then((u)=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Gt=U("$ZodString",(n,i)=>{B.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??C$(n._zod.bag),n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=String(r.value)}catch(t){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),$n=U("$ZodStringFormat",(n,i)=>{nr.init(n,i),Gt.init(n,i)}),LI=U("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=p$),$n.init(n,i)}),NI=U("$ZodUUID",(n,i)=>{if(i.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(o===void 0)throw Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=yt(o))}else i.pattern??(i.pattern=yt());$n.init(n,i)}),yI=U("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=Q$),$n.init(n,i)}),GI=U("$ZodURL",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{try{let o=r.value.trim();if(!i.normalize&&i.protocol?.source===E$.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:n,continue:!i.abort});return}}let t=new URL(o);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:r.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:r.value,inst:n,continue:!i.abort})}if(i.normalize)r.value=t.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!i.abort})}}}),jI=U("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=F$()),$n.init(n,i)}),WI=U("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=P$),$n.init(n,i)}),JI=U("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=W$),$n.init(n,i)}),HI=U("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=J$),$n.init(n,i)}),XI=U("$ZodULID",(n,i)=>{i.pattern??(i.pattern=H$),$n.init(n,i)}),hI=U("$ZodXID",(n,i)=>{i.pattern??(i.pattern=X$),$n.init(n,i)}),PI=U("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=h$),$n.init(n,i)}),YI=U("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=z$(i)),$n.init(n,i)}),pI=U("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=m$),$n.init(n,i)}),QI=U("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=M$(i)),$n.init(n,i)}),FI=U("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=Y$),$n.init(n,i)}),KI=U("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=K$),$n.init(n,i),n._zod.bag.format="ipv4"}),BI=U("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=B$),$n.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!i.abort})}}}),VI=U("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=V$(i.delimiter)),$n.init(n,i),n._zod.bag.format="mac"}),TI=U("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=T$),$n.init(n,i)}),qI=U("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=q$),$n.init(n,i),n._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[t,e]=o;if(!e)throw Error();let u=Number(e);if(`${u}`!==e)throw Error();if(u<0||u>128)throw Error();new URL(`http://[${t}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!i.abort})}}});function _I(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var EI=U("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=_$),$n.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=(r)=>{if(_I(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:n,continue:!i.abort})}});function W0(n){if(!tu.test(n))return!1;let i=n.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=i.padEnd(Math.ceil(i.length/4)*4,"=");return _I(r)}var ZI=U("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=tu),$n.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=(r)=>{if(W0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:n,continue:!i.abort})}}),mI=U("$ZodE164",(n,i)=>{i.pattern??(i.pattern=Z$),$n.init(n,i)});function J0(n,i=null){try{let r=n.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let t=JSON.parse(atob(o));if("typ"in t&&t?.typ!=="JWT")return!1;if(!t.alg)return!1;if(i&&(!("alg"in t)||t.alg!==i))return!1;return!0}catch{return!1}}var MI=U("$ZodJWT",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{if(J0(r.value,i.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:n,continue:!i.abort})}}),zI=U("$ZodCustomStringFormat",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{if(i.fn(r.value))return;r.issues.push({code:"invalid_format",format:i.format,input:r.value,inst:n,continue:!i.abort})}}),Iu=U("$ZodNumber",(n,i)=>{B.init(n,i),n._zod.pattern=n._zod.bag.pattern??wo,n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=Number(r.value)}catch(u){}let t=r.value;if(typeof t==="number"&&!Number.isNaN(t)&&Number.isFinite(t))return r;let e=typeof t==="number"?Number.isNaN(t)?"NaN":!Number.isFinite(t)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:t,inst:n,...e?{received:e}:{}}),r}}),CI=U("$ZodNumberFormat",(n,i)=>{oI.init(n,i),Iu.init(n,i)}),Uo=U("$ZodBoolean",(n,i)=>{B.init(n,i),n._zod.pattern=a$,n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=Boolean(r.value)}catch(e){}let t=r.value;if(typeof t==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:t,inst:n}),r}}),gu=U("$ZodBigInt",(n,i)=>{B.init(n,i),n._zod.pattern=R$,n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=BigInt(r.value)}catch(t){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:n}),r}}),RI=U("$ZodBigIntFormat",(n,i)=>{eI.init(n,i),gu.init(n,i)}),xI=U("$ZodSymbol",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(typeof t==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:t,inst:n}),r}}),aI=U("$ZodUndefined",(n,i)=>{B.init(n,i),n._zod.pattern=nI,n._zod.values=new Set([void 0]),n._zod.parse=(r,o)=>{let t=r.value;if(typeof t>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:t,inst:n}),r}}),sI=U("$ZodNull",(n,i)=>{B.init(n,i),n._zod.pattern=s$,n._zod.values=new Set([null]),n._zod.parse=(r,o)=>{let t=r.value;if(t===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:t,inst:n}),r}}),ng=U("$ZodAny",(n,i)=>{B.init(n,i),n._zod.parse=(r)=>r}),ig=U("$ZodUnknown",(n,i)=>{B.init(n,i),n._zod.parse=(r)=>r}),tg=U("$ZodNever",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{return r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:n}),r}}),rg=U("$ZodVoid",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(typeof t>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:t,inst:n}),r}}),og=U("$ZodDate",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=new Date(r.value)}catch(l){}let t=r.value,e=t instanceof Date;if(e&&!Number.isNaN(t.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:t,...e?{received:"Invalid Date"}:{},inst:n}),r}});function f0(n,i,r){if(n.issues.length)i.issues.push(...Cn(r,n.issues));i.value[r]=n.value}var eg=U("$ZodArray",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(!Array.isArray(t))return r.issues.push({expected:"array",code:"invalid_type",input:t,inst:n}),r;r.value=Array(t.length);let e=[];for(let u=0;u<t.length;u++){let l=t[u],$=i.element._zod.run({value:l,issues:[]},o);if($ instanceof Promise)e.push($.then((I)=>f0(I,r,u)));else f0($,r,u)}if(e.length)return Promise.all(e).then(()=>r);return r}});function $u(n,i,r,o,t,e){let u=r in o;if(n.issues.length){if(t&&e&&!u)return;i.issues.push(...Cn(r,n.issues))}if(!u&&!t){if(!n.issues.length)i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(n.value===void 0){if(u)i.value[r]=void 0}else i.value[r]=n.value}function H0(n){let i=Object.keys(n.shape);for(let o of i)if(!n.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=d$(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(r)}}function X0(n,i,r,o,t,e){let u=[],l=t.keySet,$=t.catchall._zod,I=$.def.type,g=$.optin==="optional",b=$.optout==="optional";for(let w in i){if(w==="__proto__")continue;if(l.has(w))continue;if(I==="never"){u.push(w);continue}let f=$.run({value:i[w],issues:[]},o);if(f instanceof Promise)n.push(f.then((c)=>$u(c,r,w,i,g,b)));else $u(f,r,w,i,g,b)}if(u.length)r.issues.push({code:"unrecognized_keys",keys:u,input:i,inst:e});if(!n.length)return r;return Promise.all(n).then(()=>{return r})}var h0=U("$ZodObject",(n,i)=>{if(B.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){let l=i.shape;Object.defineProperty(i,"shape",{get:()=>{let $={...l};return Object.defineProperty(i,"shape",{value:$}),$}})}let o=Mt(()=>H0(i));z(n._zod,"propValues",()=>{let l=i.shape,$={};for(let I in l){let g=l[I]._zod;if(g.values){$[I]??($[I]=new Set);for(let b of g.values)$[I].add(b)}}return $});let t=Nt,e=i.catchall,u;n._zod.parse=(l,$)=>{u??(u=o.value);let I=l.value;if(!t(I))return l.issues.push({expected:"object",code:"invalid_type",input:I,inst:n}),l;l.value={};let g=[],b=u.shape;for(let w of u.keys){let f=b[w],c=f._zod.optin==="optional",S=f._zod.optout==="optional",k=f._zod.run({value:I[w],issues:[]},$);if(k instanceof Promise)g.push(k.then((d)=>$u(d,l,w,I,c,S)));else $u(k,l,w,I,c,S)}if(!e)return g.length?Promise.all(g).then(()=>l):l;return X0(g,I,l,$,o.value,n)}}),ug=U("$ZodObjectJIT",(n,i)=>{h0.init(n,i);let r=n._zod.parse,o=Mt(()=>H0(i)),t=(w)=>{let f=new eu(["shape","payload","ctx"]),c=o.value,S=(h)=>{let j=me(h);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};f.write("const input = payload.value;");let k=Object.create(null),d=0;for(let h of c.keys)k[h]=`key_${d++}`;f.write("const newResult = {};");for(let h of c.keys){let j=k[h],L=me(h),q=w[h],x=q?._zod?.optin==="optional",yn=q?._zod?.optout==="optional";if(f.write(`const ${j} = ${S(h)};`),x&&yn)f.write(`
|
||
if (${j}.issues.length) {
|
||
if (${L} in input) {
|
||
payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
||
})));
|
||
}
|
||
}
|
||
|
||
if (${j}.value === undefined) {
|
||
if (${L} in input) {
|
||
newResult[${L}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${L}] = ${j}.value;
|
||
}
|
||
|
||
`);else if(!x)f.write(`
|
||
const ${j}_present = ${L} in input;
|
||
if (${j}.issues.length) {
|
||
payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
||
})));
|
||
}
|
||
if (!${j}_present && !${j}.issues.length) {
|
||
payload.issues.push({
|
||
code: "invalid_type",
|
||
expected: "nonoptional",
|
||
input: undefined,
|
||
path: [${L}]
|
||
});
|
||
}
|
||
|
||
if (${j}_present) {
|
||
if (${j}.value === undefined) {
|
||
newResult[${L}] = undefined;
|
||
} else {
|
||
newResult[${L}] = ${j}.value;
|
||
}
|
||
}
|
||
|
||
`);else f.write(`
|
||
if (${j}.issues.length) {
|
||
payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
||
})));
|
||
}
|
||
|
||
if (${j}.value === undefined) {
|
||
if (${L} in input) {
|
||
newResult[${L}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${L}] = ${j}.value;
|
||
}
|
||
|
||
`)}f.write("payload.value = newResult;"),f.write("return payload;");let p=f.compile();return(h,j)=>p(w,h,j)},e,u=Nt,l=!dt.jitless,I=l&&A$.value,g=i.catchall,b;n._zod.parse=(w,f)=>{b??(b=o.value);let c=w.value;if(!u(c))return w.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),w;if(l&&I&&f?.async===!1&&f.jitless!==!0){if(!e)e=t(i.shape);if(w=e(w,f),!g)return w;return X0([],c,w,f,b,n)}return r(w,f)}});function c0(n,i,r,o){for(let e of n)if(e.issues.length===0)return i.value=e.value,i;let t=n.filter((e)=>!ai(e));if(t.length===1)return i.value=t[0].value,t[0];return i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((e)=>e.issues.map((u)=>_n(u,o,kn())))}),i}var Do=U("$ZodUnion",(n,i)=>{B.init(n,i),z(n._zod,"optin",()=>i.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),z(n._zod,"optout",()=>i.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),z(n._zod,"values",()=>{if(i.options.every((o)=>o._zod.values))return new Set(i.options.flatMap((o)=>Array.from(o._zod.values)));return}),z(n._zod,"pattern",()=>{if(i.options.every((o)=>o._zod.pattern)){let o=i.options.map((t)=>t._zod.pattern);return new RegExp(`^(${o.map((t)=>ro(t.source)).join("|")})$`)}return});let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let e=!1,u=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)u.push($),e=!0;else{if($.issues.length===0)return $;u.push($)}}if(!e)return c0(u,o,n,t);return Promise.all(u).then((l)=>{return c0(l,o,n,t)})}});function U0(n,i,r,o){let t=n.filter((e)=>e.issues.length===0);if(t.length===1)return i.value=t[0].value,i;if(t.length===0)i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((e)=>e.issues.map((u)=>_n(u,o,kn())))});else i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:[],inclusive:!1});return i}var lg=U("$ZodXor",(n,i)=>{Do.init(n,i),i.inclusive=!1;let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let e=!1,u=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)u.push($),e=!0;else u.push($)}if(!e)return U0(u,o,n,t);return Promise.all(u).then((l)=>{return U0(l,o,n,t)})}}),vg=U("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,Do.init(n,i);let r=n._zod.parse;z(n._zod,"propValues",()=>{let t={};for(let e of i.options){let u=e._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(e)}"`);for(let[l,$]of Object.entries(u)){if(!t[l])t[l]=new Set;for(let I of $)t[l].add(I)}}return t});let o=Mt(()=>{let t=i.options,e=new Map;for(let u of t){let l=u._zod.propValues?.[i.discriminator];if(!l||l.size===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(u)}"`);for(let $ of l){if(e.has($))throw Error(`Duplicate discriminator value "${String($)}"`);e.set($,u)}}return e});n._zod.parse=(t,e)=>{let u=t.value;if(!Nt(u))return t.issues.push({code:"invalid_type",expected:"object",input:u,inst:n}),t;let l=o.value.get(u?.[i.discriminator]);if(l)return l._zod.run(t,e);if(i.unionFallback||e.direction==="backward")return r(t,e);return t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:i.discriminator,options:Array.from(o.value.keys()),input:u,path:[i.discriminator],inst:n}),t}}),$g=U("$ZodIntersection",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value,e=i.left._zod.run({value:t,issues:[]},o),u=i.right._zod.run({value:t,issues:[]},o);if(e instanceof Promise||u instanceof Promise)return Promise.all([e,u]).then(([$,I])=>{return D0(r,$,I)});return D0(r,e,u)}});function dI(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n===+i)return{valid:!0,data:n};if(xi(n)&&xi(i)){let r=Object.keys(i),o=Object.keys(n).filter((e)=>r.indexOf(e)!==-1),t={...n,...i};for(let e of o){let u=dI(n[e],i[e]);if(!u.valid)return{valid:!1,mergeErrorPath:[e,...u.mergeErrorPath]};t[e]=u.data}return{valid:!0,data:t}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<n.length;o++){let t=n[o],e=i[o],u=dI(t,e);if(!u.valid)return{valid:!1,mergeErrorPath:[o,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function D0(n,i,r){let o=new Map,t;for(let l of i.issues)if(l.code==="unrecognized_keys"){t??(t=l);for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).l=!0}}else n.issues.push(l);for(let l of r.issues)if(l.code==="unrecognized_keys")for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).r=!0}else n.issues.push(l);let e=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(e.length&&t)n.issues.push({...t,keys:e});if(ai(n))return n;let u=dI(i.value,r.value);if(!u.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return n.value=u.data,n}var bu=U("$ZodTuple",(n,i)=>{B.init(n,i);let r=i.items;n._zod.parse=(o,t)=>{let e=o.value;if(!Array.isArray(e))return o.issues.push({input:e,inst:n,expected:"tuple",code:"invalid_type"}),o;o.value=[];let u=[],l=S0(r,"optin"),$=S0(r,"optout");if(!i.rest){if(e.length<l)return o.issues.push({code:"too_small",minimum:l,inclusive:!0,input:e,inst:n,origin:"array"}),o;if(e.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:e,inst:n,origin:"array"})}let I=Array(r.length);for(let g=0;g<r.length;g++){let b=r[g]._zod.run({value:e[g],issues:[]},t);if(b instanceof Promise)u.push(b.then((w)=>{I[g]=w}));else I[g]=b}if(i.rest){let g=r.length-1,b=e.slice(r.length);for(let w of b){g++;let f=i.rest._zod.run({value:w,issues:[]},t);if(f instanceof Promise)u.push(f.then((c)=>A0(c,o,g)));else A0(f,o,g)}}if(u.length)return Promise.all(u).then(()=>O0(I,o,r,e,$));return O0(I,o,r,e,$)}});function S0(n,i){for(let r=n.length-1;r>=0;r--)if(n[r]._zod[i]!=="optional")return r+1;return 0}function A0(n,i,r){if(n.issues.length)i.issues.push(...Cn(r,n.issues));i.value[r]=n.value}function O0(n,i,r,o,t){for(let e=0;e<r.length;e++){let u=n[e],l=e<o.length;if(u.issues.length){if(!l&&e>=t){i.value.length=e;break}i.issues.push(...Cn(e,u.issues))}i.value[e]=u.value}for(let e=i.value.length-1;e>=o.length;e--)if(r[e]._zod.optout==="optional"&&i.value[e]===void 0)i.value.length=e;else break;return i}var Ig=U("$ZodRecord",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(!xi(t))return r.issues.push({expected:"record",code:"invalid_type",input:t,inst:n}),r;let e=[],u=i.keyType._zod.values;if(u){r.value={};let l=new Set;for(let I of u)if(typeof I==="string"||typeof I==="number"||typeof I==="symbol"){l.add(typeof I==="number"?I.toString():I);let g=i.keyType._zod.run({value:I,issues:[]},o);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map((f)=>_n(f,o,kn())),input:I,path:[I],inst:n});continue}let b=g.value,w=i.valueType._zod.run({value:t[I],issues:[]},o);if(w instanceof Promise)e.push(w.then((f)=>{if(f.issues.length)r.issues.push(...Cn(I,f.issues));r.value[b]=f.value}));else{if(w.issues.length)r.issues.push(...Cn(I,w.issues));r.value[b]=w.value}}let $;for(let I in t)if(!l.has(I))$=$??[],$.push(I);if($&&$.length>0)r.issues.push({code:"unrecognized_keys",input:t,inst:n,keys:$})}else{r.value={};for(let l of Reflect.ownKeys(t)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(t,l))continue;let $=i.keyType._zod.run({value:l,issues:[]},o);if($ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&wo.test(l)&&$.issues.length){let b=i.keyType._zod.run({value:Number(l),issues:[]},o);if(b instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(b.issues.length===0)$=b}if($.issues.length){if(i.mode==="loose")r.value[l]=t[l];else r.issues.push({code:"invalid_key",origin:"record",issues:$.issues.map((b)=>_n(b,o,kn())),input:l,path:[l],inst:n});continue}let g=i.valueType._zod.run({value:t[l],issues:[]},o);if(g instanceof Promise)e.push(g.then((b)=>{if(b.issues.length)r.issues.push(...Cn(l,b.issues));r.value[$.value]=b.value}));else{if(g.issues.length)r.issues.push(...Cn(l,g.issues));r.value[$.value]=g.value}}}if(e.length)return Promise.all(e).then(()=>r);return r}}),gg=U("$ZodMap",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(!(t instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:t,inst:n}),r;let e=[];r.value=new Map;for(let[u,l]of t){let $=i.keyType._zod.run({value:u,issues:[]},o),I=i.valueType._zod.run({value:l,issues:[]},o);if($ instanceof Promise||I instanceof Promise)e.push(Promise.all([$,I]).then(([g,b])=>{k0(g,b,r,u,t,n,o)}));else k0($,I,r,u,t,n,o)}if(e.length)return Promise.all(e).then(()=>r);return r}});function k0(n,i,r,o,t,e,u){if(n.issues.length)if(oo.has(typeof o))r.issues.push(...Cn(o,n.issues));else r.issues.push({code:"invalid_key",origin:"map",input:t,inst:e,issues:n.issues.map((l)=>_n(l,u,kn()))});if(i.issues.length)if(oo.has(typeof o))r.issues.push(...Cn(o,i.issues));else r.issues.push({origin:"map",code:"invalid_element",input:t,inst:e,key:o,issues:i.issues.map((l)=>_n(l,u,kn()))});r.value.set(n.value,i.value)}var bg=U("$ZodSet",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(!(t instanceof Set))return r.issues.push({input:t,inst:n,expected:"set",code:"invalid_type"}),r;let e=[];r.value=new Set;for(let u of t){let l=i.valueType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)e.push(l.then(($)=>d0($,r)));else d0(l,r)}if(e.length)return Promise.all(e).then(()=>r);return r}});function d0(n,i){if(n.issues.length)i.issues.push(...n.issues);i.value.add(n.value)}var wg=U("$ZodEnum",(n,i)=>{B.init(n,i);let r=to(i.entries),o=new Set(r);n._zod.values=o,n._zod.pattern=new RegExp(`^(${r.filter((t)=>oo.has(typeof t)).map((t)=>typeof t==="string"?li(t):t.toString()).join("|")})$`),n._zod.parse=(t,e)=>{let u=t.value;if(o.has(u))return t;return t.issues.push({code:"invalid_value",values:r,input:u,inst:n}),t}}),fg=U("$ZodLiteral",(n,i)=>{if(B.init(n,i),i.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(i.values);n._zod.values=r,n._zod.pattern=new RegExp(`^(${i.values.map((o)=>typeof o==="string"?li(o):o?li(o.toString()):String(o)).join("|")})$`),n._zod.parse=(o,t)=>{let e=o.value;if(r.has(e))return o;return o.issues.push({code:"invalid_value",values:i.values,input:e,inst:n}),o}}),cg=U("$ZodFile",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{let t=r.value;if(t instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:t,inst:n}),r}}),Ug=U("$ZodTransform",(n,i)=>{B.init(n,i),n._zod.optin="optional",n._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Lt(n.constructor.name);let t=i.transform(r.value,r);if(o.async)return(t instanceof Promise?t:Promise.resolve(t)).then((u)=>{return r.value=u,r.fallback=!0,r});if(t instanceof Promise)throw new Ni;return r.value=t,r.fallback=!0,r}});function L0(n,i){if(i===void 0&&(n.issues.length||n.fallback))return{issues:[],value:void 0};return n}var wu=U("$ZodOptional",(n,i)=>{B.init(n,i),n._zod.optin="optional",n._zod.optout="optional",z(n._zod,"values",()=>{return i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0}),z(n._zod,"pattern",()=>{let r=i.innerType._zod.pattern;return r?new RegExp(`^(${ro(r.source)})?$`):void 0}),n._zod.parse=(r,o)=>{if(i.innerType._zod.optin==="optional"){let t=r.value,e=i.innerType._zod.run(r,o);if(e instanceof Promise)return e.then((u)=>L0(u,t));return L0(e,t)}if(r.value===void 0)return r;return i.innerType._zod.run(r,o)}}),Dg=U("$ZodExactOptional",(n,i)=>{wu.init(n,i),z(n._zod,"values",()=>i.innerType._zod.values),z(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=(r,o)=>{return i.innerType._zod.run(r,o)}}),Sg=U("$ZodNullable",(n,i)=>{B.init(n,i),z(n._zod,"optin",()=>i.innerType._zod.optin),z(n._zod,"optout",()=>i.innerType._zod.optout),z(n._zod,"pattern",()=>{let r=i.innerType._zod.pattern;return r?new RegExp(`^(${ro(r.source)}|null)$`):void 0}),z(n._zod,"values",()=>{return i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0}),n._zod.parse=(r,o)=>{if(r.value===null)return r;return i.innerType._zod.run(r,o)}}),Ag=U("$ZodDefault",(n,i)=>{B.init(n,i),n._zod.optin="optional",z(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(r,o)=>{if(o.direction==="backward")return i.innerType._zod.run(r,o);if(r.value===void 0)return r.value=i.defaultValue,r;let t=i.innerType._zod.run(r,o);if(t instanceof Promise)return t.then((e)=>N0(e,i));return N0(t,i)}});function N0(n,i){if(n.value===void 0)n.value=i.defaultValue;return n}var Og=U("$ZodPrefault",(n,i)=>{B.init(n,i),n._zod.optin="optional",z(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(r,o)=>{if(o.direction==="backward")return i.innerType._zod.run(r,o);if(r.value===void 0)r.value=i.defaultValue;return i.innerType._zod.run(r,o)}}),kg=U("$ZodNonOptional",(n,i)=>{B.init(n,i),z(n._zod,"values",()=>{let r=i.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),n._zod.parse=(r,o)=>{let t=i.innerType._zod.run(r,o);if(t instanceof Promise)return t.then((e)=>y0(e,n));return y0(t,n)}});function y0(n,i){if(!n.issues.length&&n.value===void 0)n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i});return n}var dg=U("$ZodSuccess",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Lt("ZodSuccess");let t=i.innerType._zod.run(r,o);if(t instanceof Promise)return t.then((e)=>{return r.value=e.issues.length===0,r});return r.value=t.issues.length===0,r}}),Lg=U("$ZodCatch",(n,i)=>{B.init(n,i),n._zod.optin="optional",z(n._zod,"optout",()=>i.innerType._zod.optout),z(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(r,o)=>{if(o.direction==="backward")return i.innerType._zod.run(r,o);let t=i.innerType._zod.run(r,o);if(t instanceof Promise)return t.then((e)=>{if(r.value=e.value,e.issues.length)r.value=i.catchValue({...r,error:{issues:e.issues.map((u)=>_n(u,o,kn()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=t.value,t.issues.length)r.value=i.catchValue({...r,error:{issues:t.issues.map((e)=>_n(e,o,kn()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),Ng=U("$ZodNaN",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:n,expected:"nan",code:"invalid_type"}),r;return r}}),fu=U("$ZodPipe",(n,i)=>{B.init(n,i),z(n._zod,"values",()=>i.in._zod.values),z(n._zod,"optin",()=>i.in._zod.optin),z(n._zod,"optout",()=>i.out._zod.optout),z(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(r,o)=>{if(o.direction==="backward"){let e=i.out._zod.run(r,o);if(e instanceof Promise)return e.then((u)=>uu(u,i.in,o));return uu(e,i.in,o)}let t=i.in._zod.run(r,o);if(t instanceof Promise)return t.then((e)=>uu(e,i.out,o));return uu(t,i.out,o)}});function uu(n,i,r){if(n.issues.length)return n.aborted=!0,n;return i._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},r)}var So=U("$ZodCodec",(n,i)=>{B.init(n,i),z(n._zod,"values",()=>i.in._zod.values),z(n._zod,"optin",()=>i.in._zod.optin),z(n._zod,"optout",()=>i.out._zod.optout),z(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let e=i.in._zod.run(r,o);if(e instanceof Promise)return e.then((u)=>lu(u,i,o));return lu(e,i,o)}else{let e=i.out._zod.run(r,o);if(e instanceof Promise)return e.then((u)=>lu(u,i,o));return lu(e,i,o)}}});function lu(n,i,r){if(n.issues.length)return n.aborted=!0,n;if((r.direction||"forward")==="forward"){let t=i.transform(n.value,n);if(t instanceof Promise)return t.then((e)=>vu(n,e,i.out,r));return vu(n,t,i.out,r)}else{let t=i.reverseTransform(n.value,n);if(t instanceof Promise)return t.then((e)=>vu(n,e,i.in,r));return vu(n,t,i.in,r)}}function vu(n,i,r,o){if(n.issues.length)return n.aborted=!0,n;return r._zod.run({value:i,issues:n.issues},o)}var yg=U("$ZodPreprocess",(n,i)=>{fu.init(n,i)}),Gg=U("$ZodReadonly",(n,i)=>{B.init(n,i),z(n._zod,"propValues",()=>i.innerType._zod.propValues),z(n._zod,"values",()=>i.innerType._zod.values),z(n._zod,"optin",()=>i.innerType?._zod?.optin),z(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=(r,o)=>{if(o.direction==="backward")return i.innerType._zod.run(r,o);let t=i.innerType._zod.run(r,o);if(t instanceof Promise)return t.then(G0);return G0(t)}});function G0(n){return n.value=Object.freeze(n.value),n}var jg=U("$ZodTemplateLiteral",(n,i)=>{B.init(n,i);let r=[];for(let o of i.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let t=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${o._zod.traits}`);let e=t.startsWith("^")?1:0,u=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(e,u))}else if(o===null||k$.has(typeof o))r.push(li(`${o}`));else throw Error(`Invalid template literal part: ${o}`);n._zod.pattern=new RegExp(`^${r.join("")}$`),n._zod.parse=(o,t)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:n,expected:"string",code:"invalid_type"}),o;if(n._zod.pattern.lastIndex=0,!n._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:n,code:"invalid_format",format:i.format??"template_literal",pattern:n._zod.pattern.source}),o;return o}}),Wg=U("$ZodFunction",(n,i)=>{return B.init(n,i),n._def=i,n._zod.def=i,n.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let t=n._def.input?Io(n._def.input,o):o,e=Reflect.apply(r,this,t);if(n._def.output)return Io(n._def.output,e);return e}},n.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let t=n._def.input?await go(n._def.input,o):o,e=await Reflect.apply(r,this,t);if(n._def.output)return await go(n._def.output,e);return e}},n._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:n}),r;if(n._def.output&&n._def.output._zod.def.type==="promise")r.value=n.implementAsync(r.value);else r.value=n.implement(r.value);return r},n.input=(...r)=>{let o=n.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new bu({type:"tuple",items:r[0],rest:r[1]}),output:n._def.output});return new o({type:"function",input:r[0],output:n._def.output})},n.output=(r)=>{return new n.constructor({type:"function",input:n._def.input,output:r})},n}),Jg=U("$ZodPromise",(n,i)=>{B.init(n,i),n._zod.parse=(r,o)=>{return Promise.resolve(r.value).then((t)=>i.innerType._zod.run({value:t,issues:[]},o))}}),Hg=U("$ZodLazy",(n,i)=>{B.init(n,i),z(n._zod,"innerType",()=>{let r=i;if(!r._cachedInner)r._cachedInner=i.getter();return r._cachedInner}),z(n._zod,"pattern",()=>n._zod.innerType?._zod?.pattern),z(n._zod,"propValues",()=>n._zod.innerType?._zod?.propValues),z(n._zod,"optin",()=>n._zod.innerType?._zod?.optin??void 0),z(n._zod,"optout",()=>n._zod.innerType?._zod?.optout??void 0),n._zod.parse=(r,o)=>{return n._zod.innerType._zod.run(r,o)}}),Xg=U("$ZodCustom",(n,i)=>{wn.init(n,i),B.init(n,i),n._zod.parse=(r,o)=>{return r},n._zod.check=(r)=>{let o=r.value,t=i.fn(o);if(t instanceof Promise)return t.then((e)=>j0(e,r,o,n));j0(t,r,o,n);return}});function j0(n,i,r,o){if(!n){let t={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)t.params=o._zod.def.params;i.issues.push(zt(t))}}var No={};pi(No,{zhTW:()=>yb,zhCN:()=>Nb,yo:()=>Gb,vi:()=>Lb,uz:()=>db,ur:()=>kb,uk:()=>Lo,ua:()=>Ob,tr:()=>Ab,th:()=>Sb,ta:()=>Db,sv:()=>Ub,sl:()=>cb,ru:()=>fb,ro:()=>wb,pt:()=>bb,ps:()=>Ib,pl:()=>gb,ota:()=>$b,no:()=>vb,nl:()=>lb,ms:()=>ub,mk:()=>eb,lt:()=>ob,ko:()=>rb,km:()=>Oo,kh:()=>tb,ka:()=>ib,ja:()=>nb,it:()=>sg,is:()=>ag,id:()=>xg,hy:()=>Rg,hu:()=>Cg,hr:()=>zg,he:()=>Mg,frCA:()=>mg,fr:()=>Zg,fi:()=>Eg,fa:()=>_g,es:()=>qg,eo:()=>Tg,en:()=>Ao,el:()=>Vg,de:()=>Bg,da:()=>Kg,cs:()=>Fg,ca:()=>Qg,bg:()=>pg,be:()=>Yg,az:()=>Pg,ar:()=>hg});var yG=()=>{let n={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function i(t){return n[t]??null}let r={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${t.expected}، ولكن تم إدخال ${l}`;return`مدخلات غير مقبولة: يفترض إدخال ${e}، ولكن تم إدخال ${l}`}case"invalid_value":if(t.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${N(t.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return` أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${e} ${t.maximum.toString()} ${u.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${e} ${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${e} ${t.minimum.toString()} ${u.unit}`;return`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${e} ${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${t.prefix}"`;if(e.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${e.suffix}"`;if(e.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${e.includes}"`;if(e.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${e.pattern}`;return`${r[e.format]??t.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${t.divisor}`;case"unrecognized_keys":return`معرف${t.keys.length>1?"ات":""} غريب${t.keys.length>1?"ة":""}: ${A(t.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${t.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${t.origin}`;default:return"مدخل غير مقبول"}}};function hg(){return{localeError:yG()}}var GG=()=>{let n={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function i(t){return n[t]??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"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Yanlış dəyər: gözlənilən instanceof ${t.expected}, daxil olan ${l}`;return`Yanlış dəyər: gözlənilən ${e}, daxil olan ${l}`}case"invalid_value":if(t.values.length===1)return`Yanlış dəyər: gözlənilən ${N(t.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${e}${t.maximum.toString()} ${u.unit??"element"}`;return`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Çox kiçik: gözlənilən ${t.origin} ${e}${t.minimum.toString()} ${u.unit}`;return`Çox kiçik: gözlənilən ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Yanlış mətn: "${e.prefix}" ilə başlamalıdır`;if(e.format==="ends_with")return`Yanlış mətn: "${e.suffix}" ilə bitməlidir`;if(e.format==="includes")return`Yanlış mətn: "${e.includes}" daxil olmalıdır`;if(e.format==="regex")return`Yanlış mətn: ${e.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${r[e.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Pg(){return{localeError:GG()}}function P0(n,i,r,o){let t=Math.abs(n),e=t%10,u=t%100;if(u>=11&&u<=19)return o;if(e===1)return i;if(e>=2&&e<=4)return r;return o}var jG=()=>{let n={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function i(t){return n[t]??null}let r={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},o={nan:"NaN",number:"лік",array:"масіў"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Няправільны ўвод: чакаўся instanceof ${t.expected}, атрымана ${l}`;return`Няправільны ўвод: чакаўся ${e}, атрымана ${l}`}case"invalid_value":if(t.values.length===1)return`Няправільны ўвод: чакалася ${N(t.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u){let l=Number(t.maximum),$=P0(l,u.unit.one,u.unit.few,u.unit.many);return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна ${u.verb} ${e}${t.maximum.toString()} ${$}`}return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна быць ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u){let l=Number(t.minimum),$=P0(l,u.unit.one,u.unit.few,u.unit.many);return`Занадта малы: чакалася, што ${t.origin} павінна ${u.verb} ${e}${t.minimum.toString()} ${$}`}return`Занадта малы: чакалася, што ${t.origin} павінна быць ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${e.prefix}"`;if(e.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${e.suffix}"`;if(e.format==="includes")return`Няправільны радок: павінен змяшчаць "${e.includes}"`;if(e.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${e.pattern}`;return`Няправільны ${r[e.format]??t.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${t.keys.length>1?"ключы":"ключ"}: ${A(t.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${t.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${t.origin}`;default:return"Няправільны ўвод"}}};function Yg(){return{localeError:jG()}}var WG=()=>{let n={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function i(t){return n[t]??null}let r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},o={nan:"NaN",number:"число",array:"масив"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Невалиден вход: очакван instanceof ${t.expected}, получен ${l}`;return`Невалиден вход: очакван ${e}, получен ${l}`}case"invalid_value":if(t.values.length===1)return`Невалиден вход: очакван ${N(t.values[0])}`;return`Невалидна опция: очаквано едно от ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Твърде голямо: очаква се ${t.origin??"стойност"} да съдържа ${e}${t.maximum.toString()} ${u.unit??"елемента"}`;return`Твърде голямо: очаква се ${t.origin??"стойност"} да бъде ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Твърде малко: очаква се ${t.origin} да съдържа ${e}${t.minimum.toString()} ${u.unit}`;return`Твърде малко: очаква се ${t.origin} да бъде ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Невалиден низ: трябва да започва с "${e.prefix}"`;if(e.format==="ends_with")return`Невалиден низ: трябва да завършва с "${e.suffix}"`;if(e.format==="includes")return`Невалиден низ: трябва да включва "${e.includes}"`;if(e.format==="regex")return`Невалиден низ: трябва да съвпада с ${e.pattern}`;let u="Невалиден";if(e.format==="emoji")u="Невалидно";if(e.format==="datetime")u="Невалидно";if(e.format==="date")u="Невалидна";if(e.format==="time")u="Невалидно";if(e.format==="duration")u="Невалидна";return`${u} ${r[e.format]??t.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${t.divisor}`;case"unrecognized_keys":return`Неразпознат${t.keys.length>1?"и":""} ключ${t.keys.length>1?"ове":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${t.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${t.origin}`;default:return"Невалиден вход"}}};function pg(){return{localeError:WG()}}var JG=()=>{let n={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function i(t){return n[t]??null}let r={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Tipus invàlid: s'esperava instanceof ${t.expected}, s'ha rebut ${l}`;return`Tipus invàlid: s'esperava ${e}, s'ha rebut ${l}`}case"invalid_value":if(t.values.length===1)return`Valor invàlid: s'esperava ${N(t.values[0])}`;return`Opció invàlida: s'esperava una de ${A(t.values," o ")}`;case"too_big":{let e=t.inclusive?"com a màxim":"menys de",u=i(t.origin);if(u)return`Massa gran: s'esperava que ${t.origin??"el valor"} contingués ${e} ${t.maximum.toString()} ${u.unit??"elements"}`;return`Massa gran: s'esperava que ${t.origin??"el valor"} fos ${e} ${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?"com a mínim":"més de",u=i(t.origin);if(u)return`Massa petit: s'esperava que ${t.origin} contingués ${e} ${t.minimum.toString()} ${u.unit}`;return`Massa petit: s'esperava que ${t.origin} fos ${e} ${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Format invàlid: ha de començar amb "${e.prefix}"`;if(e.format==="ends_with")return`Format invàlid: ha d'acabar amb "${e.suffix}"`;if(e.format==="includes")return`Format invàlid: ha d'incloure "${e.includes}"`;if(e.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${e.pattern}`;return`Format invàlid per a ${r[e.format]??t.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${t.divisor}`;case"unrecognized_keys":return`Clau${t.keys.length>1?"s":""} no reconeguda${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${t.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${t.origin}`;default:return"Entrada invàlida"}}};function Qg(){return{localeError:JG()}}var HG=()=>{let n={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function i(t){return n[t]??null}let r={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Neplatný vstup: očekáváno instanceof ${t.expected}, obdrženo ${l}`;return`Neplatný vstup: očekáváno ${e}, obdrženo ${l}`}case"invalid_value":if(t.values.length===1)return`Neplatný vstup: očekáváno ${N(t.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Hodnota je příliš velká: ${t.origin??"hodnota"} musí mít ${e}${t.maximum.toString()} ${u.unit??"prvků"}`;return`Hodnota je příliš velká: ${t.origin??"hodnota"} musí být ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Hodnota je příliš malá: ${t.origin??"hodnota"} musí mít ${e}${t.minimum.toString()} ${u.unit??"prvků"}`;return`Hodnota je příliš malá: ${t.origin??"hodnota"} musí být ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Neplatný řetězec: musí začínat na "${e.prefix}"`;if(e.format==="ends_with")return`Neplatný řetězec: musí končit na "${e.suffix}"`;if(e.format==="includes")return`Neplatný řetězec: musí obsahovat "${e.includes}"`;if(e.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${e.pattern}`;return`Neplatný formát ${r[e.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${t.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(t.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function Fg(){return{localeError:HG()}}var XG=()=>{let n={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function i(t){return n[t]??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æt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",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"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ugyldigt input: forventede instanceof ${t.expected}, fik ${l}`;return`Ugyldigt input: forventede ${e}, fik ${l}`}case"invalid_value":if(t.values.length===1)return`Ugyldig værdi: forventede ${N(t.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`For stor: forventede ${l??"value"} ${u.verb} ${e} ${t.maximum.toString()} ${u.unit??"elementer"}`;return`For stor: forventede ${l??"value"} havde ${e} ${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`For lille: forventede ${l} ${u.verb} ${e} ${t.minimum.toString()} ${u.unit}`;return`For lille: forventede ${l} havde ${e} ${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ugyldig streng: skal starte med "${e.prefix}"`;if(e.format==="ends_with")return`Ugyldig streng: skal ende med "${e.suffix}"`;if(e.format==="includes")return`Ugyldig streng: skal indeholde "${e.includes}"`;if(e.format==="regex")return`Ugyldig streng: skal matche mønsteret ${e.pattern}`;return`Ugyldig ${r[e.format]??t.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${t.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${t.origin}`;default:return"Ugyldigt input"}}};function Kg(){return{localeError:XG()}}var hG=()=>{let n={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 i(t){return n[t]??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"},o={nan:"NaN",number:"Zahl",array:"Array"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ungültige Eingabe: erwartet instanceof ${t.expected}, erhalten ${l}`;return`Ungültige Eingabe: erwartet ${e}, erhalten ${l}`}case"invalid_value":if(t.values.length===1)return`Ungültige Eingabe: erwartet ${N(t.values[0])}`;return`Ungültige Option: erwartet eine von ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Zu groß: erwartet, dass ${t.origin??"Wert"} ${e}${t.maximum.toString()} ${u.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${t.origin??"Wert"} ${e}${t.maximum.toString()} ist`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Zu klein: erwartet, dass ${t.origin} ${e}${t.minimum.toString()} ${u.unit} hat`;return`Zu klein: erwartet, dass ${t.origin} ${e}${t.minimum.toString()} ist`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ungültiger String: muss mit "${e.prefix}" beginnen`;if(e.format==="ends_with")return`Ungültiger String: muss mit "${e.suffix}" enden`;if(e.format==="includes")return`Ungültiger String: muss "${e.includes}" enthalten`;if(e.format==="regex")return`Ungültiger String: muss dem Muster ${e.pattern} entsprechen`;return`Ungültig: ${r[e.format]??t.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${t.divisor} sein`;case"unrecognized_keys":return`${t.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(t.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${t.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${t.origin}`;default:return"Ungültige Eingabe"}}};function Bg(){return{localeError:hG()}}var PG=()=>{let n={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function i(t){return n[t]??null}let r={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(typeof t.expected==="string"&&/^[A-Z]/.test(t.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${t.expected}, λήφθηκε ${l}`;return`Μη έγκυρη είσοδος: αναμενόταν ${e}, λήφθηκε ${l}`}case"invalid_value":if(t.values.length===1)return`Μη έγκυρη είσοδος: αναμενόταν ${N(t.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να έχει ${e}${t.maximum.toString()} ${u.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να είναι ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Πολύ μικρό: αναμενόταν ${t.origin} να έχει ${e}${t.minimum.toString()} ${u.unit}`;return`Πολύ μικρό: αναμενόταν ${t.origin} να είναι ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${e.prefix}"`;if(e.format==="ends_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${e.suffix}"`;if(e.format==="includes")return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${e.includes}"`;if(e.format==="regex")return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${e.pattern}`;return`Μη έγκυρο: ${r[e.format]??t.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${t.divisor}`;case"unrecognized_keys":return`Άγνωστ${t.keys.length>1?"α":"ο"} κλειδ${t.keys.length>1?"ιά":"ί"}: ${A(t.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${t.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${t.origin}`;default:return"Μη έγκυρη είσοδος"}}};function Vg(){return{localeError:PG()}}var YG=()=>{let n={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 i(t){return n[t]??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"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;return`Invalid input: expected ${e}, received ${l}`}case"invalid_value":if(t.values.length===1)return`Invalid input: expected ${N(t.values[0])}`;return`Invalid option: expected one of ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Too big: expected ${t.origin??"value"} to have ${e}${t.maximum.toString()} ${u.unit??"elements"}`;return`Too big: expected ${t.origin??"value"} to be ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Too small: expected ${t.origin} to have ${e}${t.minimum.toString()} ${u.unit}`;return`Too small: expected ${t.origin} to be ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Invalid string: must start with "${e.prefix}"`;if(e.format==="ends_with")return`Invalid string: must end with "${e.suffix}"`;if(e.format==="includes")return`Invalid string: must include "${e.includes}"`;if(e.format==="regex")return`Invalid string: must match pattern ${e.pattern}`;return`Invalid ${r[e.format]??t.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${t.divisor}`;case"unrecognized_keys":return`Unrecognized key${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Invalid key in ${t.origin}`;case"invalid_union":if(t.options&&Array.isArray(t.options)&&t.options.length>0)return`Invalid discriminator value. Expected ${t.options.map((u)=>`'${u}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${t.origin}`;default:return"Invalid input"}}};function Ao(){return{localeError:YG()}}var pG=()=>{let n={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function i(t){return n[t]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Nevalida enigo: atendiĝis instanceof ${t.expected}, riceviĝis ${l}`;return`Nevalida enigo: atendiĝis ${e}, riceviĝis ${l}`}case"invalid_value":if(t.values.length===1)return`Nevalida enigo: atendiĝis ${N(t.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${e}${t.maximum.toString()} ${u.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Tro malgranda: atendiĝis ke ${t.origin} havu ${e}${t.minimum.toString()} ${u.unit}`;return`Tro malgranda: atendiĝis ke ${t.origin} estu ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${e.prefix}"`;if(e.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${e.suffix}"`;if(e.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${e.includes}"`;if(e.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${e.pattern}`;return`Nevalida ${r[e.format]??t.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${t.divisor}`;case"unrecognized_keys":return`Nekonata${t.keys.length>1?"j":""} ŝlosilo${t.keys.length>1?"j":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${t.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${t.origin}`;default:return"Nevalida enigo"}}};function Tg(){return{localeError:pG()}}var QG=()=>{let n={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function i(t){return n[t]??null}let r={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Entrada inválida: se esperaba instanceof ${t.expected}, recibido ${l}`;return`Entrada inválida: se esperaba ${e}, recibido ${l}`}case"invalid_value":if(t.values.length===1)return`Entrada inválida: se esperaba ${N(t.values[0])}`;return`Opción inválida: se esperaba una de ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${e}${t.maximum.toString()} ${u.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${l??"valor"} fuera ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`Demasiado pequeño: se esperaba que ${l} tuviera ${e}${t.minimum.toString()} ${u.unit}`;return`Demasiado pequeño: se esperaba que ${l} fuera ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Cadena inválida: debe comenzar con "${e.prefix}"`;if(e.format==="ends_with")return`Cadena inválida: debe terminar en "${e.suffix}"`;if(e.format==="includes")return`Cadena inválida: debe incluir "${e.includes}"`;if(e.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${e.pattern}`;return`Inválido ${r[e.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o[t.origin]??t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o[t.origin]??t.origin}`;default:return"Entrada inválida"}}};function qg(){return{localeError:QG()}}var FG=()=>{let n={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function i(t){return n[t]??null}let r={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},o={nan:"NaN",number:"عدد",array:"آرایه"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`ورودی نامعتبر: میبایست instanceof ${t.expected} میبود، ${l} دریافت شد`;return`ورودی نامعتبر: میبایست ${e} میبود، ${l} دریافت شد`}case"invalid_value":if(t.values.length===1)return`ورودی نامعتبر: میبایست ${N(t.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${A(t.values,"|")} میبود`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`خیلی بزرگ: ${t.origin??"مقدار"} باید ${e}${t.maximum.toString()} ${u.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${t.origin??"مقدار"} باید ${e}${t.maximum.toString()} باشد`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`خیلی کوچک: ${t.origin} باید ${e}${t.minimum.toString()} ${u.unit} باشد`;return`خیلی کوچک: ${t.origin} باید ${e}${t.minimum.toString()} باشد`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`رشته نامعتبر: باید با "${e.prefix}" شروع شود`;if(e.format==="ends_with")return`رشته نامعتبر: باید با "${e.suffix}" تمام شود`;if(e.format==="includes")return`رشته نامعتبر: باید شامل "${e.includes}" باشد`;if(e.format==="regex")return`رشته نامعتبر: باید با الگوی ${e.pattern} مطابقت داشته باشد`;return`${r[e.format]??t.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${t.divisor} باشد`;case"unrecognized_keys":return`کلید${t.keys.length>1?"های":""} ناشناس: ${A(t.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${t.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${t.origin}`;default:return"ورودی نامعتبر"}}};function _g(){return{localeError:FG()}}var KG=()=>{let n={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function i(t){return n[t]??null}let r={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Virheellinen tyyppi: odotettiin instanceof ${t.expected}, oli ${l}`;return`Virheellinen tyyppi: odotettiin ${e}, oli ${l}`}case"invalid_value":if(t.values.length===1)return`Virheellinen syöte: täytyy olla ${N(t.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Liian suuri: ${u.subject} täytyy olla ${e}${t.maximum.toString()} ${u.unit}`.trim();return`Liian suuri: arvon täytyy olla ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Liian pieni: ${u.subject} täytyy olla ${e}${t.minimum.toString()} ${u.unit}`.trim();return`Liian pieni: arvon täytyy olla ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${e.prefix}"`;if(e.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${e.suffix}"`;if(e.format==="includes")return`Virheellinen syöte: täytyy sisältää "${e.includes}"`;if(e.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${e.pattern}`;return`Virheellinen ${r[e.format]??t.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${t.divisor} monikerta`;case"unrecognized_keys":return`${t.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(t.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Eg(){return{localeError:KG()}}var BG=()=>{let n={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function i(t){return n[t]??null}let r={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},o={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",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(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Entrée invalide : instanceof ${t.expected} attendu, ${l} reçu`;return`Entrée invalide : ${e} attendu, ${l} reçu`}case"invalid_value":if(t.values.length===1)return`Entrée invalide : ${N(t.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(t.values,"|")} attendue`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Trop grand : ${o[t.origin]??"valeur"} doit ${u.verb} ${e}${t.maximum.toString()} ${u.unit??"élément(s)"}`;return`Trop grand : ${o[t.origin]??"valeur"} doit être ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Trop petit : ${o[t.origin]??"valeur"} doit ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`Trop petit : ${o[t.origin]??"valeur"} doit être ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Chaîne invalide : doit commencer par "${e.prefix}"`;if(e.format==="ends_with")return`Chaîne invalide : doit se terminer par "${e.suffix}"`;if(e.format==="includes")return`Chaîne invalide : doit inclure "${e.includes}"`;if(e.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${e.pattern}`;return`${r[e.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${A(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function Zg(){return{localeError:BG()}}var VG=()=>{let n={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function i(t){return n[t]??null}let r={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Entrée invalide : attendu instanceof ${t.expected}, reçu ${l}`;return`Entrée invalide : attendu ${e}, reçu ${l}`}case"invalid_value":if(t.values.length===1)return`Entrée invalide : attendu ${N(t.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"≤":"<",u=i(t.origin);if(u)return`Trop grand : attendu que ${t.origin??"la valeur"} ait ${e}${t.maximum.toString()} ${u.unit}`;return`Trop grand : attendu que ${t.origin??"la valeur"} soit ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?"≥":">",u=i(t.origin);if(u)return`Trop petit : attendu que ${t.origin} ait ${e}${t.minimum.toString()} ${u.unit}`;return`Trop petit : attendu que ${t.origin} soit ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Chaîne invalide : doit commencer par "${e.prefix}"`;if(e.format==="ends_with")return`Chaîne invalide : doit se terminer par "${e.suffix}"`;if(e.format==="includes")return`Chaîne invalide : doit inclure "${e.includes}"`;if(e.format==="regex")return`Chaîne invalide : doit correspondre au motif ${e.pattern}`;return`${r[e.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${A(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function mg(){return{localeError:VG()}}var TG=()=>{let n={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},i={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=(I)=>I?n[I]:void 0,o=(I)=>{let g=r(I);if(g)return g.label;return I??n.unknown.label},t=(I)=>`ה${o(I)}`,e=(I)=>{return(r(I)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},u=(I)=>{if(!I)return null;return i[I]??null},l={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",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:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},$={nan:"NaN"};return(I)=>{switch(I.code){case"invalid_type":{let g=I.expected,b=$[g??""]??o(g),w=y(I.input),f=$[w]??n[w]?.label??w;if(/^[A-Z]/.test(I.expected))return`קלט לא תקין: צריך להיות instanceof ${I.expected}, התקבל ${f}`;return`קלט לא תקין: צריך להיות ${b}, התקבל ${f}`}case"invalid_value":{if(I.values.length===1)return`ערך לא תקין: הערך חייב להיות ${N(I.values[0])}`;let g=I.values.map((f)=>N(f));if(I.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${g[0]} או ${g[1]}`;let b=g[g.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${g.slice(0,-1).join(", ")} או ${b}`}case"too_big":{let g=u(I.origin),b=t(I.origin??"value");if(I.origin==="string")return`${g?.longLabel??"ארוך"} מדי: ${b} צריכה להכיל ${I.maximum.toString()} ${g?.unit??""} ${I.inclusive?"או פחות":"לכל היותר"}`.trim();if(I.origin==="number"){let c=I.inclusive?`קטן או שווה ל-${I.maximum}`:`קטן מ-${I.maximum}`;return`גדול מדי: ${b} צריך להיות ${c}`}if(I.origin==="array"||I.origin==="set"){let c=I.origin==="set"?"צריכה":"צריך",S=I.inclusive?`${I.maximum} ${g?.unit??""} או פחות`:`פחות מ-${I.maximum} ${g?.unit??""}`;return`גדול מדי: ${b} ${c} להכיל ${S}`.trim()}let w=I.inclusive?"<=":"<",f=e(I.origin??"value");if(g?.unit)return`${g.longLabel} מדי: ${b} ${f} ${w}${I.maximum.toString()} ${g.unit}`;return`${g?.longLabel??"גדול"} מדי: ${b} ${f} ${w}${I.maximum.toString()}`}case"too_small":{let g=u(I.origin),b=t(I.origin??"value");if(I.origin==="string")return`${g?.shortLabel??"קצר"} מדי: ${b} צריכה להכיל ${I.minimum.toString()} ${g?.unit??""} ${I.inclusive?"או יותר":"לפחות"}`.trim();if(I.origin==="number"){let c=I.inclusive?`גדול או שווה ל-${I.minimum}`:`גדול מ-${I.minimum}`;return`קטן מדי: ${b} צריך להיות ${c}`}if(I.origin==="array"||I.origin==="set"){let c=I.origin==="set"?"צריכה":"צריך";if(I.minimum===1&&I.inclusive){let k=I.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${b} ${c} להכיל ${k}`}let S=I.inclusive?`${I.minimum} ${g?.unit??""} או יותר`:`יותר מ-${I.minimum} ${g?.unit??""}`;return`קטן מדי: ${b} ${c} להכיל ${S}`.trim()}let w=I.inclusive?">=":">",f=e(I.origin??"value");if(g?.unit)return`${g.shortLabel} מדי: ${b} ${f} ${w}${I.minimum.toString()} ${g.unit}`;return`${g?.shortLabel??"קטן"} מדי: ${b} ${f} ${w}${I.minimum.toString()}`}case"invalid_format":{let g=I;if(g.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${g.prefix}"`;if(g.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${g.suffix}"`;if(g.format==="includes")return`המחרוזת חייבת לכלול "${g.includes}"`;if(g.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${g.pattern}`;let b=l[g.format],w=b?.label??g.format,c=(b?.gender??"m")==="f"?"תקינה":"תקין";return`${w} לא ${c}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${I.divisor}`;case"unrecognized_keys":return`מפתח${I.keys.length>1?"ות":""} לא מזוה${I.keys.length>1?"ים":"ה"}: ${A(I.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${t(I.origin??"array")}`;default:return"קלט לא תקין"}}};function Mg(){return{localeError:TG()}}var qG=()=>{let n={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function i(t){return n[t]??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"},o={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(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Neispravan unos: očekuje se instanceof ${t.expected}, a primljeno je ${l}`;return`Neispravan unos: očekuje se ${e}, a primljeno je ${l}`}case"invalid_value":if(t.values.length===1)return`Neispravna vrijednost: očekivano ${N(t.values[0])}`;return`Neispravna opcija: očekivano jedno od ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`Preveliko: očekivano da ${l??"vrijednost"} ima ${e}${t.maximum.toString()} ${u.unit??"elemenata"}`;return`Preveliko: očekivano da ${l??"vrijednost"} bude ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin),l=o[t.origin]??t.origin;if(u)return`Premalo: očekivano da ${l} ima ${e}${t.minimum.toString()} ${u.unit}`;return`Premalo: očekivano da ${l} bude ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Neispravan tekst: mora započinjati s "${e.prefix}"`;if(e.format==="ends_with")return`Neispravan tekst: mora završavati s "${e.suffix}"`;if(e.format==="includes")return`Neispravan tekst: mora sadržavati "${e.includes}"`;if(e.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${e.pattern}`;return`Neispravna ${r[e.format]??t.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${t.divisor}`;case"unrecognized_keys":return`Neprepoznat${t.keys.length>1?"i ključevi":" ključ"}: ${A(t.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${o[t.origin]??t.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[t.origin]??t.origin}`;default:return"Neispravan unos"}}};function zg(){return{localeError:qG()}}var _G=()=>{let n={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function i(t){return n[t]??null}let r={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"szám",array:"tömb"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Érvénytelen bemenet: a várt érték instanceof ${t.expected}, a kapott érték ${l}`;return`Érvénytelen bemenet: a várt érték ${e}, a kapott érték ${l}`}case"invalid_value":if(t.values.length===1)return`Érvénytelen bemenet: a várt érték ${N(t.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Túl nagy: ${t.origin??"érték"} mérete túl nagy ${e}${t.maximum.toString()} ${u.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${t.origin??"érték"} túl nagy: ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Túl kicsi: a bemeneti érték ${t.origin} mérete túl kicsi ${e}${t.minimum.toString()} ${u.unit}`;return`Túl kicsi: a bemeneti érték ${t.origin} túl kicsi ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Érvénytelen string: "${e.prefix}" értékkel kell kezdődnie`;if(e.format==="ends_with")return`Érvénytelen string: "${e.suffix}" értékkel kell végződnie`;if(e.format==="includes")return`Érvénytelen string: "${e.includes}" értéket kell tartalmaznia`;if(e.format==="regex")return`Érvénytelen string: ${e.pattern} mintának kell megfelelnie`;return`Érvénytelen ${r[e.format]??t.format}`}case"not_multiple_of":return`Érvénytelen szám: ${t.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${t.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${t.origin}`;default:return"Érvénytelen bemenet"}}};function Cg(){return{localeError:_G()}}function Y0(n,i,r){return Math.abs(n)===1?i:r}function ir(n){if(!n)return"";let i=["ա","ե","ը","ի","ո","ու","օ"],r=n[n.length-1];return n+(i.includes(r)?"ն":"ը")}var EG=()=>{let n={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function i(t){return n[t]??null}let r={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},o={nan:"NaN",number:"թիվ",array:"զանգված"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${t.expected}, ստացվել է ${l}`;return`Սխալ մուտքագրում․ սպասվում էր ${e}, ստացվել է ${l}`}case"invalid_value":if(t.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${N(t.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u){let l=Number(t.maximum),$=Y0(l,u.unit.one,u.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${ir(t.origin??"արժեք")} կունենա ${e}${t.maximum.toString()} ${$}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${ir(t.origin??"արժեք")} լինի ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u){let l=Number(t.minimum),$=Y0(l,u.unit.one,u.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${ir(t.origin)} կունենա ${e}${t.minimum.toString()} ${$}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${ir(t.origin)} լինի ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${e.prefix}"-ով`;if(e.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${e.suffix}"-ով`;if(e.format==="includes")return`Սխալ տող․ պետք է պարունակի "${e.includes}"`;if(e.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${e.pattern} ձևաչափին`;return`Սխալ ${r[e.format]??t.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${t.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${t.keys.length>1?"ներ":""}. ${A(t.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${ir(t.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${ir(t.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function Rg(){return{localeError:EG()}}var ZG=()=>{let n={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function i(t){return n[t]??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"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Input tidak valid: diharapkan instanceof ${t.expected}, diterima ${l}`;return`Input tidak valid: diharapkan ${e}, diterima ${l}`}case"invalid_value":if(t.values.length===1)return`Input tidak valid: diharapkan ${N(t.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Terlalu besar: diharapkan ${t.origin??"value"} memiliki ${e}${t.maximum.toString()} ${u.unit??"elemen"}`;return`Terlalu besar: diharapkan ${t.origin??"value"} menjadi ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Terlalu kecil: diharapkan ${t.origin} memiliki ${e}${t.minimum.toString()} ${u.unit}`;return`Terlalu kecil: diharapkan ${t.origin} menjadi ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`String tidak valid: harus dimulai dengan "${e.prefix}"`;if(e.format==="ends_with")return`String tidak valid: harus berakhir dengan "${e.suffix}"`;if(e.format==="includes")return`String tidak valid: harus menyertakan "${e.includes}"`;if(e.format==="regex")return`String tidak valid: harus sesuai pola ${e.pattern}`;return`${r[e.format]??t.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${t.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${t.origin}`;default:return"Input tidak valid"}}};function xg(){return{localeError:ZG()}}var mG=()=>{let n={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function i(t){return n[t]??null}let r={regex:"gildi",email:"netfang",url:"vefslóð",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ími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",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ölugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"númer",array:"fylki"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Rangt gildi: Þú slóst inn ${l} þar sem á að vera instanceof ${t.expected}`;return`Rangt gildi: Þú slóst inn ${l} þar sem á að vera ${e}`}case"invalid_value":if(t.values.length===1)return`Rangt gildi: gert ráð fyrir ${N(t.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} hafi ${e}${t.maximum.toString()} ${u.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} sé ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Of lítið: gert er ráð fyrir að ${t.origin} hafi ${e}${t.minimum.toString()} ${u.unit}`;return`Of lítið: gert er ráð fyrir að ${t.origin} sé ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ógildur strengur: verður að byrja á "${e.prefix}"`;if(e.format==="ends_with")return`Ógildur strengur: verður að enda á "${e.suffix}"`;if(e.format==="includes")return`Ógildur strengur: verður að innihalda "${e.includes}"`;if(e.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${e.pattern}`;return`Rangt ${r[e.format]??t.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${t.divisor}`;case"unrecognized_keys":return`Óþekkt ${t.keys.length>1?"ir lyklar":"ur lykill"}: ${A(t.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${t.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${t.origin}`;default:return"Rangt gildi"}}};function ag(){return{localeError:mG()}}var MG=()=>{let n={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function i(t){return n[t]??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"},o={nan:"NaN",number:"numero",array:"vettore"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Input non valido: atteso instanceof ${t.expected}, ricevuto ${l}`;return`Input non valido: atteso ${e}, ricevuto ${l}`}case"invalid_value":if(t.values.length===1)return`Input non valido: atteso ${N(t.values[0])}`;return`Opzione non valida: atteso uno tra ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Troppo grande: ${t.origin??"valore"} deve avere ${e}${t.maximum.toString()} ${u.unit??"elementi"}`;return`Troppo grande: ${t.origin??"valore"} deve essere ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Troppo piccolo: ${t.origin} deve avere ${e}${t.minimum.toString()} ${u.unit}`;return`Troppo piccolo: ${t.origin} deve essere ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Stringa non valida: deve iniziare con "${e.prefix}"`;if(e.format==="ends_with")return`Stringa non valida: deve terminare con "${e.suffix}"`;if(e.format==="includes")return`Stringa non valida: deve includere "${e.includes}"`;if(e.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${e.pattern}`;return`Input non valido: ${r[e.format]??t.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${t.divisor}`;case"unrecognized_keys":return`Chiav${t.keys.length>1?"i":"e"} non riconosciut${t.keys.length>1?"e":"a"}: ${A(t.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${t.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${t.origin}`;default:return"Input non valido"}}};function sg(){return{localeError:MG()}}var zG=()=>{let n={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function i(t){return n[t]??null}let r={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},o={nan:"NaN",number:"数値",array:"配列"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`無効な入力: instanceof ${t.expected}が期待されましたが、${l}が入力されました`;return`無効な入力: ${e}が期待されましたが、${l}が入力されました`}case"invalid_value":if(t.values.length===1)return`無効な入力: ${N(t.values[0])}が期待されました`;return`無効な選択: ${A(t.values,"、")}のいずれかである必要があります`;case"too_big":{let e=t.inclusive?"以下である":"より小さい",u=i(t.origin);if(u)return`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${u.unit??"要素"}${e}必要があります`;return`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${e}必要があります`}case"too_small":{let e=t.inclusive?"以上である":"より大きい",u=i(t.origin);if(u)return`小さすぎる値: ${t.origin}は${t.minimum.toString()}${u.unit}${e}必要があります`;return`小さすぎる値: ${t.origin}は${t.minimum.toString()}${e}必要があります`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`無効な文字列: "${e.prefix}"で始まる必要があります`;if(e.format==="ends_with")return`無効な文字列: "${e.suffix}"で終わる必要があります`;if(e.format==="includes")return`無効な文字列: "${e.includes}"を含む必要があります`;if(e.format==="regex")return`無効な文字列: パターン${e.pattern}に一致する必要があります`;return`無効な${r[e.format]??t.format}`}case"not_multiple_of":return`無効な数値: ${t.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${t.keys.length>1?"群":""}: ${A(t.keys,"、")}`;case"invalid_key":return`${t.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${t.origin}内の無効な値`;default:return"無効な入力"}}};function nb(){return{localeError:zG()}}var CG=()=>{let n={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function i(t){return n[t]??null}let r={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},o={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${t.expected}, მიღებული ${l}`;return`არასწორი შეყვანა: მოსალოდნელი ${e}, მიღებული ${l}`}case"invalid_value":if(t.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${N(t.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(t.values,"|")}-დან`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} ${u.verb} ${e}${t.maximum.toString()} ${u.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} იყოს ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`ზედმეტად პატარა: მოსალოდნელი ${t.origin} ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${t.origin} იყოს ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`არასწორი ველი: უნდა იწყებოდეს "${e.prefix}"-ით`;if(e.format==="ends_with")return`არასწორი ველი: უნდა მთავრდებოდეს "${e.suffix}"-ით`;if(e.format==="includes")return`არასწორი ველი: უნდა შეიცავდეს "${e.includes}"-ს`;if(e.format==="regex")return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${e.pattern}`;return`არასწორი ${r[e.format]??t.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${t.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${t.keys.length>1?"ები":"ი"}: ${A(t.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${t.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${t.origin}-ში`;default:return"არასწორი შეყვანა"}}};function ib(){return{localeError:CG()}}var RG=()=>{let n={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function i(t){return n[t]??null}let r={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},o={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${t.expected} ប៉ុន្តែទទួលបាន ${l}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${e} ប៉ុន្តែទទួលបាន ${l}`}case"invalid_value":if(t.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${N(t.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${e} ${t.maximum.toString()} ${u.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${e} ${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`តូចពេក៖ ត្រូវការ ${t.origin} ${e} ${t.minimum.toString()} ${u.unit}`;return`តូចពេក៖ ត្រូវការ ${t.origin} ${e} ${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${e.prefix}"`;if(e.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${e.suffix}"`;if(e.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${e.includes}"`;if(e.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${e.pattern}`;return`មិនត្រឹមត្រូវ៖ ${r[e.format]??t.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${t.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(t.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Oo(){return{localeError:RG()}}function tb(){return Oo()}var xG=()=>{let n={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function i(t){return n[t]??null}let r={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`잘못된 입력: 예상 타입은 instanceof ${t.expected}, 받은 타입은 ${l}입니다`;return`잘못된 입력: 예상 타입은 ${e}, 받은 타입은 ${l}입니다`}case"invalid_value":if(t.values.length===1)return`잘못된 입력: 값은 ${N(t.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(t.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let e=t.inclusive?"이하":"미만",u=e==="미만"?"이어야 합니다":"여야 합니다",l=i(t.origin),$=l?.unit??"요소";if(l)return`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()}${$} ${e}${u}`;return`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()} ${e}${u}`}case"too_small":{let e=t.inclusive?"이상":"초과",u=e==="이상"?"이어야 합니다":"여야 합니다",l=i(t.origin),$=l?.unit??"요소";if(l)return`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()}${$} ${e}${u}`;return`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()} ${e}${u}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`잘못된 문자열: "${e.prefix}"(으)로 시작해야 합니다`;if(e.format==="ends_with")return`잘못된 문자열: "${e.suffix}"(으)로 끝나야 합니다`;if(e.format==="includes")return`잘못된 문자열: "${e.includes}"을(를) 포함해야 합니다`;if(e.format==="regex")return`잘못된 문자열: 정규식 ${e.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${r[e.format]??t.format}`}case"not_multiple_of":return`잘못된 숫자: ${t.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(t.keys,", ")}`;case"invalid_key":return`잘못된 키: ${t.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${t.origin}`;default:return"잘못된 입력"}}};function rb(){return{localeError:xG()}}var ko=(n)=>{return n.charAt(0).toUpperCase()+n.slice(1)};function p0(n){let i=Math.abs(n),r=i%10,o=i%100;if(o>=11&&o<=19||r===0)return"many";if(r===1)return"one";return"few"}var aG=()=>{let n={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function i(t,e,u,l){let $=n[t]??null;if($===null)return $;return{unit:$.unit[e],verb:$.verb[l][u?"inclusive":"notInclusive"]}}let r={regex:"įvestis",email:"el. pašto 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ė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},o={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Gautas tipas ${l}, o tikėtasi - instanceof ${t.expected}`;return`Gautas tipas ${l}, o tikėtasi - ${e}`}case"invalid_value":if(t.values.length===1)return`Privalo būti ${N(t.values[0])}`;return`Privalo būti vienas iš ${A(t.values,"|")} pasirinkimų`;case"too_big":{let e=o[t.origin]??t.origin,u=i(t.origin,p0(Number(t.maximum)),t.inclusive??!1,"smaller");if(u?.verb)return`${ko(e??t.origin??"reikšmė")} ${u.verb} ${t.maximum.toString()} ${u.unit??"elementų"}`;let l=t.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${ko(e??t.origin??"reikšmė")} turi būti ${l} ${t.maximum.toString()} ${u?.unit}`}case"too_small":{let e=o[t.origin]??t.origin,u=i(t.origin,p0(Number(t.minimum)),t.inclusive??!1,"bigger");if(u?.verb)return`${ko(e??t.origin??"reikšmė")} ${u.verb} ${t.minimum.toString()} ${u.unit??"elementų"}`;let l=t.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${ko(e??t.origin??"reikšmė")} turi būti ${l} ${t.minimum.toString()} ${u?.unit}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Eilutė privalo prasidėti "${e.prefix}"`;if(e.format==="ends_with")return`Eilutė privalo pasibaigti "${e.suffix}"`;if(e.format==="includes")return`Eilutė privalo įtraukti "${e.includes}"`;if(e.format==="regex")return`Eilutė privalo atitikti ${e.pattern}`;return`Neteisingas ${r[e.format]??t.format}`}case"not_multiple_of":return`Skaičius privalo būti ${t.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${t.keys.length>1?"i":"as"} rakt${t.keys.length>1?"ai":"as"}: ${A(t.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let e=o[t.origin]??t.origin;return`${ko(e??t.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function ob(){return{localeError:aG()}}var sG=()=>{let n={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function i(t){return n[t]??null}let r={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},o={nan:"NaN",number:"број",array:"низа"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Грешен внес: се очекува instanceof ${t.expected}, примено ${l}`;return`Грешен внес: се очекува ${e}, примено ${l}`}case"invalid_value":if(t.values.length===1)return`Invalid input: expected ${N(t.values[0])}`;return`Грешана опција: се очекува една ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Премногу голем: се очекува ${t.origin??"вредноста"} да има ${e}${t.maximum.toString()} ${u.unit??"елементи"}`;return`Премногу голем: се очекува ${t.origin??"вредноста"} да биде ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Премногу мал: се очекува ${t.origin} да има ${e}${t.minimum.toString()} ${u.unit}`;return`Премногу мал: се очекува ${t.origin} да биде ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Неважечка низа: мора да започнува со "${e.prefix}"`;if(e.format==="ends_with")return`Неважечка низа: мора да завршува со "${e.suffix}"`;if(e.format==="includes")return`Неважечка низа: мора да вклучува "${e.includes}"`;if(e.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${e.pattern}`;return`Invalid ${r[e.format]??t.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(t.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${t.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${t.origin}`;default:return"Грешен внес"}}};function eb(){return{localeError:sG()}}var nj=()=>{let n={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function i(t){return n[t]??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"},o={nan:"NaN",number:"nombor"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Input tidak sah: dijangka instanceof ${t.expected}, diterima ${l}`;return`Input tidak sah: dijangka ${e}, diterima ${l}`}case"invalid_value":if(t.values.length===1)return`Input tidak sah: dijangka ${N(t.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Terlalu besar: dijangka ${t.origin??"nilai"} ${u.verb} ${e}${t.maximum.toString()} ${u.unit??"elemen"}`;return`Terlalu besar: dijangka ${t.origin??"nilai"} adalah ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Terlalu kecil: dijangka ${t.origin} ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`Terlalu kecil: dijangka ${t.origin} adalah ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`String tidak sah: mesti bermula dengan "${e.prefix}"`;if(e.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${e.suffix}"`;if(e.format==="includes")return`String tidak sah: mesti mengandungi "${e.includes}"`;if(e.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${e.pattern}`;return`${r[e.format]??t.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(t.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${t.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${t.origin}`;default:return"Input tidak sah"}}};function ub(){return{localeError:nj()}}var ij=()=>{let n={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function i(t){return n[t]??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"},o={nan:"NaN",number:"getal"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ongeldige invoer: verwacht instanceof ${t.expected}, ontving ${l}`;return`Ongeldige invoer: verwacht ${e}, ontving ${l}`}case"invalid_value":if(t.values.length===1)return`Ongeldige invoer: verwacht ${N(t.values[0])}`;return`Ongeldige optie: verwacht één van ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin),l=t.origin==="date"?"laat":t.origin==="string"?"lang":"groot";if(u)return`Te ${l}: verwacht dat ${t.origin??"waarde"} ${e}${t.maximum.toString()} ${u.unit??"elementen"} ${u.verb}`;return`Te ${l}: verwacht dat ${t.origin??"waarde"} ${e}${t.maximum.toString()} is`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin),l=t.origin==="date"?"vroeg":t.origin==="string"?"kort":"klein";if(u)return`Te ${l}: verwacht dat ${t.origin} ${e}${t.minimum.toString()} ${u.unit} ${u.verb}`;return`Te ${l}: verwacht dat ${t.origin} ${e}${t.minimum.toString()} is`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ongeldige tekst: moet met "${e.prefix}" beginnen`;if(e.format==="ends_with")return`Ongeldige tekst: moet op "${e.suffix}" eindigen`;if(e.format==="includes")return`Ongeldige tekst: moet "${e.includes}" bevatten`;if(e.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${e.pattern}`;return`Ongeldig: ${r[e.format]??t.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${t.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${t.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${t.origin}`;default:return"Ongeldige invoer"}}};function lb(){return{localeError:ij()}}var tj=()=>{let n={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function i(t){return n[t]??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åde",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ugyldig input: forventet instanceof ${t.expected}, fikk ${l}`;return`Ugyldig input: forventet ${e}, fikk ${l}`}case"invalid_value":if(t.values.length===1)return`Ugyldig verdi: forventet ${N(t.values[0])}`;return`Ugyldig valg: forventet en av ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`For stor(t): forventet ${t.origin??"value"} til å ha ${e}${t.maximum.toString()} ${u.unit??"elementer"}`;return`For stor(t): forventet ${t.origin??"value"} til å ha ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`For lite(n): forventet ${t.origin} til å ha ${e}${t.minimum.toString()} ${u.unit}`;return`For lite(n): forventet ${t.origin} til å ha ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ugyldig streng: må starte med "${e.prefix}"`;if(e.format==="ends_with")return`Ugyldig streng: må ende med "${e.suffix}"`;if(e.format==="includes")return`Ugyldig streng: må inneholde "${e.includes}"`;if(e.format==="regex")return`Ugyldig streng: må matche mønsteret ${e.pattern}`;return`Ugyldig ${r[e.format]??t.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function vb(){return{localeError:tj()}}var rj=()=>{let n={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function i(t){return n[t]??null}let r={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Fâsit giren: umulan instanceof ${t.expected}, alınan ${l}`;return`Fâsit giren: umulan ${e}, alınan ${l}`}case"invalid_value":if(t.values.length===1)return`Fâsit giren: umulan ${N(t.values[0])}`;return`Fâsit tercih: mûteberler ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Fazla büyük: ${t.origin??"value"}, ${e}${t.maximum.toString()} ${u.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${t.origin??"value"}, ${e}${t.maximum.toString()} olmalıydı.`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Fazla küçük: ${t.origin}, ${e}${t.minimum.toString()} ${u.unit} sahip olmalıydı.`;return`Fazla küçük: ${t.origin}, ${e}${t.minimum.toString()} olmalıydı.`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Fâsit metin: "${e.prefix}" ile başlamalı.`;if(e.format==="ends_with")return`Fâsit metin: "${e.suffix}" ile bitmeli.`;if(e.format==="includes")return`Fâsit metin: "${e.includes}" ihtivâ etmeli.`;if(e.format==="regex")return`Fâsit metin: ${e.pattern} nakşına uymalı.`;return`Fâsit ${r[e.format]??t.format}`}case"not_multiple_of":return`Fâsit sayı: ${t.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${t.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function $b(){return{localeError:rj()}}var oj=()=>{let n={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function i(t){return n[t]??null}let r={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},o={nan:"NaN",number:"عدد",array:"ارې"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`ناسم ورودي: باید instanceof ${t.expected} وای, مګر ${l} ترلاسه شو`;return`ناسم ورودي: باید ${e} وای, مګر ${l} ترلاسه شو`}case"invalid_value":if(t.values.length===1)return`ناسم ورودي: باید ${N(t.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(t.values,"|")} څخه وای`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`ډیر لوی: ${t.origin??"ارزښت"} باید ${e}${t.maximum.toString()} ${u.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${t.origin??"ارزښت"} باید ${e}${t.maximum.toString()} وي`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`ډیر کوچنی: ${t.origin} باید ${e}${t.minimum.toString()} ${u.unit} ولري`;return`ډیر کوچنی: ${t.origin} باید ${e}${t.minimum.toString()} وي`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`ناسم متن: باید د "${e.prefix}" سره پیل شي`;if(e.format==="ends_with")return`ناسم متن: باید د "${e.suffix}" سره پای ته ورسيږي`;if(e.format==="includes")return`ناسم متن: باید "${e.includes}" ولري`;if(e.format==="regex")return`ناسم متن: باید د ${e.pattern} سره مطابقت ولري`;return`${r[e.format]??t.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${t.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${t.keys.length>1?"کلیډونه":"کلیډ"}: ${A(t.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${t.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${t.origin} کې`;default:return"ناسمه ورودي"}}};function Ib(){return{localeError:oj()}}var ej=()=>{let n={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function i(t){return n[t]??null}let r={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},o={nan:"NaN",number:"liczba",array:"tablica"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${t.expected}, otrzymano ${l}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${e}, otrzymano ${l}`}case"invalid_value":if(t.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${N(t.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Za duża wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${e}${t.maximum.toString()} ${u.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Za mała wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${e}${t.minimum.toString()} ${u.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${e.prefix}"`;if(e.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${e.suffix}"`;if(e.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${e.includes}"`;if(e.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${e.pattern}`;return`Nieprawidłow(y/a/e) ${r[e.format]??t.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${t.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${t.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${t.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function gb(){return{localeError:ej()}}var uj=()=>{let n={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function i(t){return n[t]??null}let r={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"número",null:"nulo"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Tipo inválido: esperado instanceof ${t.expected}, recebido ${l}`;return`Tipo inválido: esperado ${e}, recebido ${l}`}case"invalid_value":if(t.values.length===1)return`Entrada inválida: esperado ${N(t.values[0])}`;return`Opção inválida: esperada uma das ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Muito grande: esperado que ${t.origin??"valor"} tivesse ${e}${t.maximum.toString()} ${u.unit??"elementos"}`;return`Muito grande: esperado que ${t.origin??"valor"} fosse ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Muito pequeno: esperado que ${t.origin} tivesse ${e}${t.minimum.toString()} ${u.unit}`;return`Muito pequeno: esperado que ${t.origin} fosse ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Texto inválido: deve começar com "${e.prefix}"`;if(e.format==="ends_with")return`Texto inválido: deve terminar com "${e.suffix}"`;if(e.format==="includes")return`Texto inválido: deve incluir "${e.includes}"`;if(e.format==="regex")return`Texto inválido: deve corresponder ao padrão ${e.pattern}`;return`${r[e.format]??t.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Chave${t.keys.length>1?"s":""} desconhecida${t.keys.length>1?"s":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Chave inválida em ${t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${t.origin}`;default:return"Campo inválido"}}};function bb(){return{localeError:uj()}}var lj=()=>{let n={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function i(t){return n[t]??null}let r={regex:"intrare",email:"adresă 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ă și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;return`Intrare invalidă: așteptat ${e}, primit ${l}`}case"invalid_value":if(t.values.length===1)return`Intrare invalidă: așteptat ${N(t.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Prea mare: așteptat ca ${t.origin??"valoarea"} ${u.verb} ${e}${t.maximum.toString()} ${u.unit??"elemente"}`;return`Prea mare: așteptat ca ${t.origin??"valoarea"} să fie ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Prea mic: așteptat ca ${t.origin} ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`Prea mic: așteptat ca ${t.origin} să fie ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Șir invalid: trebuie să înceapă cu "${e.prefix}"`;if(e.format==="ends_with")return`Șir invalid: trebuie să se termine cu "${e.suffix}"`;if(e.format==="includes")return`Șir invalid: trebuie să includă "${e.includes}"`;if(e.format==="regex")return`Șir invalid: trebuie să se potrivească cu modelul ${e.pattern}`;return`Format invalid: ${r[e.format]??t.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${t.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${A(t.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${t.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${t.origin}`;default:return"Intrare invalidă"}}};function wb(){return{localeError:lj()}}function Q0(n,i,r,o){let t=Math.abs(n),e=t%10,u=t%100;if(u>=11&&u<=19)return o;if(e===1)return i;if(e>=2&&e<=4)return r;return o}var vj=()=>{let n={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function i(t){return n[t]??null}let r={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},o={nan:"NaN",number:"число",array:"массив"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Неверный ввод: ожидалось instanceof ${t.expected}, получено ${l}`;return`Неверный ввод: ожидалось ${e}, получено ${l}`}case"invalid_value":if(t.values.length===1)return`Неверный ввод: ожидалось ${N(t.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u){let l=Number(t.maximum),$=Q0(l,u.unit.one,u.unit.few,u.unit.many);return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет иметь ${e}${t.maximum.toString()} ${$}`}return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u){let l=Number(t.minimum),$=Q0(l,u.unit.one,u.unit.few,u.unit.many);return`Слишком маленькое значение: ожидалось, что ${t.origin} будет иметь ${e}${t.minimum.toString()} ${$}`}return`Слишком маленькое значение: ожидалось, что ${t.origin} будет ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Неверная строка: должна начинаться с "${e.prefix}"`;if(e.format==="ends_with")return`Неверная строка: должна заканчиваться на "${e.suffix}"`;if(e.format==="includes")return`Неверная строка: должна содержать "${e.includes}"`;if(e.format==="regex")return`Неверная строка: должна соответствовать шаблону ${e.pattern}`;return`Неверный ${r[e.format]??t.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспознанн${t.keys.length>1?"ые":"ый"} ключ${t.keys.length>1?"и":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${t.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${t.origin}`;default:return"Неверные входные данные"}}};function fb(){return{localeError:vj()}}var $j=()=>{let n={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function i(t){return n[t]??null}let r={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"število",array:"tabela"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Neveljaven vnos: pričakovano instanceof ${t.expected}, prejeto ${l}`;return`Neveljaven vnos: pričakovano ${e}, prejeto ${l}`}case"invalid_value":if(t.values.length===1)return`Neveljaven vnos: pričakovano ${N(t.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} imelo ${e}${t.maximum.toString()} ${u.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Premajhno: pričakovano, da bo ${t.origin} imelo ${e}${t.minimum.toString()} ${u.unit}`;return`Premajhno: pričakovano, da bo ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Neveljaven niz: mora se začeti z "${e.prefix}"`;if(e.format==="ends_with")return`Neveljaven niz: mora se končati z "${e.suffix}"`;if(e.format==="includes")return`Neveljaven niz: mora vsebovati "${e.includes}"`;if(e.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${e.pattern}`;return`Neveljaven ${r[e.format]??t.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${t.divisor}`;case"unrecognized_keys":return`Neprepoznan${t.keys.length>1?"i ključi":" ključ"}: ${A(t.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${t.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${t.origin}`;default:return"Neveljaven vnos"}}};function cb(){return{localeError:$j()}}var Ij=()=>{let n={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function i(t){return n[t]??null}let r={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ogiltig inmatning: förväntat instanceof ${t.expected}, fick ${l}`;return`Ogiltig inmatning: förväntat ${e}, fick ${l}`}case"invalid_value":if(t.values.length===1)return`Ogiltig inmatning: förväntat ${N(t.values[0])}`;return`Ogiltigt val: förväntade en av ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`För stor(t): förväntade ${t.origin??"värdet"} att ha ${e}${t.maximum.toString()} ${u.unit??"element"}`;return`För stor(t): förväntat ${t.origin??"värdet"} att ha ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`För lite(t): förväntade ${t.origin??"värdet"} att ha ${e}${t.minimum.toString()} ${u.unit}`;return`För lite(t): förväntade ${t.origin??"värdet"} att ha ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ogiltig sträng: måste börja med "${e.prefix}"`;if(e.format==="ends_with")return`Ogiltig sträng: måste sluta med "${e.suffix}"`;if(e.format==="includes")return`Ogiltig sträng: måste innehålla "${e.includes}"`;if(e.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${e.pattern}"`;return`Ogiltig(t) ${r[e.format]??t.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(t.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${t.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${t.origin??"värdet"}`;default:return"Ogiltig input"}}};function Ub(){return{localeError:Ij()}}var gj=()=>{let n={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function i(t){return n[t]??null}let r={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${t.expected}, பெறப்பட்டது ${l}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${e}, பெறப்பட்டது ${l}`}case"invalid_value":if(t.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${N(t.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(t.values,"|")} இல் ஒன்று`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${e}${t.maximum.toString()} ${u.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${e}${t.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${e}${t.minimum.toString()} ${u.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${e}${t.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`தவறான சரம்: "${e.prefix}" இல் தொடங்க வேண்டும்`;if(e.format==="ends_with")return`தவறான சரம்: "${e.suffix}" இல் முடிவடைய வேண்டும்`;if(e.format==="includes")return`தவறான சரம்: "${e.includes}" ஐ உள்ளடக்க வேண்டும்`;if(e.format==="regex")return`தவறான சரம்: ${e.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${r[e.format]??t.format}`}case"not_multiple_of":return`தவறான எண்: ${t.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${t.keys.length>1?"கள்":""}: ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${t.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Db(){return{localeError:gj()}}var bj=()=>{let n={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function i(t){return n[t]??null}let r={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},o={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${t.expected} แต่ได้รับ ${l}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${e} แต่ได้รับ ${l}`}case"invalid_value":if(t.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${N(t.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"ไม่เกิน":"น้อยกว่า",u=i(t.origin);if(u)return`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${e} ${t.maximum.toString()} ${u.unit??"รายการ"}`;return`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${e} ${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?"อย่างน้อย":"มากกว่า",u=i(t.origin);if(u)return`น้อยกว่ากำหนด: ${t.origin} ควรมี${e} ${t.minimum.toString()} ${u.unit}`;return`น้อยกว่ากำหนด: ${t.origin} ควรมี${e} ${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${e.prefix}"`;if(e.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${e.suffix}"`;if(e.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${e.includes}" อยู่ในข้อความ`;if(e.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${e.pattern}`;return`รูปแบบไม่ถูกต้อง: ${r[e.format]??t.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${t.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(t.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${t.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${t.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Sb(){return{localeError:bj()}}var wj=()=>{let n={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function i(t){return n[t]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Geçersiz değer: beklenen instanceof ${t.expected}, alınan ${l}`;return`Geçersiz değer: beklenen ${e}, alınan ${l}`}case"invalid_value":if(t.values.length===1)return`Geçersiz değer: beklenen ${N(t.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Çok büyük: beklenen ${t.origin??"değer"} ${e}${t.maximum.toString()} ${u.unit??"öğe"}`;return`Çok büyük: beklenen ${t.origin??"değer"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Çok küçük: beklenen ${t.origin} ${e}${t.minimum.toString()} ${u.unit}`;return`Çok küçük: beklenen ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Geçersiz metin: "${e.prefix}" ile başlamalı`;if(e.format==="ends_with")return`Geçersiz metin: "${e.suffix}" ile bitmeli`;if(e.format==="includes")return`Geçersiz metin: "${e.includes}" içermeli`;if(e.format==="regex")return`Geçersiz metin: ${e.pattern} desenine uymalı`;return`Geçersiz ${r[e.format]??t.format}`}case"not_multiple_of":return`Geçersiz sayı: ${t.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${t.keys.length>1?"lar":""}: ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${t.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Ab(){return{localeError:wj()}}var fj=()=>{let n={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function i(t){return n[t]??null}let r={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},o={nan:"NaN",number:"число",array:"масив"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Неправильні вхідні дані: очікується instanceof ${t.expected}, отримано ${l}`;return`Неправильні вхідні дані: очікується ${e}, отримано ${l}`}case"invalid_value":if(t.values.length===1)return`Неправильні вхідні дані: очікується ${N(t.values[0])}`;return`Неправильна опція: очікується одне з ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Занадто велике: очікується, що ${t.origin??"значення"} ${u.verb} ${e}${t.maximum.toString()} ${u.unit??"елементів"}`;return`Занадто велике: очікується, що ${t.origin??"значення"} буде ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Занадто мале: очікується, що ${t.origin} ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`Занадто мале: очікується, що ${t.origin} буде ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Неправильний рядок: повинен починатися з "${e.prefix}"`;if(e.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${e.suffix}"`;if(e.format==="includes")return`Неправильний рядок: повинен містити "${e.includes}"`;if(e.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${e.pattern}`;return`Неправильний ${r[e.format]??t.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${t.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${t.keys.length>1?"і":""}: ${A(t.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${t.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${t.origin}`;default:return"Неправильні вхідні дані"}}};function Lo(){return{localeError:fj()}}function Ob(){return Lo()}var cj=()=>{let n={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function i(t){return n[t]??null}let r={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},o={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`غلط ان پٹ: instanceof ${t.expected} متوقع تھا، ${l} موصول ہوا`;return`غلط ان پٹ: ${e} متوقع تھا، ${l} موصول ہوا`}case"invalid_value":if(t.values.length===1)return`غلط ان پٹ: ${N(t.values[0])} متوقع تھا`;return`غلط آپشن: ${A(t.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`بہت بڑا: ${t.origin??"ویلیو"} کے ${e}${t.maximum.toString()} ${u.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${t.origin??"ویلیو"} کا ${e}${t.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`بہت چھوٹا: ${t.origin} کے ${e}${t.minimum.toString()} ${u.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${t.origin} کا ${e}${t.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`غلط سٹرنگ: "${e.prefix}" سے شروع ہونا چاہیے`;if(e.format==="ends_with")return`غلط سٹرنگ: "${e.suffix}" پر ختم ہونا چاہیے`;if(e.format==="includes")return`غلط سٹرنگ: "${e.includes}" شامل ہونا چاہیے`;if(e.format==="regex")return`غلط سٹرنگ: پیٹرن ${e.pattern} سے میچ ہونا چاہیے`;return`غلط ${r[e.format]??t.format}`}case"not_multiple_of":return`غلط نمبر: ${t.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${t.keys.length>1?"ز":""}: ${A(t.keys,"، ")}`;case"invalid_key":return`${t.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${t.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function kb(){return{localeError:cj()}}var Uj=()=>{let n={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function i(t){return n[t]??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"},o={nan:"NaN",number:"raqam",array:"massiv"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${t.expected}, qabul qilingan ${l}`;return`Noto‘g‘ri kirish: kutilgan ${e}, qabul qilingan ${l}`}case"invalid_value":if(t.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${N(t.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Juda katta: kutilgan ${t.origin??"qiymat"} ${e}${t.maximum.toString()} ${u.unit} ${u.verb}`;return`Juda katta: kutilgan ${t.origin??"qiymat"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Juda kichik: kutilgan ${t.origin} ${e}${t.minimum.toString()} ${u.unit} ${u.verb}`;return`Juda kichik: kutilgan ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Noto‘g‘ri satr: "${e.prefix}" bilan boshlanishi kerak`;if(e.format==="ends_with")return`Noto‘g‘ri satr: "${e.suffix}" bilan tugashi kerak`;if(e.format==="includes")return`Noto‘g‘ri satr: "${e.includes}" ni o‘z ichiga olishi kerak`;if(e.format==="regex")return`Noto‘g‘ri satr: ${e.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${r[e.format]??t.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${t.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${t.keys.length>1?"lar":""}: ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${t.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function db(){return{localeError:Uj()}}var Dj=()=>{let n={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function i(t){return n[t]??null}let r={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},o={nan:"NaN",number:"số",array:"mảng"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${t.expected}, nhận được ${l}`;return`Đầu vào không hợp lệ: mong đợi ${e}, nhận được ${l}`}case"invalid_value":if(t.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${N(t.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Quá lớn: mong đợi ${t.origin??"giá trị"} ${u.verb} ${e}${t.maximum.toString()} ${u.unit??"phần tử"}`;return`Quá lớn: mong đợi ${t.origin??"giá trị"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Quá nhỏ: mong đợi ${t.origin} ${u.verb} ${e}${t.minimum.toString()} ${u.unit}`;return`Quá nhỏ: mong đợi ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${e.prefix}"`;if(e.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${e.suffix}"`;if(e.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${e.includes}"`;if(e.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${e.pattern}`;return`${r[e.format]??t.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${t.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(t.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${t.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${t.origin}`;default:return"Đầu vào không hợp lệ"}}};function Lb(){return{localeError:Dj()}}var Sj=()=>{let n={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function i(t){return n[t]??null}let r={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},o={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`无效输入:期望 instanceof ${t.expected},实际接收 ${l}`;return`无效输入:期望 ${e},实际接收 ${l}`}case"invalid_value":if(t.values.length===1)return`无效输入:期望 ${N(t.values[0])}`;return`无效选项:期望以下之一 ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`数值过大:期望 ${t.origin??"值"} ${e}${t.maximum.toString()} ${u.unit??"个元素"}`;return`数值过大:期望 ${t.origin??"值"} ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`数值过小:期望 ${t.origin} ${e}${t.minimum.toString()} ${u.unit}`;return`数值过小:期望 ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`无效字符串:必须以 "${e.prefix}" 开头`;if(e.format==="ends_with")return`无效字符串:必须以 "${e.suffix}" 结尾`;if(e.format==="includes")return`无效字符串:必须包含 "${e.includes}"`;if(e.format==="regex")return`无效字符串:必须满足正则表达式 ${e.pattern}`;return`无效${r[e.format]??t.format}`}case"not_multiple_of":return`无效数字:必须是 ${t.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(t.keys,", ")}`;case"invalid_key":return`${t.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${t.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Nb(){return{localeError:Sj()}}var Aj=()=>{let n={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function i(t){return n[t]??null}let r={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},o={nan:"NaN"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`無效的輸入值:預期為 instanceof ${t.expected},但收到 ${l}`;return`無效的輸入值:預期為 ${e},但收到 ${l}`}case"invalid_value":if(t.values.length===1)return`無效的輸入值:預期為 ${N(t.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`數值過大:預期 ${t.origin??"值"} 應為 ${e}${t.maximum.toString()} ${u.unit??"個元素"}`;return`數值過大:預期 ${t.origin??"值"} 應為 ${e}${t.maximum.toString()}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`數值過小:預期 ${t.origin} 應為 ${e}${t.minimum.toString()} ${u.unit}`;return`數值過小:預期 ${t.origin} 應為 ${e}${t.minimum.toString()}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`無效的字串:必須以 "${e.prefix}" 開頭`;if(e.format==="ends_with")return`無效的字串:必須以 "${e.suffix}" 結尾`;if(e.format==="includes")return`無效的字串:必須包含 "${e.includes}"`;if(e.format==="regex")return`無效的字串:必須符合格式 ${e.pattern}`;return`無效的 ${r[e.format]??t.format}`}case"not_multiple_of":return`無效的數字:必須為 ${t.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${t.keys.length>1?"們":""}:${A(t.keys,"、")}`;case"invalid_key":return`${t.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${t.origin} 中有無效的值`;default:return"無效的輸入值"}}};function yb(){return{localeError:Aj()}}var Oj=()=>{let n={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function i(t){return n[t]??null}let r={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},o={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(t)=>{switch(t.code){case"invalid_type":{let e=o[t.expected]??t.expected,u=y(t.input),l=o[u]??u;if(/^[A-Z]/.test(t.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${t.expected}, àmọ̀ a rí ${l}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${e}, àmọ̀ a rí ${l}`}case"invalid_value":if(t.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${N(t.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(t.values,"|")}`;case"too_big":{let e=t.inclusive?"<=":"<",u=i(t.origin);if(u)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${t.origin??"iye"} ${u.verb} ${e}${t.maximum} ${u.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${e}${t.maximum}`}case"too_small":{let e=t.inclusive?">=":">",u=i(t.origin);if(u)return`Kéré ju: a ní láti jẹ́ pé ${t.origin} ${u.verb} ${e}${t.minimum} ${u.unit}`;return`Kéré ju: a ní láti jẹ́ ${e}${t.minimum}`}case"invalid_format":{let e=t;if(e.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${e.prefix}"`;if(e.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${e.suffix}"`;if(e.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${e.includes}"`;if(e.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${e.pattern}`;return`Aṣìṣe: ${r[e.format]??t.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${t.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(t.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${t.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${t.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function Gb(){return{localeError:Oj()}}var F0,jb=Symbol("ZodOutput"),Wb=Symbol("ZodInput");class Jb{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...i){let r=i[0];if(this._map.set(n,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,n);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){let i=this._map.get(n);if(i&&typeof i==="object"&&"id"in i)this._idmap.delete(i.id);return this._map.delete(n),this}get(n){let i=n._zod.parent;if(i){let r={...this.get(i)??{}};delete r.id;let o={...r,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function cu(){return new Jb}(F0=globalThis).__zod_globalRegistry??(F0.__zod_globalRegistry=cu());var hn=globalThis.__zod_globalRegistry;function Hb(n,i){return new n({type:"string",...W(i)})}function Xb(n,i){return new n({type:"string",coerce:!0,...W(i)})}function Uu(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...W(i)})}function yo(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...W(i)})}function Du(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...W(i)})}function Su(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...W(i)})}function Au(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...W(i)})}function Ou(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...W(i)})}function Go(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...W(i)})}function ku(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...W(i)})}function du(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...W(i)})}function Lu(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...W(i)})}function Nu(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...W(i)})}function yu(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...W(i)})}function Gu(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...W(i)})}function ju(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...W(i)})}function Wu(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...W(i)})}function Ju(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...W(i)})}function hb(n,i){return new n({type:"string",format:"mac",check:"string_format",abort:!1,...W(i)})}function Hu(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...W(i)})}function Xu(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...W(i)})}function hu(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...W(i)})}function Pu(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...W(i)})}function Yu(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...W(i)})}function pu(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...W(i)})}var Pb={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Yb(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...W(i)})}function pb(n,i){return new n({type:"string",format:"date",check:"string_format",...W(i)})}function Qb(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...W(i)})}function Fb(n,i){return new n({type:"string",format:"duration",check:"string_format",...W(i)})}function Kb(n,i){return new n({type:"number",checks:[],...W(i)})}function Bb(n,i){return new n({type:"number",coerce:!0,checks:[],...W(i)})}function Vb(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...W(i)})}function Tb(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"float32",...W(i)})}function qb(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"float64",...W(i)})}function _b(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"int32",...W(i)})}function Eb(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"uint32",...W(i)})}function Zb(n,i){return new n({type:"boolean",...W(i)})}function mb(n,i){return new n({type:"boolean",coerce:!0,...W(i)})}function Mb(n,i){return new n({type:"bigint",...W(i)})}function zb(n,i){return new n({type:"bigint",coerce:!0,...W(i)})}function Cb(n,i){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...W(i)})}function Rb(n,i){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...W(i)})}function xb(n,i){return new n({type:"symbol",...W(i)})}function ab(n,i){return new n({type:"undefined",...W(i)})}function sb(n,i){return new n({type:"null",...W(i)})}function nw(n){return new n({type:"any"})}function iw(n){return new n({type:"unknown"})}function tw(n,i){return new n({type:"never",...W(i)})}function rw(n,i){return new n({type:"void",...W(i)})}function ow(n,i){return new n({type:"date",...W(i)})}function ew(n,i){return new n({type:"date",coerce:!0,...W(i)})}function uw(n,i){return new n({type:"nan",...W(i)})}function yi(n,i){return new ru({check:"less_than",...W(i),value:n,inclusive:!1})}function ei(n,i){return new ru({check:"less_than",...W(i),value:n,inclusive:!0})}function Gi(n,i){return new ou({check:"greater_than",...W(i),value:n,inclusive:!1})}function En(n,i){return new ou({check:"greater_than",...W(i),value:n,inclusive:!0})}function Qu(n){return Gi(0,n)}function Fu(n){return yi(0,n)}function Ku(n){return ei(0,n)}function Bu(n){return En(0,n)}function si(n,i){return new rI({check:"multiple_of",...W(i),value:n})}function nt(n,i){return new uI({check:"max_size",...W(i),maximum:n})}function ji(n,i){return new lI({check:"min_size",...W(i),minimum:n})}function jt(n,i){return new vI({check:"size_equals",...W(i),size:n})}function Wt(n,i){return new $I({check:"max_length",...W(i),maximum:n})}function Fi(n,i){return new II({check:"min_length",...W(i),minimum:n})}function Jt(n,i){return new gI({check:"length_equals",...W(i),length:n})}function tr(n,i){return new bI({check:"string_format",format:"regex",...W(i),pattern:n})}function rr(n){return new wI({check:"string_format",format:"lowercase",...W(n)})}function or(n){return new fI({check:"string_format",format:"uppercase",...W(n)})}function er(n,i){return new cI({check:"string_format",format:"includes",...W(i),includes:n})}function ur(n,i){return new UI({check:"string_format",format:"starts_with",...W(i),prefix:n})}function lr(n,i){return new DI({check:"string_format",format:"ends_with",...W(i),suffix:n})}function Vu(n,i,r){return new SI({check:"property",property:n,schema:i,...W(r)})}function vr(n,i){return new AI({check:"mime_type",mime:n,...W(i)})}function fi(n){return new OI({check:"overwrite",tx:n})}function $r(n){return fi((i)=>i.normalize(n))}function Ir(){return fi((n)=>n.trim())}function gr(){return fi((n)=>n.toLowerCase())}function br(){return fi((n)=>n.toUpperCase())}function wr(){return fi((n)=>S$(n))}function lw(n,i,r){return new n({type:"array",element:i,...W(r)})}function dj(n,i,r){return new n({type:"union",options:i,...W(r)})}function Lj(n,i,r){return new n({type:"union",options:i,inclusive:!1,...W(r)})}function Nj(n,i,r,o){return new n({type:"union",options:r,discriminator:i,...W(o)})}function yj(n,i,r){return new n({type:"intersection",left:i,right:r})}function Gj(n,i,r,o){let t=r instanceof B;return new n({type:"tuple",items:i,rest:t?r:null,...W(t?o:r)})}function jj(n,i,r,o){return new n({type:"record",keyType:i,valueType:r,...W(o)})}function Wj(n,i,r,o){return new n({type:"map",keyType:i,valueType:r,...W(o)})}function Jj(n,i,r){return new n({type:"set",valueType:i,...W(r)})}function Hj(n,i,r){let o=Array.isArray(i)?Object.fromEntries(i.map((t)=>[t,t])):i;return new n({type:"enum",entries:o,...W(r)})}function Xj(n,i,r){return new n({type:"enum",entries:i,...W(r)})}function hj(n,i,r){return new n({type:"literal",values:Array.isArray(i)?i:[i],...W(r)})}function vw(n,i){return new n({type:"file",...W(i)})}function Pj(n,i){return new n({type:"transform",transform:i})}function Yj(n,i){return new n({type:"optional",innerType:i})}function pj(n,i){return new n({type:"nullable",innerType:i})}function Qj(n,i,r){return new n({type:"default",innerType:i,get defaultValue(){return typeof r==="function"?r():O$(r)}})}function Fj(n,i,r){return new n({type:"nonoptional",innerType:i,...W(r)})}function Kj(n,i){return new n({type:"success",innerType:i})}function Bj(n,i,r){return new n({type:"catch",innerType:i,catchValue:typeof r==="function"?r:()=>r})}function Vj(n,i,r){return new n({type:"pipe",in:i,out:r})}function Tj(n,i){return new n({type:"readonly",innerType:i})}function qj(n,i,r){return new n({type:"template_literal",parts:i,...W(r)})}function _j(n,i){return new n({type:"lazy",getter:i})}function Ej(n,i){return new n({type:"promise",innerType:i})}function $w(n,i,r){let o=W(r);return o.abort??(o.abort=!0),new n({type:"custom",check:"custom",fn:i,...o})}function Iw(n,i,r){return new n({type:"custom",check:"custom",fn:i,...W(r)})}function gw(n,i){let r=K0((o)=>{return o.addIssue=(t)=>{if(typeof t==="string")o.issues.push(zt(t,o.value,r._zod.def));else{let e=t;if(e.fatal)e.continue=!1;e.code??(e.code="custom"),e.input??(e.input=o.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),o.issues.push(zt(e))}},n(o.value,o)},i);return r}function K0(n,i){let r=new wn({check:"custom",...W(i)});return r._zod.check=n,r}function bw(n){let i=new wn({check:"describe"});return i._zod.onattach=[(r)=>{let o=hn.get(r)??{};hn.add(r,{...o,description:n})}],i._zod.check=()=>{},i}function ww(n){let i=new wn({check:"meta"});return i._zod.onattach=[(r)=>{let o=hn.get(r)??{};hn.add(r,{...o,...n})}],i._zod.check=()=>{},i}function fw(n,i){let r=W(i),o=r.truthy??["true","1","yes","on","y","enabled"],t=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((f)=>typeof f==="string"?f.toLowerCase():f),t=t.map((f)=>typeof f==="string"?f.toLowerCase():f);let e=new Set(o),u=new Set(t),l=n.Codec??So,$=n.Boolean??Uo,g=new(n.String??Gt)({type:"string",error:r.error}),b=new $({type:"boolean",error:r.error}),w=new l({type:"pipe",in:g,out:b,transform:(f,c)=>{let S=f;if(r.case!=="sensitive")S=S.toLowerCase();if(e.has(S))return!0;else if(u.has(S))return!1;else return c.issues.push({code:"invalid_value",expected:"stringbool",values:[...e,...u],input:c.value,inst:w,continue:!1}),{}},reverseTransform:(f,c)=>{if(f===!0)return o[0]||"true";else return t[0]||"false"},error:r.error});return w}function fr(n,i,r,o={}){let t=W(o),e={...W(o),check:"string_format",type:"string",format:i,fn:typeof r==="function"?r:(l)=>r.test(l),...t};if(r instanceof RegExp)e.pattern=r;return new n(e)}function it(n){let i=n?.target??"draft-2020-12";if(i==="draft-4")i="draft-04";if(i==="draft-7")i="draft-07";return{processors:n.processors??{},metadataRegistry:n?.metadata??hn,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function un(n,i,r={path:[],schemaPath:[]}){var o;let t=n._zod.def,e=i.seen.get(n);if(e){if(e.count++,r.schemaPath.includes(n))e.cycle=r.path;return e.schema}let u={schema:{},count:1,cycle:void 0,path:r.path};i.seen.set(n,u);let l=n._zod.toJSONSchema?.();if(l)u.schema=l;else{let g={...r,schemaPath:[...r.schemaPath,n],path:r.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,u.schema,g);else{let w=u.schema,f=i.processors[t.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);f(n,i,w,g)}let b=n._zod.parent;if(b){if(!u.ref)u.ref=b;un(b,i,g),i.seen.get(b).isParent=!0}}let $=i.metadataRegistry.get(n);if($)Object.assign(u.schema,$);if(i.io==="input"&&Zn(n))delete u.schema.examples,delete u.schema.default;if(i.io==="input"&&"_prefault"in u.schema)(o=u.schema).default??(o.default=u.schema._prefault);return delete u.schema._prefault,i.seen.get(n).schema}function tt(n,i){let r=n.seen.get(i);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let u of n.seen.entries()){let l=n.metadataRegistry.get(u[0])?.id;if(l){let $=o.get(l);if($&&$!==u[0])throw Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(l,u[0])}}let t=(u)=>{let l=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let b=n.external.registry.get(u[0])?.id,w=n.external.uri??((c)=>c);if(b)return{ref:w(b)};let f=u[1].defId??u[1].schema.id??`schema${n.counter++}`;return u[1].defId=f,{defId:f,ref:`${w("__shared")}#/${l}/${f}`}}if(u[1]===r)return{ref:"#"};let I=`${"#"}/${l}/`,g=u[1].schema.id??`__schema${n.counter++}`;return{defId:g,ref:I+g}},e=(u)=>{if(u[1].schema.$ref)return;let l=u[1],{ref:$,defId:I}=t(u);if(l.def={...l.schema},I)l.defId=I;let g=l.schema;for(let b in g)delete g[b];g.$ref=$};if(n.cycles==="throw")for(let u of n.seen.entries()){let l=u[1];if(l.cycle)throw Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
||
|
||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of n.seen.entries()){let l=u[1];if(i===u[0]){e(u);continue}if(n.external){let I=n.external.registry.get(u[0])?.id;if(i!==u[0]&&I){e(u);continue}}if(n.metadataRegistry.get(u[0])?.id){e(u);continue}if(l.cycle){e(u);continue}if(l.count>1){if(n.reused==="ref"){e(u);continue}}}}function rt(n,i){let r=n.seen.get(i);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(l)=>{let $=n.seen.get(l);if($.ref===null)return;let I=$.def??$.schema,g={...I},b=$.ref;if($.ref=null,b){o(b);let f=n.seen.get(b),c=f.schema;if(c.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"))I.allOf=I.allOf??[],I.allOf.push(c);else Object.assign(I,c);if(Object.assign(I,g),l._zod.parent===b)for(let k in I){if(k==="$ref"||k==="allOf")continue;if(!(k in g))delete I[k]}if(c.$ref&&f.def)for(let k in I){if(k==="$ref"||k==="allOf")continue;if(k in f.def&&JSON.stringify(I[k])===JSON.stringify(f.def[k]))delete I[k]}}let w=l._zod.parent;if(w&&w!==b){o(w);let f=n.seen.get(w);if(f?.schema.$ref){if(I.$ref=f.schema.$ref,f.def)for(let c in I){if(c==="$ref"||c==="allOf")continue;if(c in f.def&&JSON.stringify(I[c])===JSON.stringify(f.def[c]))delete I[c]}}}n.override({zodSchema:l,jsonSchema:I,path:$.path??[]})};for(let l of[...n.seen.entries()].reverse())o(l[0]);let t={};if(n.target==="draft-2020-12")t.$schema="https://json-schema.org/draft/2020-12/schema";else if(n.target==="draft-07")t.$schema="http://json-schema.org/draft-07/schema#";else if(n.target==="draft-04")t.$schema="http://json-schema.org/draft-04/schema#";else if(n.target==="openapi-3.0");if(n.external?.uri){let l=n.external.registry.get(i)?.id;if(!l)throw Error("Schema is missing an `id` property");t.$id=n.external.uri(l)}Object.assign(t,r.def??r.schema);let e=n.metadataRegistry.get(i)?.id;if(e!==void 0&&t.id===e)delete t.id;let u=n.external?.defs??{};for(let l of n.seen.entries()){let $=l[1];if($.def&&$.defId){if($.def.id===$.defId)delete $.def.id;u[$.defId]=$.def}}if(n.external);else if(Object.keys(u).length>0)if(n.target==="draft-2020-12")t.$defs=u;else t.definitions=u;try{let l=JSON.parse(JSON.stringify(t));return Object.defineProperty(l,"~standard",{value:{...i["~standard"],jsonSchema:{input:cr(i,"input",n.processors),output:cr(i,"output",n.processors)}},enumerable:!1,writable:!1}),l}catch(l){throw Error("Error converting schema to JSON.")}}function Zn(n,i){let r=i??{seen:new Set};if(r.seen.has(n))return!1;r.seen.add(n);let o=n._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Zn(o.element,r);if(o.type==="set")return Zn(o.valueType,r);if(o.type==="lazy")return Zn(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Zn(o.innerType,r);if(o.type==="intersection")return Zn(o.left,r)||Zn(o.right,r);if(o.type==="record"||o.type==="map")return Zn(o.keyType,r)||Zn(o.valueType,r);if(o.type==="pipe"){if(n._zod.traits.has("$ZodCodec"))return!0;return Zn(o.in,r)||Zn(o.out,r)}if(o.type==="object"){for(let t in o.shape)if(Zn(o.shape[t],r))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(Zn(t,r))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(Zn(t,r))return!0;if(o.rest&&Zn(o.rest,r))return!0;return!1}return!1}var cw=(n,i={})=>(r)=>{let o=it({...r,processors:i});return un(n,o),tt(o,n),rt(o,n)},cr=(n,i,r={})=>(o)=>{let{libraryOptions:t,target:e}=o??{},u=it({...t??{},target:e,io:i,processors:r});return un(n,u),tt(u,n),rt(u,n)};var Zj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Uw=(n,i,r,o)=>{let t=r;t.type="string";let{minimum:e,maximum:u,format:l,patterns:$,contentEncoding:I}=n._zod.bag;if(typeof e==="number")t.minLength=e;if(typeof u==="number")t.maxLength=u;if(l){if(t.format=Zj[l]??l,t.format==="")delete t.format;if(l==="time")delete t.format}if(I)t.contentEncoding=I;if($&&$.size>0){let g=[...$];if(g.length===1)t.pattern=g[0].source;else if(g.length>1)t.allOf=[...g.map((b)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))]}},Dw=(n,i,r,o)=>{let t=r,{minimum:e,maximum:u,format:l,multipleOf:$,exclusiveMaximum:I,exclusiveMinimum:g}=n._zod.bag;if(typeof l==="string"&&l.includes("int"))t.type="integer";else t.type="number";let b=typeof g==="number"&&g>=(e??Number.NEGATIVE_INFINITY),w=typeof I==="number"&&I<=(u??Number.POSITIVE_INFINITY),f=i.target==="draft-04"||i.target==="openapi-3.0";if(b)if(f)t.minimum=g,t.exclusiveMinimum=!0;else t.exclusiveMinimum=g;else if(typeof e==="number")t.minimum=e;if(w)if(f)t.maximum=I,t.exclusiveMaximum=!0;else t.exclusiveMaximum=I;else if(typeof u==="number")t.maximum=u;if(typeof $==="number")t.multipleOf=$},Sw=(n,i,r,o)=>{r.type="boolean"},Aw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Ow=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},kw=(n,i,r,o)=>{if(i.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},dw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Lw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Nw=(n,i,r,o)=>{r.not={}},yw=(n,i,r,o)=>{},Gw=(n,i,r,o)=>{},jw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Ww=(n,i,r,o)=>{let t=n._zod.def,e=to(t.entries);if(e.every((u)=>typeof u==="number"))r.type="number";if(e.every((u)=>typeof u==="string"))r.type="string";r.enum=e},Jw=(n,i,r,o)=>{let t=n._zod.def,e=[];for(let u of t.values)if(u===void 0){if(i.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u==="bigint")if(i.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else e.push(Number(u));else e.push(u);if(e.length===0);else if(e.length===1){let u=e[0];if(r.type=u===null?"null":typeof u,i.target==="draft-04"||i.target==="openapi-3.0")r.enum=[u];else r.const=u}else{if(e.every((u)=>typeof u==="number"))r.type="number";if(e.every((u)=>typeof u==="string"))r.type="string";if(e.every((u)=>typeof u==="boolean"))r.type="boolean";if(e.every((u)=>u===null))r.type="null";r.enum=e}},Hw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Xw=(n,i,r,o)=>{let t=r,e=n._zod.pattern;if(!e)throw Error("Pattern not found in template literal");t.type="string",t.pattern=e.source},hw=(n,i,r,o)=>{let t=r,e={type:"string",format:"binary",contentEncoding:"binary"},{minimum:u,maximum:l,mime:$}=n._zod.bag;if(u!==void 0)e.minLength=u;if(l!==void 0)e.maxLength=l;if($)if($.length===1)e.contentMediaType=$[0],Object.assign(t,e);else Object.assign(t,e),t.anyOf=$.map((I)=>({contentMediaType:I}));else Object.assign(t,e)},Pw=(n,i,r,o)=>{r.type="boolean"},Yw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},pw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Qw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Fw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Kw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Bw=(n,i,r,o)=>{let t=r,e=n._zod.def,{minimum:u,maximum:l}=n._zod.bag;if(typeof u==="number")t.minItems=u;if(typeof l==="number")t.maxItems=l;t.type="array",t.items=un(e.element,i,{...o,path:[...o.path,"items"]})},Vw=(n,i,r,o)=>{let t=r,e=n._zod.def;t.type="object",t.properties={};let u=e.shape;for(let I in u)t.properties[I]=un(u[I],i,{...o,path:[...o.path,"properties",I]});let l=new Set(Object.keys(u)),$=new Set([...l].filter((I)=>{let g=e.shape[I]._zod;if(i.io==="input")return g.optin===void 0;else return g.optout===void 0}));if($.size>0)t.required=Array.from($);if(e.catchall?._zod.def.type==="never")t.additionalProperties=!1;else if(!e.catchall){if(i.io==="output")t.additionalProperties=!1}else if(e.catchall)t.additionalProperties=un(e.catchall,i,{...o,path:[...o.path,"additionalProperties"]})},qu=(n,i,r,o)=>{let t=n._zod.def,e=t.inclusive===!1,u=t.options.map((l,$)=>un(l,i,{...o,path:[...o.path,e?"oneOf":"anyOf",$]}));if(e)r.oneOf=u;else r.anyOf=u},Tw=(n,i,r,o)=>{let t=n._zod.def,e=un(t.left,i,{...o,path:[...o.path,"allOf",0]}),u=un(t.right,i,{...o,path:[...o.path,"allOf",1]}),l=(I)=>("allOf"in I)&&Object.keys(I).length===1,$=[...l(e)?e.allOf:[e],...l(u)?u.allOf:[u]];r.allOf=$},qw=(n,i,r,o)=>{let t=r,e=n._zod.def;t.type="array";let u=i.target==="draft-2020-12"?"prefixItems":"items",l=i.target==="draft-2020-12"?"items":i.target==="openapi-3.0"?"items":"additionalItems",$=e.items.map((w,f)=>un(w,i,{...o,path:[...o.path,u,f]})),I=e.rest?un(e.rest,i,{...o,path:[...o.path,l,...i.target==="openapi-3.0"?[e.items.length]:[]]}):null;if(i.target==="draft-2020-12"){if(t.prefixItems=$,I)t.items=I}else if(i.target==="openapi-3.0"){if(t.items={anyOf:$},I)t.items.anyOf.push(I);if(t.minItems=$.length,!I)t.maxItems=$.length}else if(t.items=$,I)t.additionalItems=I;let{minimum:g,maximum:b}=n._zod.bag;if(typeof g==="number")t.minItems=g;if(typeof b==="number")t.maxItems=b},_w=(n,i,r,o)=>{let t=r,e=n._zod.def;t.type="object";let u=e.keyType,$=u._zod.bag?.patterns;if(e.mode==="loose"&&$&&$.size>0){let g=un(e.valueType,i,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let b of $)t.patternProperties[b.source]=g}else{if(i.target==="draft-07"||i.target==="draft-2020-12")t.propertyNames=un(e.keyType,i,{...o,path:[...o.path,"propertyNames"]});t.additionalProperties=un(e.valueType,i,{...o,path:[...o.path,"additionalProperties"]})}let I=u._zod.values;if(I){let g=[...I].filter((b)=>typeof b==="string"||typeof b==="number");if(g.length>0)t.required=g}},Ew=(n,i,r,o)=>{let t=n._zod.def,e=un(t.innerType,i,o),u=i.seen.get(n);if(i.target==="openapi-3.0")u.ref=t.innerType,r.nullable=!0;else r.anyOf=[e,{type:"null"}]},Zw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType},mw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType,r.default=JSON.parse(JSON.stringify(t.defaultValue))},Mw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);if(e.ref=t.innerType,i.io==="input")r._prefault=JSON.parse(JSON.stringify(t.defaultValue))},zw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType;let u;try{u=t.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},Cw=(n,i,r,o)=>{let t=n._zod.def,e=t.in._zod.traits.has("$ZodTransform"),u=i.io==="input"?e?t.out:t.in:t.out;un(u,i,o);let l=i.seen.get(n);l.ref=u},Rw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType,r.readOnly=!0},xw=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType},_u=(n,i,r,o)=>{let t=n._zod.def;un(t.innerType,i,o);let e=i.seen.get(n);e.ref=t.innerType},aw=(n,i,r,o)=>{let t=n._zod.innerType;un(t,i,o);let e=i.seen.get(n);e.ref=t},Tu={string:Uw,number:Dw,boolean:Sw,bigint:Aw,symbol:Ow,null:kw,undefined:dw,void:Lw,never:Nw,any:yw,unknown:Gw,date:jw,enum:Ww,literal:Jw,nan:Hw,template_literal:Xw,file:hw,success:Pw,custom:Yw,function:pw,transform:Qw,map:Fw,set:Kw,array:Bw,object:Vw,union:qu,intersection:Tw,tuple:qw,record:_w,nullable:Ew,nonoptional:Zw,default:mw,prefault:Mw,catch:zw,pipe:Cw,readonly:Rw,promise:xw,optional:_u,lazy:aw};function Eu(n,i){if("_idmap"in n){let o=n,t=it({...i,processors:Tu}),e={};for(let $ of o._idmap.entries()){let[I,g]=$;un(g,t)}let u={},l={registry:o,uri:i?.uri,defs:e};t.external=l;for(let $ of o._idmap.entries()){let[I,g]=$;tt(t,g),u[I]=rt(t,g)}if(Object.keys(e).length>0){let $=t.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[$]:e}}return{schemas:u}}let r=it({...i,processors:Tu});return un(n,r),tt(r,n),rt(r,n)}class sw{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(n){this.ctx.counter=n}get seen(){return this.ctx.seen}constructor(n){let i=n?.target??"draft-2020-12";if(i==="draft-4")i="draft-04";if(i==="draft-7")i="draft-07";this.ctx=it({processors:Tu,target:i,...n?.metadata&&{metadata:n.metadata},...n?.unrepresentable&&{unrepresentable:n.unrepresentable},...n?.override&&{override:n.override},...n?.io&&{io:n.io}})}process(n,i={path:[],schemaPath:[]}){return un(n,this.ctx,i)}emit(n,i){if(i){if(i.cycles)this.ctx.cycles=i.cycles;if(i.reused)this.ctx.reused=i.reused;if(i.external)this.ctx.external=i.external}tt(this.ctx,n);let r=rt(this.ctx,n),{"~standard":o,...t}=r;return t}}var B0={};function Ur(n){return!!n._zod}function ot(n,i){if(Ur(n))return at(n,i);return n.safeParse(i)}function Zu(n){if(!n)return;let i;if(Ur(n))i=n._zod?.def?.shape;else i=n.shape;if(!i)return;if(typeof i==="function")try{return i()}catch{return}return i}function V0(n){if(Ur(n)){let e=n._zod?.def;if(e){if(e.value!==void 0)return e.value;if(Array.isArray(e.values)&&e.values.length>0)return e.values[0]}}let r=n._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=n.value;if(o!==void 0)return o;return}var v={};pi(v,{xor:()=>XU,xid:()=>tU,void:()=>jU,uuidv7:()=>z0,uuidv6:()=>M0,uuidv4:()=>m0,uuid:()=>Z0,util:()=>G,url:()=>C0,uppercase:()=>or,unknown:()=>gn,union:()=>bn,undefined:()=>yU,ulid:()=>iU,uint64:()=>LU,uint32:()=>OU,tuple:()=>Hf,trim:()=>Ir,treeifyError:()=>G$,transform:()=>Sl,toUpperCase:()=>br,toLowerCase:()=>gr,toJSONSchema:()=>Eu,templateLiteral:()=>_U,symbol:()=>NU,superRefine:()=>rc,success:()=>BU,stringbool:()=>RU,stringFormat:()=>wU,string:()=>O,strictObject:()=>HU,startsWith:()=>ur,slugify:()=>wr,size:()=>jt,setErrorMap:()=>Rj,set:()=>pU,safeParseAsync:()=>vf,safeParse:()=>lf,safeEncodeAsync:()=>cf,safeEncode:()=>wf,safeDecodeAsync:()=>Uf,safeDecode:()=>ff,registry:()=>cu,regexes:()=>oi,regex:()=>tr,refine:()=>tc,record:()=>vn,readonly:()=>Rf,property:()=>Vu,promise:()=>EU,prettifyError:()=>j$,preprocess:()=>Vo,prefault:()=>qf,positive:()=>Qu,pipe:()=>au,partialRecord:()=>hU,parseAsync:()=>uf,parse:()=>ef,overwrite:()=>fi,optional:()=>fn,object:()=>Y,number:()=>rn,nullish:()=>KU,nullable:()=>Jo,null:()=>ho,normalize:()=>$r,nonpositive:()=>Ku,nonoptional:()=>_f,nonnegative:()=>Bu,never:()=>Dl,negative:()=>Fu,nativeEnum:()=>QU,nanoid:()=>a0,nan:()=>VU,multipleOf:()=>si,minSize:()=>ji,minLength:()=>Fi,mime:()=>vr,meta:()=>zU,maxSize:()=>nt,maxLength:()=>Wt,map:()=>YU,mac:()=>eU,lte:()=>ei,lt:()=>yi,lowercase:()=>rr,looseRecord:()=>PU,looseObject:()=>Pn,locales:()=>No,literal:()=>Q,length:()=>Jt,lazy:()=>sf,ksuid:()=>rU,keyof:()=>JU,jwt:()=>bU,json:()=>xU,iso:()=>et,ipv6:()=>uU,ipv4:()=>oU,invertCodec:()=>qU,intersection:()=>Nr,int64:()=>dU,int32:()=>AU,int:()=>xu,instanceof:()=>CU,includes:()=>er,httpUrl:()=>R0,hostname:()=>fU,hex:()=>cU,hash:()=>UU,guid:()=>E0,gte:()=>En,gt:()=>Gi,globalRegistry:()=>hn,getErrorMap:()=>xj,function:()=>ZU,fromJSONSchema:()=>sU,formatError:()=>$o,float64:()=>SU,float32:()=>DU,flattenError:()=>vo,file:()=>FU,exactOptional:()=>Ff,enum:()=>Yn,endsWith:()=>lr,encodeAsync:()=>gf,encode:()=>$f,emoji:()=>x0,email:()=>_0,e164:()=>gU,discriminatedUnion:()=>Qo,describe:()=>MU,decodeAsync:()=>bf,decode:()=>If,date:()=>WU,custom:()=>kl,cuid2:()=>nU,cuid:()=>s0,core:()=>Ki,config:()=>kn,coerce:()=>ec,codec:()=>TU,clone:()=>qn,cidrv6:()=>vU,cidrv4:()=>lU,check:()=>mU,catch:()=>mf,boolean:()=>dn,bigint:()=>kU,base64url:()=>IU,base64:()=>$U,array:()=>C,any:()=>GU,_function:()=>ZU,_default:()=>Vf,_ZodString:()=>su,ZodXor:()=>Gf,ZodXID:()=>ul,ZodVoid:()=>Nf,ZodUnknown:()=>df,ZodUnion:()=>po,ZodUndefined:()=>Af,ZodUUID:()=>Wi,ZodURL:()=>Xo,ZodULID:()=>el,ZodType:()=>E,ZodTuple:()=>Jf,ZodTransform:()=>pf,ZodTemplateLiteral:()=>xf,ZodSymbol:()=>Sf,ZodSuccess:()=>Ef,ZodStringFormat:()=>In,ZodString:()=>Ar,ZodSet:()=>hf,ZodRecord:()=>Dr,ZodRealError:()=>xn,ZodReadonly:()=>Cf,ZodPromise:()=>nc,ZodPreprocess:()=>zf,ZodPrefault:()=>Tf,ZodPipe:()=>Fo,ZodOptional:()=>Al,ZodObject:()=>Yo,ZodNumberFormat:()=>Ht,ZodNumber:()=>kr,ZodNullable:()=>Kf,ZodNull:()=>Of,ZodNonOptional:()=>Ol,ZodNever:()=>Lf,ZodNanoID:()=>tl,ZodNaN:()=>Mf,ZodMap:()=>Xf,ZodMAC:()=>Df,ZodLiteral:()=>Pf,ZodLazy:()=>af,ZodKSUID:()=>ll,ZodJWT:()=>cl,ZodIssueCode:()=>Cj,ZodIntersection:()=>Wf,ZodISOTime:()=>Cu,ZodISODuration:()=>Ru,ZodISODateTime:()=>Mu,ZodISODate:()=>zu,ZodIPv6:()=>$l,ZodIPv4:()=>vl,ZodGUID:()=>Wo,ZodFunction:()=>ic,ZodFirstPartyTypeKind:()=>oc,ZodFile:()=>Yf,ZodExactOptional:()=>Qf,ZodError:()=>Mj,ZodEnum:()=>Sr,ZodEmoji:()=>il,ZodEmail:()=>nl,ZodE164:()=>fl,ZodDiscriminatedUnion:()=>jf,ZodDefault:()=>Bf,ZodDate:()=>Po,ZodCustomStringFormat:()=>Or,ZodCustom:()=>Bo,ZodCodec:()=>Ko,ZodCatch:()=>Zf,ZodCUID2:()=>ol,ZodCUID:()=>rl,ZodCIDRv6:()=>gl,ZodCIDRv4:()=>Il,ZodBoolean:()=>dr,ZodBigIntFormat:()=>Ul,ZodBigInt:()=>Lr,ZodBase64URL:()=>wl,ZodBase64:()=>bl,ZodArray:()=>yf,ZodAny:()=>kf,TimePrecision:()=>Pb,NEVER:()=>f$,$output:()=>jb,$input:()=>Wb,$brand:()=>c$});var jo={};pi(jo,{xor:()=>XU,xid:()=>tU,void:()=>jU,uuidv7:()=>z0,uuidv6:()=>M0,uuidv4:()=>m0,uuid:()=>Z0,url:()=>C0,unknown:()=>gn,union:()=>bn,undefined:()=>yU,ulid:()=>iU,uint64:()=>LU,uint32:()=>OU,tuple:()=>Hf,transform:()=>Sl,templateLiteral:()=>_U,symbol:()=>NU,superRefine:()=>rc,success:()=>BU,stringbool:()=>RU,stringFormat:()=>wU,string:()=>O,strictObject:()=>HU,set:()=>pU,refine:()=>tc,record:()=>vn,readonly:()=>Rf,promise:()=>EU,preprocess:()=>Vo,prefault:()=>qf,pipe:()=>au,partialRecord:()=>hU,optional:()=>fn,object:()=>Y,number:()=>rn,nullish:()=>KU,nullable:()=>Jo,null:()=>ho,nonoptional:()=>_f,never:()=>Dl,nativeEnum:()=>QU,nanoid:()=>a0,nan:()=>VU,meta:()=>zU,map:()=>YU,mac:()=>eU,looseRecord:()=>PU,looseObject:()=>Pn,literal:()=>Q,lazy:()=>sf,ksuid:()=>rU,keyof:()=>JU,jwt:()=>bU,json:()=>xU,ipv6:()=>uU,ipv4:()=>oU,invertCodec:()=>qU,intersection:()=>Nr,int64:()=>dU,int32:()=>AU,int:()=>xu,instanceof:()=>CU,httpUrl:()=>R0,hostname:()=>fU,hex:()=>cU,hash:()=>UU,guid:()=>E0,function:()=>ZU,float64:()=>SU,float32:()=>DU,file:()=>FU,exactOptional:()=>Ff,enum:()=>Yn,emoji:()=>x0,email:()=>_0,e164:()=>gU,discriminatedUnion:()=>Qo,describe:()=>MU,date:()=>WU,custom:()=>kl,cuid2:()=>nU,cuid:()=>s0,codec:()=>TU,cidrv6:()=>vU,cidrv4:()=>lU,check:()=>mU,catch:()=>mf,boolean:()=>dn,bigint:()=>kU,base64url:()=>IU,base64:()=>$U,array:()=>C,any:()=>GU,_function:()=>ZU,_default:()=>Vf,_ZodString:()=>su,ZodXor:()=>Gf,ZodXID:()=>ul,ZodVoid:()=>Nf,ZodUnknown:()=>df,ZodUnion:()=>po,ZodUndefined:()=>Af,ZodUUID:()=>Wi,ZodURL:()=>Xo,ZodULID:()=>el,ZodType:()=>E,ZodTuple:()=>Jf,ZodTransform:()=>pf,ZodTemplateLiteral:()=>xf,ZodSymbol:()=>Sf,ZodSuccess:()=>Ef,ZodStringFormat:()=>In,ZodString:()=>Ar,ZodSet:()=>hf,ZodRecord:()=>Dr,ZodReadonly:()=>Cf,ZodPromise:()=>nc,ZodPreprocess:()=>zf,ZodPrefault:()=>Tf,ZodPipe:()=>Fo,ZodOptional:()=>Al,ZodObject:()=>Yo,ZodNumberFormat:()=>Ht,ZodNumber:()=>kr,ZodNullable:()=>Kf,ZodNull:()=>Of,ZodNonOptional:()=>Ol,ZodNever:()=>Lf,ZodNanoID:()=>tl,ZodNaN:()=>Mf,ZodMap:()=>Xf,ZodMAC:()=>Df,ZodLiteral:()=>Pf,ZodLazy:()=>af,ZodKSUID:()=>ll,ZodJWT:()=>cl,ZodIntersection:()=>Wf,ZodIPv6:()=>$l,ZodIPv4:()=>vl,ZodGUID:()=>Wo,ZodFunction:()=>ic,ZodFile:()=>Yf,ZodExactOptional:()=>Qf,ZodEnum:()=>Sr,ZodEmoji:()=>il,ZodEmail:()=>nl,ZodE164:()=>fl,ZodDiscriminatedUnion:()=>jf,ZodDefault:()=>Bf,ZodDate:()=>Po,ZodCustomStringFormat:()=>Or,ZodCustom:()=>Bo,ZodCodec:()=>Ko,ZodCatch:()=>Zf,ZodCUID2:()=>ol,ZodCUID:()=>rl,ZodCIDRv6:()=>gl,ZodCIDRv4:()=>Il,ZodBoolean:()=>dr,ZodBigIntFormat:()=>Ul,ZodBigInt:()=>Lr,ZodBase64URL:()=>wl,ZodBase64:()=>bl,ZodArray:()=>yf,ZodAny:()=>kf});var mu={};pi(mu,{uppercase:()=>or,trim:()=>Ir,toUpperCase:()=>br,toLowerCase:()=>gr,startsWith:()=>ur,slugify:()=>wr,size:()=>jt,regex:()=>tr,property:()=>Vu,positive:()=>Qu,overwrite:()=>fi,normalize:()=>$r,nonpositive:()=>Ku,nonnegative:()=>Bu,negative:()=>Fu,multipleOf:()=>si,minSize:()=>ji,minLength:()=>Fi,mime:()=>vr,maxSize:()=>nt,maxLength:()=>Wt,lte:()=>ei,lt:()=>yi,lowercase:()=>rr,length:()=>Jt,includes:()=>er,gte:()=>En,gt:()=>Gi,endsWith:()=>lr});var et={};pi(et,{time:()=>rf,duration:()=>of,datetime:()=>nf,date:()=>tf,ZodISOTime:()=>Cu,ZodISODuration:()=>Ru,ZodISODateTime:()=>Mu,ZodISODate:()=>zu});var Mu=U("ZodISODateTime",(n,i)=>{YI.init(n,i),In.init(n,i)});function nf(n){return Yb(Mu,n)}var zu=U("ZodISODate",(n,i)=>{pI.init(n,i),In.init(n,i)});function tf(n){return pb(zu,n)}var Cu=U("ZodISOTime",(n,i)=>{QI.init(n,i),In.init(n,i)});function rf(n){return Qb(Cu,n)}var Ru=U("ZodISODuration",(n,i)=>{FI.init(n,i),In.init(n,i)});function of(n){return Fb(Ru,n)}var T0=(n,i)=>{lo.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:(r)=>$o(n,r)},flatten:{value:(r)=>vo(n,r)},addIssue:{value:(r)=>{n.issues.push(r),n.message=JSON.stringify(n.issues,mt,2)}},addIssues:{value:(r)=>{n.issues.push(...r),n.message=JSON.stringify(n.issues,mt,2)}},isEmpty:{get(){return n.issues.length===0}}})},Mj=U("ZodError",T0),xn=U("ZodError",T0,{Parent:Error});var ef=Ct(xn),uf=Rt(xn),lf=xt(xn),vf=st(xn),$f=ze(xn),If=Ce(xn),gf=Re(xn),bf=xe(xn),wf=ae(xn),ff=se(xn),cf=nu(xn),Uf=iu(xn);var q0=new WeakMap;function Ho(n,i,r){let o=Object.getPrototypeOf(n),t=q0.get(o);if(!t)t=new Set,q0.set(o,t);if(t.has(i))return;t.add(i);for(let e in r){let u=r[e];Object.defineProperty(o,e,{configurable:!0,enumerable:!1,get(){let l=u.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}var E=U("ZodType",(n,i)=>{return B.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:cr(n,"input"),output:cr(n,"output")}}),n.toJSONSchema=cw(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.parse=(r,o)=>ef(n,r,o,{callee:n.parse}),n.safeParse=(r,o)=>lf(n,r,o),n.parseAsync=async(r,o)=>uf(n,r,o,{callee:n.parseAsync}),n.safeParseAsync=async(r,o)=>vf(n,r,o),n.spa=n.safeParseAsync,n.encode=(r,o)=>$f(n,r,o),n.decode=(r,o)=>If(n,r,o),n.encodeAsync=async(r,o)=>gf(n,r,o),n.decodeAsync=async(r,o)=>bf(n,r,o),n.safeEncode=(r,o)=>wf(n,r,o),n.safeDecode=(r,o)=>ff(n,r,o),n.safeEncodeAsync=async(r,o)=>cf(n,r,o),n.safeDecodeAsync=async(r,o)=>Uf(n,r,o),Ho(n,"ZodType",{check(...r){let o=this.def;return this.clone(G.mergeDefs(o,{checks:[...o.checks??[],...r.map((t)=>typeof t==="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return qn(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(tc(r,o))},superRefine(r,o){return this.check(rc(r,o))},overwrite(r){return this.check(fi(r))},optional(){return fn(this)},exactOptional(){return Ff(this)},nullable(){return Jo(this)},nullish(){return fn(Jo(this))},nonoptional(r){return _f(this,r)},array(){return C(this)},or(r){return bn([this,r])},and(r){return Nr(this,r)},transform(r){return au(this,Sl(r))},default(r){return Vf(this,r)},prefault(r){return qf(this,r)},catch(r){return mf(this,r)},pipe(r){return au(this,r)},readonly(){return Rf(this)},describe(r){let o=this.clone();return hn.add(o,{description:r}),o},meta(...r){if(r.length===0)return hn.get(this);let o=this.clone();return hn.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(n,"description",{get(){return hn.get(n)?.description},configurable:!0}),n}),su=U("_ZodString",(n,i)=>{Gt.init(n,i),E.init(n,i),n._zod.processJSONSchema=(o,t,e)=>Uw(n,o,t,e);let r=n._zod.bag;n.format=r.format??null,n.minLength=r.minimum??null,n.maxLength=r.maximum??null,Ho(n,"_ZodString",{regex(...o){return this.check(tr(...o))},includes(...o){return this.check(er(...o))},startsWith(...o){return this.check(ur(...o))},endsWith(...o){return this.check(lr(...o))},min(...o){return this.check(Fi(...o))},max(...o){return this.check(Wt(...o))},length(...o){return this.check(Jt(...o))},nonempty(...o){return this.check(Fi(1,...o))},lowercase(o){return this.check(rr(o))},uppercase(o){return this.check(or(o))},trim(){return this.check(Ir())},normalize(...o){return this.check($r(...o))},toLowerCase(){return this.check(gr())},toUpperCase(){return this.check(br())},slugify(){return this.check(wr())}})}),Ar=U("ZodString",(n,i)=>{Gt.init(n,i),su.init(n,i),n.email=(r)=>n.check(Uu(nl,r)),n.url=(r)=>n.check(Go(Xo,r)),n.jwt=(r)=>n.check(pu(cl,r)),n.emoji=(r)=>n.check(ku(il,r)),n.guid=(r)=>n.check(yo(Wo,r)),n.uuid=(r)=>n.check(Du(Wi,r)),n.uuidv4=(r)=>n.check(Su(Wi,r)),n.uuidv6=(r)=>n.check(Au(Wi,r)),n.uuidv7=(r)=>n.check(Ou(Wi,r)),n.nanoid=(r)=>n.check(du(tl,r)),n.guid=(r)=>n.check(yo(Wo,r)),n.cuid=(r)=>n.check(Lu(rl,r)),n.cuid2=(r)=>n.check(Nu(ol,r)),n.ulid=(r)=>n.check(yu(el,r)),n.base64=(r)=>n.check(hu(bl,r)),n.base64url=(r)=>n.check(Pu(wl,r)),n.xid=(r)=>n.check(Gu(ul,r)),n.ksuid=(r)=>n.check(ju(ll,r)),n.ipv4=(r)=>n.check(Wu(vl,r)),n.ipv6=(r)=>n.check(Ju($l,r)),n.cidrv4=(r)=>n.check(Hu(Il,r)),n.cidrv6=(r)=>n.check(Xu(gl,r)),n.e164=(r)=>n.check(Yu(fl,r)),n.datetime=(r)=>n.check(nf(r)),n.date=(r)=>n.check(tf(r)),n.time=(r)=>n.check(rf(r)),n.duration=(r)=>n.check(of(r))});function O(n){return Hb(Ar,n)}var In=U("ZodStringFormat",(n,i)=>{$n.init(n,i),su.init(n,i)}),nl=U("ZodEmail",(n,i)=>{yI.init(n,i),In.init(n,i)});function _0(n){return Uu(nl,n)}var Wo=U("ZodGUID",(n,i)=>{LI.init(n,i),In.init(n,i)});function E0(n){return yo(Wo,n)}var Wi=U("ZodUUID",(n,i)=>{NI.init(n,i),In.init(n,i)});function Z0(n){return Du(Wi,n)}function m0(n){return Su(Wi,n)}function M0(n){return Au(Wi,n)}function z0(n){return Ou(Wi,n)}var Xo=U("ZodURL",(n,i)=>{GI.init(n,i),In.init(n,i)});function C0(n){return Go(Xo,n)}function R0(n){return Go(Xo,{protocol:oi.httpProtocol,hostname:oi.domain,...G.normalizeParams(n)})}var il=U("ZodEmoji",(n,i)=>{jI.init(n,i),In.init(n,i)});function x0(n){return ku(il,n)}var tl=U("ZodNanoID",(n,i)=>{WI.init(n,i),In.init(n,i)});function a0(n){return du(tl,n)}var rl=U("ZodCUID",(n,i)=>{JI.init(n,i),In.init(n,i)});function s0(n){return Lu(rl,n)}var ol=U("ZodCUID2",(n,i)=>{HI.init(n,i),In.init(n,i)});function nU(n){return Nu(ol,n)}var el=U("ZodULID",(n,i)=>{XI.init(n,i),In.init(n,i)});function iU(n){return yu(el,n)}var ul=U("ZodXID",(n,i)=>{hI.init(n,i),In.init(n,i)});function tU(n){return Gu(ul,n)}var ll=U("ZodKSUID",(n,i)=>{PI.init(n,i),In.init(n,i)});function rU(n){return ju(ll,n)}var vl=U("ZodIPv4",(n,i)=>{KI.init(n,i),In.init(n,i)});function oU(n){return Wu(vl,n)}var Df=U("ZodMAC",(n,i)=>{VI.init(n,i),In.init(n,i)});function eU(n){return hb(Df,n)}var $l=U("ZodIPv6",(n,i)=>{BI.init(n,i),In.init(n,i)});function uU(n){return Ju($l,n)}var Il=U("ZodCIDRv4",(n,i)=>{TI.init(n,i),In.init(n,i)});function lU(n){return Hu(Il,n)}var gl=U("ZodCIDRv6",(n,i)=>{qI.init(n,i),In.init(n,i)});function vU(n){return Xu(gl,n)}var bl=U("ZodBase64",(n,i)=>{EI.init(n,i),In.init(n,i)});function $U(n){return hu(bl,n)}var wl=U("ZodBase64URL",(n,i)=>{ZI.init(n,i),In.init(n,i)});function IU(n){return Pu(wl,n)}var fl=U("ZodE164",(n,i)=>{mI.init(n,i),In.init(n,i)});function gU(n){return Yu(fl,n)}var cl=U("ZodJWT",(n,i)=>{MI.init(n,i),In.init(n,i)});function bU(n){return pu(cl,n)}var Or=U("ZodCustomStringFormat",(n,i)=>{zI.init(n,i),In.init(n,i)});function wU(n,i,r={}){return fr(Or,n,i,r)}function fU(n){return fr(Or,"hostname",oi.hostname,n)}function cU(n){return fr(Or,"hex",oi.hex,n)}function UU(n,i){let r=i?.enc??"hex",o=`${n}_${r}`,t=oi[o];if(!t)throw Error(`Unrecognized hash format: ${o}`);return fr(Or,o,t,i)}var kr=U("ZodNumber",(n,i)=>{Iu.init(n,i),E.init(n,i),n._zod.processJSONSchema=(o,t,e)=>Dw(n,o,t,e),Ho(n,"ZodNumber",{gt(o,t){return this.check(Gi(o,t))},gte(o,t){return this.check(En(o,t))},min(o,t){return this.check(En(o,t))},lt(o,t){return this.check(yi(o,t))},lte(o,t){return this.check(ei(o,t))},max(o,t){return this.check(ei(o,t))},int(o){return this.check(xu(o))},safe(o){return this.check(xu(o))},positive(o){return this.check(Gi(0,o))},nonnegative(o){return this.check(En(0,o))},negative(o){return this.check(yi(0,o))},nonpositive(o){return this.check(ei(0,o))},multipleOf(o,t){return this.check(si(o,t))},step(o,t){return this.check(si(o,t))},finite(){return this}});let r=n._zod.bag;n.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),n.isFinite=!0,n.format=r.format??null});function rn(n){return Kb(kr,n)}var Ht=U("ZodNumberFormat",(n,i)=>{CI.init(n,i),kr.init(n,i)});function xu(n){return Vb(Ht,n)}function DU(n){return Tb(Ht,n)}function SU(n){return qb(Ht,n)}function AU(n){return _b(Ht,n)}function OU(n){return Eb(Ht,n)}var dr=U("ZodBoolean",(n,i)=>{Uo.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Sw(n,r,o,t)});function dn(n){return Zb(dr,n)}var Lr=U("ZodBigInt",(n,i)=>{gu.init(n,i),E.init(n,i),n._zod.processJSONSchema=(o,t,e)=>Aw(n,o,t,e),n.gte=(o,t)=>n.check(En(o,t)),n.min=(o,t)=>n.check(En(o,t)),n.gt=(o,t)=>n.check(Gi(o,t)),n.gte=(o,t)=>n.check(En(o,t)),n.min=(o,t)=>n.check(En(o,t)),n.lt=(o,t)=>n.check(yi(o,t)),n.lte=(o,t)=>n.check(ei(o,t)),n.max=(o,t)=>n.check(ei(o,t)),n.positive=(o)=>n.check(Gi(BigInt(0),o)),n.negative=(o)=>n.check(yi(BigInt(0),o)),n.nonpositive=(o)=>n.check(ei(BigInt(0),o)),n.nonnegative=(o)=>n.check(En(BigInt(0),o)),n.multipleOf=(o,t)=>n.check(si(o,t));let r=n._zod.bag;n.minValue=r.minimum??null,n.maxValue=r.maximum??null,n.format=r.format??null});function kU(n){return Mb(Lr,n)}var Ul=U("ZodBigIntFormat",(n,i)=>{RI.init(n,i),Lr.init(n,i)});function dU(n){return Cb(Ul,n)}function LU(n){return Rb(Ul,n)}var Sf=U("ZodSymbol",(n,i)=>{xI.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Ow(n,r,o,t)});function NU(n){return xb(Sf,n)}var Af=U("ZodUndefined",(n,i)=>{aI.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>dw(n,r,o,t)});function yU(n){return ab(Af,n)}var Of=U("ZodNull",(n,i)=>{sI.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>kw(n,r,o,t)});function ho(n){return sb(Of,n)}var kf=U("ZodAny",(n,i)=>{ng.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>yw(n,r,o,t)});function GU(){return nw(kf)}var df=U("ZodUnknown",(n,i)=>{ig.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Gw(n,r,o,t)});function gn(){return iw(df)}var Lf=U("ZodNever",(n,i)=>{tg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Nw(n,r,o,t)});function Dl(n){return tw(Lf,n)}var Nf=U("ZodVoid",(n,i)=>{rg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Lw(n,r,o,t)});function jU(n){return rw(Nf,n)}var Po=U("ZodDate",(n,i)=>{og.init(n,i),E.init(n,i),n._zod.processJSONSchema=(o,t,e)=>jw(n,o,t,e),n.min=(o,t)=>n.check(En(o,t)),n.max=(o,t)=>n.check(ei(o,t));let r=n._zod.bag;n.minDate=r.minimum?new Date(r.minimum):null,n.maxDate=r.maximum?new Date(r.maximum):null});function WU(n){return ow(Po,n)}var yf=U("ZodArray",(n,i)=>{eg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Bw(n,r,o,t),n.element=i.element,Ho(n,"ZodArray",{min(r,o){return this.check(Fi(r,o))},nonempty(r){return this.check(Fi(1,r))},max(r,o){return this.check(Wt(r,o))},length(r,o){return this.check(Jt(r,o))},unwrap(){return this.element}})});function C(n,i){return lw(yf,n,i)}function JU(n){let i=n._zod.def.shape;return Yn(Object.keys(i))}var Yo=U("ZodObject",(n,i)=>{ug.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Vw(n,r,o,t),G.defineLazy(n,"shape",()=>{return i.shape}),Ho(n,"ZodObject",{keyof(){return Yn(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:gn()})},loose(){return this.clone({...this._zod.def,catchall:gn()})},strict(){return this.clone({...this._zod.def,catchall:Dl()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return G.extend(this,r)},safeExtend(r){return G.safeExtend(this,r)},merge(r){return G.merge(this,r)},pick(r){return G.pick(this,r)},omit(r){return G.omit(this,r)},partial(...r){return G.partial(Al,this,r[0])},required(...r){return G.required(Ol,this,r[0])}})});function Y(n,i){let r={type:"object",shape:n??{},...G.normalizeParams(i)};return new Yo(r)}function HU(n,i){return new Yo({type:"object",shape:n,catchall:Dl(),...G.normalizeParams(i)})}function Pn(n,i){return new Yo({type:"object",shape:n,catchall:gn(),...G.normalizeParams(i)})}var po=U("ZodUnion",(n,i)=>{Do.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>qu(n,r,o,t),n.options=i.options});function bn(n,i){return new po({type:"union",options:n,...G.normalizeParams(i)})}var Gf=U("ZodXor",(n,i)=>{po.init(n,i),lg.init(n,i),n._zod.processJSONSchema=(r,o,t)=>qu(n,r,o,t),n.options=i.options});function XU(n,i){return new Gf({type:"union",options:n,inclusive:!1,...G.normalizeParams(i)})}var jf=U("ZodDiscriminatedUnion",(n,i)=>{po.init(n,i),vg.init(n,i)});function Qo(n,i,r){return new jf({type:"union",options:i,discriminator:n,...G.normalizeParams(r)})}var Wf=U("ZodIntersection",(n,i)=>{$g.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Tw(n,r,o,t)});function Nr(n,i){return new Wf({type:"intersection",left:n,right:i})}var Jf=U("ZodTuple",(n,i)=>{bu.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>qw(n,r,o,t),n.rest=(r)=>n.clone({...n._zod.def,rest:r})});function Hf(n,i,r){let o=i instanceof B,t=o?r:i;return new Jf({type:"tuple",items:n,rest:o?i:null,...G.normalizeParams(t)})}var Dr=U("ZodRecord",(n,i)=>{Ig.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>_w(n,r,o,t),n.keyType=i.keyType,n.valueType=i.valueType});function vn(n,i,r){if(!i||!i._zod)return new Dr({type:"record",keyType:O(),valueType:n,...G.normalizeParams(i)});return new Dr({type:"record",keyType:n,valueType:i,...G.normalizeParams(r)})}function hU(n,i,r){let o=qn(n);return o._zod.values=void 0,new Dr({type:"record",keyType:o,valueType:i,...G.normalizeParams(r)})}function PU(n,i,r){return new Dr({type:"record",keyType:n,valueType:i,mode:"loose",...G.normalizeParams(r)})}var Xf=U("ZodMap",(n,i)=>{gg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Fw(n,r,o,t),n.keyType=i.keyType,n.valueType=i.valueType,n.min=(...r)=>n.check(ji(...r)),n.nonempty=(r)=>n.check(ji(1,r)),n.max=(...r)=>n.check(nt(...r)),n.size=(...r)=>n.check(jt(...r))});function YU(n,i,r){return new Xf({type:"map",keyType:n,valueType:i,...G.normalizeParams(r)})}var hf=U("ZodSet",(n,i)=>{bg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Kw(n,r,o,t),n.min=(...r)=>n.check(ji(...r)),n.nonempty=(r)=>n.check(ji(1,r)),n.max=(...r)=>n.check(nt(...r)),n.size=(...r)=>n.check(jt(...r))});function pU(n,i){return new hf({type:"set",valueType:n,...G.normalizeParams(i)})}var Sr=U("ZodEnum",(n,i)=>{wg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(o,t,e)=>Ww(n,o,t,e),n.enum=i.entries,n.options=Object.values(i.entries);let r=new Set(Object.keys(i.entries));n.extract=(o,t)=>{let e={};for(let u of o)if(r.has(u))e[u]=i.entries[u];else throw Error(`Key ${u} not found in enum`);return new Sr({...i,checks:[],...G.normalizeParams(t),entries:e})},n.exclude=(o,t)=>{let e={...i.entries};for(let u of o)if(r.has(u))delete e[u];else throw Error(`Key ${u} not found in enum`);return new Sr({...i,checks:[],...G.normalizeParams(t),entries:e})}});function Yn(n,i){let r=Array.isArray(n)?Object.fromEntries(n.map((o)=>[o,o])):n;return new Sr({type:"enum",entries:r,...G.normalizeParams(i)})}function QU(n,i){return new Sr({type:"enum",entries:n,...G.normalizeParams(i)})}var Pf=U("ZodLiteral",(n,i)=>{fg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Jw(n,r,o,t),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Q(n,i){return new Pf({type:"literal",values:Array.isArray(n)?n:[n],...G.normalizeParams(i)})}var Yf=U("ZodFile",(n,i)=>{cg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>hw(n,r,o,t),n.min=(r,o)=>n.check(ji(r,o)),n.max=(r,o)=>n.check(nt(r,o)),n.mime=(r,o)=>n.check(vr(Array.isArray(r)?r:[r],o))});function FU(n){return vw(Yf,n)}var pf=U("ZodTransform",(n,i)=>{Ug.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Qw(n,r,o,t),n._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Lt(n.constructor.name);r.addIssue=(e)=>{if(typeof e==="string")r.issues.push(G.issue(e,r.value,i));else{let u=e;if(u.fatal)u.continue=!1;u.code??(u.code="custom"),u.input??(u.input=r.value),u.inst??(u.inst=n),r.issues.push(G.issue(u))}};let t=i.transform(r.value,r);if(t instanceof Promise)return t.then((e)=>{return r.value=e,r.fallback=!0,r});return r.value=t,r.fallback=!0,r}});function Sl(n){return new pf({type:"transform",transform:n})}var Al=U("ZodOptional",(n,i)=>{wu.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>_u(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function fn(n){return new Al({type:"optional",innerType:n})}var Qf=U("ZodExactOptional",(n,i)=>{Dg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>_u(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function Ff(n){return new Qf({type:"optional",innerType:n})}var Kf=U("ZodNullable",(n,i)=>{Sg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Ew(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function Jo(n){return new Kf({type:"nullable",innerType:n})}function KU(n){return fn(Jo(n))}var Bf=U("ZodDefault",(n,i)=>{Ag.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>mw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function Vf(n,i){return new Bf({type:"default",innerType:n,get defaultValue(){return typeof i==="function"?i():G.shallowClone(i)}})}var Tf=U("ZodPrefault",(n,i)=>{Og.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Mw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function qf(n,i){return new Tf({type:"prefault",innerType:n,get defaultValue(){return typeof i==="function"?i():G.shallowClone(i)}})}var Ol=U("ZodNonOptional",(n,i)=>{kg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Zw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function _f(n,i){return new Ol({type:"nonoptional",innerType:n,...G.normalizeParams(i)})}var Ef=U("ZodSuccess",(n,i)=>{dg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Pw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function BU(n){return new Ef({type:"success",innerType:n})}var Zf=U("ZodCatch",(n,i)=>{Lg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>zw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function mf(n,i){return new Zf({type:"catch",innerType:n,catchValue:typeof i==="function"?i:()=>i})}var Mf=U("ZodNaN",(n,i)=>{Ng.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Hw(n,r,o,t)});function VU(n){return uw(Mf,n)}var Fo=U("ZodPipe",(n,i)=>{fu.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Cw(n,r,o,t),n.in=i.in,n.out=i.out});function au(n,i){return new Fo({type:"pipe",in:n,out:i})}var Ko=U("ZodCodec",(n,i)=>{Fo.init(n,i),So.init(n,i)});function TU(n,i,r){return new Ko({type:"pipe",in:n,out:i,transform:r.decode,reverseTransform:r.encode})}function qU(n){let i=n._zod.def;return new Ko({type:"pipe",in:i.out,out:i.in,transform:i.reverseTransform,reverseTransform:i.transform})}var zf=U("ZodPreprocess",(n,i)=>{Fo.init(n,i),yg.init(n,i)}),Cf=U("ZodReadonly",(n,i)=>{Gg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Rw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function Rf(n){return new Cf({type:"readonly",innerType:n})}var xf=U("ZodTemplateLiteral",(n,i)=>{jg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Xw(n,r,o,t)});function _U(n,i){return new xf({type:"template_literal",parts:n,...G.normalizeParams(i)})}var af=U("ZodLazy",(n,i)=>{Hg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>aw(n,r,o,t),n.unwrap=()=>n._zod.def.getter()});function sf(n){return new af({type:"lazy",getter:n})}var nc=U("ZodPromise",(n,i)=>{Jg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>xw(n,r,o,t),n.unwrap=()=>n._zod.def.innerType});function EU(n){return new nc({type:"promise",innerType:n})}var ic=U("ZodFunction",(n,i)=>{Wg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>pw(n,r,o,t)});function ZU(n){return new ic({type:"function",input:Array.isArray(n?.input)?Hf(n?.input):n?.input??C(gn()),output:n?.output??gn()})}var Bo=U("ZodCustom",(n,i)=>{Xg.init(n,i),E.init(n,i),n._zod.processJSONSchema=(r,o,t)=>Yw(n,r,o,t)});function mU(n){let i=new wn({check:"custom"});return i._zod.check=n,i}function kl(n,i){return $w(Bo,n??(()=>!0),i)}function tc(n,i={}){return Iw(Bo,n,i)}function rc(n,i){return gw(n,i)}var MU=bw,zU=ww;function CU(n,i={}){let r=new Bo({type:"custom",check:"custom",fn:(o)=>o instanceof n,abort:!0,...G.normalizeParams(i)});return r._zod.bag.Class=n,r._zod.check=(o)=>{if(!(o.value instanceof n))o.issues.push({code:"invalid_type",expected:n.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var RU=(...n)=>fw({Codec:Ko,Boolean:dr,String:Ar},...n);function xU(n){let i=sf(()=>{return bn([O(n),rn(),dn(),ho(),C(i),vn(O(),i)])});return i}function Vo(n,i){return new zf({type:"pipe",in:Sl(n),out:i})}var Cj={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 Rj(n){kn({customError:n})}function xj(){return kn().customError}var oc;(function(n){})(oc||(oc={}));var X={...jo,...mu,iso:et},aj=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 sj(n,i){let r=n.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return i??"draft-2020-12"}function nW(n,i){if(!n.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=n.slice(1).split("/").filter(Boolean);if(r.length===0)return i.rootSchema;let o=i.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let t=r[1];if(!t||!i.defs[t])throw Error(`Reference not found: ${n}`);return i.defs[t]}throw Error(`Reference not found: ${n}`)}function aU(n,i){if(n.not!==void 0){if(typeof n.not==="object"&&Object.keys(n.not).length===0)return X.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(n.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(n.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(n.if!==void 0||n.then!==void 0||n.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(n.dependentSchemas!==void 0||n.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(n.$ref){let t=n.$ref;if(i.refs.has(t))return i.refs.get(t);if(i.processing.has(t))return X.lazy(()=>{if(!i.refs.has(t))throw Error(`Circular reference not resolved: ${t}`);return i.refs.get(t)});i.processing.add(t);let e=nW(t,i),u=Bn(e,i);return i.refs.set(t,u),i.processing.delete(t),u}if(n.enum!==void 0){let t=n.enum;if(i.version==="openapi-3.0"&&n.nullable===!0&&t.length===1&&t[0]===null)return X.null();if(t.length===0)return X.never();if(t.length===1)return X.literal(t[0]);if(t.every((u)=>typeof u==="string"))return X.enum(t);let e=t.map((u)=>X.literal(u));if(e.length<2)return e[0];return X.union([e[0],e[1],...e.slice(2)])}if(n.const!==void 0)return X.literal(n.const);let r=n.type;if(Array.isArray(r)){let t=r.map((e)=>{let u={...n,type:e};return aU(u,i)});if(t.length===0)return X.never();if(t.length===1)return t[0];return X.union(t)}if(!r)return X.any();let o;switch(r){case"string":{let t=X.string();if(n.format){let e=n.format;if(e==="email")t=t.check(X.email());else if(e==="uri"||e==="uri-reference")t=t.check(X.url());else if(e==="uuid"||e==="guid")t=t.check(X.uuid());else if(e==="date-time")t=t.check(X.iso.datetime());else if(e==="date")t=t.check(X.iso.date());else if(e==="time")t=t.check(X.iso.time());else if(e==="duration")t=t.check(X.iso.duration());else if(e==="ipv4")t=t.check(X.ipv4());else if(e==="ipv6")t=t.check(X.ipv6());else if(e==="mac")t=t.check(X.mac());else if(e==="cidr")t=t.check(X.cidrv4());else if(e==="cidr-v6")t=t.check(X.cidrv6());else if(e==="base64")t=t.check(X.base64());else if(e==="base64url")t=t.check(X.base64url());else if(e==="e164")t=t.check(X.e164());else if(e==="jwt")t=t.check(X.jwt());else if(e==="emoji")t=t.check(X.emoji());else if(e==="nanoid")t=t.check(X.nanoid());else if(e==="cuid")t=t.check(X.cuid());else if(e==="cuid2")t=t.check(X.cuid2());else if(e==="ulid")t=t.check(X.ulid());else if(e==="xid")t=t.check(X.xid());else if(e==="ksuid")t=t.check(X.ksuid())}if(typeof n.minLength==="number")t=t.min(n.minLength);if(typeof n.maxLength==="number")t=t.max(n.maxLength);if(n.pattern)t=t.regex(new RegExp(n.pattern));o=t;break}case"number":case"integer":{let t=r==="integer"?X.number().int():X.number();if(typeof n.minimum==="number")t=t.min(n.minimum);if(typeof n.maximum==="number")t=t.max(n.maximum);if(typeof n.exclusiveMinimum==="number")t=t.gt(n.exclusiveMinimum);else if(n.exclusiveMinimum===!0&&typeof n.minimum==="number")t=t.gt(n.minimum);if(typeof n.exclusiveMaximum==="number")t=t.lt(n.exclusiveMaximum);else if(n.exclusiveMaximum===!0&&typeof n.maximum==="number")t=t.lt(n.maximum);if(typeof n.multipleOf==="number")t=t.multipleOf(n.multipleOf);o=t;break}case"boolean":{o=X.boolean();break}case"null":{o=X.null();break}case"object":{let t={},e=n.properties||{},u=new Set(n.required||[]);for(let[$,I]of Object.entries(e)){let g=Bn(I,i);t[$]=u.has($)?g:g.optional()}if(n.propertyNames){let $=Bn(n.propertyNames,i),I=n.additionalProperties&&typeof n.additionalProperties==="object"?Bn(n.additionalProperties,i):X.any();if(Object.keys(t).length===0){o=X.record($,I);break}let g=X.object(t).passthrough(),b=X.looseRecord($,I);o=X.intersection(g,b);break}if(n.patternProperties){let $=n.patternProperties,I=Object.keys($),g=[];for(let w of I){let f=Bn($[w],i),c=X.string().regex(new RegExp(w));g.push(X.looseRecord(c,f))}let b=[];if(Object.keys(t).length>0)b.push(X.object(t).passthrough());if(b.push(...g),b.length===0)o=X.object({}).passthrough();else if(b.length===1)o=b[0];else{let w=X.intersection(b[0],b[1]);for(let f=2;f<b.length;f++)w=X.intersection(w,b[f]);o=w}break}let l=X.object(t);if(n.additionalProperties===!1)o=l.strict();else if(typeof n.additionalProperties==="object")o=l.catchall(Bn(n.additionalProperties,i));else o=l.passthrough();break}case"array":{let{prefixItems:t,items:e}=n;if(t&&Array.isArray(t)){let u=t.map(($)=>Bn($,i)),l=e&&typeof e==="object"&&!Array.isArray(e)?Bn(e,i):void 0;if(l)o=X.tuple(u).rest(l);else o=X.tuple(u);if(typeof n.minItems==="number")o=o.check(X.minLength(n.minItems));if(typeof n.maxItems==="number")o=o.check(X.maxLength(n.maxItems))}else if(Array.isArray(e)){let u=e.map(($)=>Bn($,i)),l=n.additionalItems&&typeof n.additionalItems==="object"?Bn(n.additionalItems,i):void 0;if(l)o=X.tuple(u).rest(l);else o=X.tuple(u);if(typeof n.minItems==="number")o=o.check(X.minLength(n.minItems));if(typeof n.maxItems==="number")o=o.check(X.maxLength(n.maxItems))}else if(e!==void 0){let u=Bn(e,i),l=X.array(u);if(typeof n.minItems==="number")l=l.min(n.minItems);if(typeof n.maxItems==="number")l=l.max(n.maxItems);o=l}else o=X.array(X.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function Bn(n,i){if(typeof n==="boolean")return n?X.any():X.never();let r=aU(n,i),o=n.type||n.enum!==void 0||n.const!==void 0;if(n.anyOf&&Array.isArray(n.anyOf)){let l=n.anyOf.map((I)=>Bn(I,i)),$=X.union(l);r=o?X.intersection(r,$):$}if(n.oneOf&&Array.isArray(n.oneOf)){let l=n.oneOf.map((I)=>Bn(I,i)),$=X.xor(l);r=o?X.intersection(r,$):$}if(n.allOf&&Array.isArray(n.allOf))if(n.allOf.length===0)r=o?r:X.any();else{let l=o?r:Bn(n.allOf[0],i),$=o?0:1;for(let I=$;I<n.allOf.length;I++)l=X.intersection(l,Bn(n.allOf[I],i));r=l}if(n.nullable===!0&&i.version==="openapi-3.0")r=X.nullable(r);if(n.readOnly===!0)r=X.readonly(r);if(n.default!==void 0)r=r.default(n.default);let t={},e=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let l of e)if(l in n)t[l]=n[l];let u=["contentEncoding","contentMediaType","contentSchema"];for(let l of u)if(l in n)t[l]=n[l];for(let l of Object.keys(n))if(!aj.has(l))t[l]=n[l];if(Object.keys(t).length>0)i.registry.add(r,t);if(n.description)r=r.describe(n.description);return r}function sU(n,i){if(typeof n==="boolean")return n?X.any():X.never();let r;try{r=JSON.parse(JSON.stringify(n))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=sj(r,i?.defaultTarget),t=r.$defs||r.definitions||{},e={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:r,registry:i?.registry??hn};return Bn(r,e)}var ec={};pi(ec,{string:()=>iW,number:()=>tW,date:()=>eW,boolean:()=>rW,bigint:()=>oW});function iW(n){return Xb(Ar,n)}function tW(n){return Bb(kr,n)}function rW(n){return mb(dr,n)}function oW(n){return zb(Lr,n)}function eW(n){return ew(Po,n)}kn(Ao());var uc="2025-11-25";var nD=[uc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ut="io.modelcontextprotocol/related-task",Ll="2.0",Jn=kl((n)=>n!==null&&(typeof n==="object"||typeof n==="function")),iD=bn([O(),rn().int()]),tD=O(),_3=Pn({ttl:rn().optional(),pollInterval:rn().optional()}),uW=Y({ttl:rn().optional()}),lW=Y({taskId:O()}),lc=Pn({progressToken:iD.optional(),[ut]:lW.optional()}),ui=Y({_meta:lc.optional()}),To=ui.extend({task:uW.optional()}),rD=(n)=>To.safeParse(n).success,pn=Y({method:O(),params:ui.loose().optional()}),vi=Y({_meta:lc.optional()}),$i=Y({method:O(),params:vi.loose().optional()}),Qn=Pn({_meta:lc.optional()}),Nl=bn([O(),rn().int()]),oD=Y({jsonrpc:Q(Ll),id:Nl,...pn.shape}).strict(),vc=(n)=>oD.safeParse(n).success,eD=Y({jsonrpc:Q(Ll),...$i.shape}).strict(),uD=(n)=>eD.safeParse(n).success,$c=Y({jsonrpc:Q(Ll),id:Nl,result:Qn}).strict(),qo=(n)=>$c.safeParse(n).success;var a;(function(n){n[n.ConnectionClosed=-32000]="ConnectionClosed",n[n.RequestTimeout=-32001]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError",n[n.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(a||(a={}));var Ic=Y({jsonrpc:Q(Ll),id:Nl.optional(),error:Y({code:rn().int(),message:O(),data:gn().optional()})}).strict();var lD=(n)=>Ic.safeParse(n).success;var vD=bn([oD,eD,$c,Ic]),E3=bn([$c,Ic]),yl=Qn.strict(),vW=vi.extend({requestId:Nl.optional(),reason:O().optional()}),Gl=$i.extend({method:Q("notifications/cancelled"),params:vW}),$W=Y({src:O(),mimeType:O().optional(),sizes:C(O()).optional(),theme:Yn(["light","dark"]).optional()}),_o=Y({icons:C($W).optional()}),yr=Y({name:O(),title:O().optional()}),$D=yr.extend({...yr.shape,..._o.shape,version:O(),websiteUrl:O().optional(),description:O().optional()}),IW=Nr(Y({applyDefaults:dn().optional()}),vn(O(),gn())),gW=Vo((n)=>{if(n&&typeof n==="object"&&!Array.isArray(n)){if(Object.keys(n).length===0)return{form:{}}}return n},Nr(Y({form:IW.optional(),url:Jn.optional()}),vn(O(),gn()).optional())),bW=Pn({list:Jn.optional(),cancel:Jn.optional(),requests:Pn({sampling:Pn({createMessage:Jn.optional()}).optional(),elicitation:Pn({create:Jn.optional()}).optional()}).optional()}),wW=Pn({list:Jn.optional(),cancel:Jn.optional(),requests:Pn({tools:Pn({call:Jn.optional()}).optional()}).optional()}),fW=Y({experimental:vn(O(),Jn).optional(),sampling:Y({context:Jn.optional(),tools:Jn.optional()}).optional(),elicitation:gW.optional(),roots:Y({listChanged:dn().optional()}).optional(),tasks:bW.optional(),extensions:vn(O(),Jn).optional()}),cW=ui.extend({protocolVersion:O(),capabilities:fW,clientInfo:$D}),gc=pn.extend({method:Q("initialize"),params:cW});var UW=Y({experimental:vn(O(),Jn).optional(),logging:Jn.optional(),completions:Jn.optional(),prompts:Y({listChanged:dn().optional()}).optional(),resources:Y({subscribe:dn().optional(),listChanged:dn().optional()}).optional(),tools:Y({listChanged:dn().optional()}).optional(),tasks:wW.optional(),extensions:vn(O(),Jn).optional()}),DW=Qn.extend({protocolVersion:O(),capabilities:UW,serverInfo:$D,instructions:O().optional()}),bc=$i.extend({method:Q("notifications/initialized"),params:vi.optional()});var jl=pn.extend({method:Q("ping"),params:ui.optional()}),SW=Y({progress:rn(),total:fn(rn()),message:fn(O())}),AW=Y({...vi.shape,...SW.shape,progressToken:iD}),Wl=$i.extend({method:Q("notifications/progress"),params:AW}),OW=ui.extend({cursor:tD.optional()}),Eo=pn.extend({params:OW.optional()}),Zo=Qn.extend({nextCursor:tD.optional()}),kW=Yn(["working","input_required","completed","failed","cancelled"]),mo=Y({taskId:O(),status:kW,ttl:bn([rn(),ho()]),createdAt:O(),lastUpdatedAt:O(),pollInterval:fn(rn()),statusMessage:fn(O())}),Gr=Qn.extend({task:mo}),dW=vi.merge(mo),Mo=$i.extend({method:Q("notifications/tasks/status"),params:dW}),Jl=pn.extend({method:Q("tasks/get"),params:ui.extend({taskId:O()})}),Hl=Qn.merge(mo),Xl=pn.extend({method:Q("tasks/result"),params:ui.extend({taskId:O()})}),Z3=Qn.loose(),hl=Eo.extend({method:Q("tasks/list")}),Pl=Zo.extend({tasks:C(mo)}),Yl=pn.extend({method:Q("tasks/cancel"),params:ui.extend({taskId:O()})}),ID=Qn.merge(mo),gD=Y({uri:O(),mimeType:fn(O()),_meta:vn(O(),gn()).optional()}),bD=gD.extend({text:O()}),wc=O().refine((n)=>{try{return atob(n),!0}catch{return!1}},{message:"Invalid Base64 string"}),wD=gD.extend({blob:wc}),zo=Yn(["user","assistant"]),jr=Y({audience:C(zo).optional(),priority:rn().min(0).max(1).optional(),lastModified:et.datetime({offset:!0}).optional()}),fD=Y({...yr.shape,..._o.shape,uri:O(),description:fn(O()),mimeType:fn(O()),size:fn(rn()),annotations:jr.optional(),_meta:fn(Pn({}))}),LW=Y({...yr.shape,..._o.shape,uriTemplate:O(),description:fn(O()),mimeType:fn(O()),annotations:jr.optional(),_meta:fn(Pn({}))}),NW=Eo.extend({method:Q("resources/list")}),yW=Zo.extend({resources:C(fD)}),GW=Eo.extend({method:Q("resources/templates/list")}),jW=Zo.extend({resourceTemplates:C(LW)}),fc=ui.extend({uri:O()}),WW=fc,JW=pn.extend({method:Q("resources/read"),params:WW}),HW=Qn.extend({contents:C(bn([bD,wD]))}),XW=$i.extend({method:Q("notifications/resources/list_changed"),params:vi.optional()}),hW=fc,PW=pn.extend({method:Q("resources/subscribe"),params:hW}),YW=fc,pW=pn.extend({method:Q("resources/unsubscribe"),params:YW}),QW=vi.extend({uri:O()}),FW=$i.extend({method:Q("notifications/resources/updated"),params:QW}),KW=Y({name:O(),description:fn(O()),required:fn(dn())}),BW=Y({...yr.shape,..._o.shape,description:fn(O()),arguments:fn(C(KW)),_meta:fn(Pn({}))}),VW=Eo.extend({method:Q("prompts/list")}),TW=Zo.extend({prompts:C(BW)}),qW=ui.extend({name:O(),arguments:vn(O(),O()).optional()}),_W=pn.extend({method:Q("prompts/get"),params:qW}),cc=Y({type:Q("text"),text:O(),annotations:jr.optional(),_meta:vn(O(),gn()).optional()}),Uc=Y({type:Q("image"),data:wc,mimeType:O(),annotations:jr.optional(),_meta:vn(O(),gn()).optional()}),Dc=Y({type:Q("audio"),data:wc,mimeType:O(),annotations:jr.optional(),_meta:vn(O(),gn()).optional()}),EW=Y({type:Q("tool_use"),name:O(),id:O(),input:vn(O(),gn()),_meta:vn(O(),gn()).optional()}),ZW=Y({type:Q("resource"),resource:bn([bD,wD]),annotations:jr.optional(),_meta:vn(O(),gn()).optional()}),mW=fD.extend({type:Q("resource_link")}),Sc=bn([cc,Uc,Dc,mW,ZW]),MW=Y({role:zo,content:Sc}),zW=Qn.extend({description:O().optional(),messages:C(MW)}),CW=$i.extend({method:Q("notifications/prompts/list_changed"),params:vi.optional()}),RW=Y({title:O().optional(),readOnlyHint:dn().optional(),destructiveHint:dn().optional(),idempotentHint:dn().optional(),openWorldHint:dn().optional()}),xW=Y({taskSupport:Yn(["required","optional","forbidden"]).optional()}),cD=Y({...yr.shape,..._o.shape,description:O().optional(),inputSchema:Y({type:Q("object"),properties:vn(O(),Jn).optional(),required:C(O()).optional()}).catchall(gn()),outputSchema:Y({type:Q("object"),properties:vn(O(),Jn).optional(),required:C(O()).optional()}).catchall(gn()).optional(),annotations:RW.optional(),execution:xW.optional(),_meta:vn(O(),gn()).optional()}),Ac=Eo.extend({method:Q("tools/list")}),aW=Zo.extend({tools:C(cD)}),pl=Qn.extend({content:C(Sc).default([]),structuredContent:vn(O(),gn()).optional(),isError:dn().optional()}),m3=pl.or(Qn.extend({toolResult:gn()})),sW=To.extend({name:O(),arguments:vn(O(),gn()).optional()}),Co=pn.extend({method:Q("tools/call"),params:sW}),nJ=$i.extend({method:Q("notifications/tools/list_changed"),params:vi.optional()}),M3=Y({autoRefresh:dn().default(!0),debounceMs:rn().int().nonnegative().default(300)}),Ro=Yn(["debug","info","notice","warning","error","critical","alert","emergency"]),iJ=ui.extend({level:Ro}),Oc=pn.extend({method:Q("logging/setLevel"),params:iJ}),tJ=vi.extend({level:Ro,logger:O().optional(),data:gn()}),rJ=$i.extend({method:Q("notifications/message"),params:tJ}),oJ=Y({name:O().optional()}),eJ=Y({hints:C(oJ).optional(),costPriority:rn().min(0).max(1).optional(),speedPriority:rn().min(0).max(1).optional(),intelligencePriority:rn().min(0).max(1).optional()}),uJ=Y({mode:Yn(["auto","required","none"]).optional()}),lJ=Y({type:Q("tool_result"),toolUseId:O().describe("The unique identifier for the corresponding tool call."),content:C(Sc).default([]),structuredContent:Y({}).loose().optional(),isError:dn().optional(),_meta:vn(O(),gn()).optional()}),vJ=Qo("type",[cc,Uc,Dc]),dl=Qo("type",[cc,Uc,Dc,EW,lJ]),$J=Y({role:zo,content:bn([dl,C(dl)]),_meta:vn(O(),gn()).optional()}),IJ=To.extend({messages:C($J),modelPreferences:eJ.optional(),systemPrompt:O().optional(),includeContext:Yn(["none","thisServer","allServers"]).optional(),temperature:rn().optional(),maxTokens:rn().int(),stopSequences:C(O()).optional(),metadata:Jn.optional(),tools:C(cD).optional(),toolChoice:uJ.optional()}),gJ=pn.extend({method:Q("sampling/createMessage"),params:IJ}),xo=Qn.extend({model:O(),stopReason:fn(Yn(["endTurn","stopSequence","maxTokens"]).or(O())),role:zo,content:vJ}),kc=Qn.extend({model:O(),stopReason:fn(Yn(["endTurn","stopSequence","maxTokens","toolUse"]).or(O())),role:zo,content:bn([dl,C(dl)])}),bJ=Y({type:Q("boolean"),title:O().optional(),description:O().optional(),default:dn().optional()}),wJ=Y({type:Q("string"),title:O().optional(),description:O().optional(),minLength:rn().optional(),maxLength:rn().optional(),format:Yn(["email","uri","date","date-time"]).optional(),default:O().optional()}),fJ=Y({type:Yn(["number","integer"]),title:O().optional(),description:O().optional(),minimum:rn().optional(),maximum:rn().optional(),default:rn().optional()}),cJ=Y({type:Q("string"),title:O().optional(),description:O().optional(),enum:C(O()),default:O().optional()}),UJ=Y({type:Q("string"),title:O().optional(),description:O().optional(),oneOf:C(Y({const:O(),title:O()})),default:O().optional()}),DJ=Y({type:Q("string"),title:O().optional(),description:O().optional(),enum:C(O()),enumNames:C(O()).optional(),default:O().optional()}),SJ=bn([cJ,UJ]),AJ=Y({type:Q("array"),title:O().optional(),description:O().optional(),minItems:rn().optional(),maxItems:rn().optional(),items:Y({type:Q("string"),enum:C(O())}),default:C(O()).optional()}),OJ=Y({type:Q("array"),title:O().optional(),description:O().optional(),minItems:rn().optional(),maxItems:rn().optional(),items:Y({anyOf:C(Y({const:O(),title:O()}))}),default:C(O()).optional()}),kJ=bn([AJ,OJ]),dJ=bn([DJ,SJ,kJ]),LJ=bn([dJ,bJ,wJ,fJ]),NJ=To.extend({mode:Q("form").optional(),message:O(),requestedSchema:Y({type:Q("object"),properties:vn(O(),LJ),required:C(O()).optional()})}),yJ=To.extend({mode:Q("url"),message:O(),elicitationId:O(),url:O().url()}),GJ=bn([NJ,yJ]),jJ=pn.extend({method:Q("elicitation/create"),params:GJ}),WJ=vi.extend({elicitationId:O()}),JJ=$i.extend({method:Q("notifications/elicitation/complete"),params:WJ}),Wr=Qn.extend({action:Yn(["accept","decline","cancel"]),content:Vo((n)=>n===null?void 0:n,vn(O(),bn([O(),rn(),dn(),C(O())])).optional())}),HJ=Y({type:Q("ref/resource"),uri:O()});var XJ=Y({type:Q("ref/prompt"),name:O()}),hJ=ui.extend({ref:bn([XJ,HJ]),argument:Y({name:O(),value:O()}),context:Y({arguments:vn(O(),O()).optional()}).optional()}),PJ=pn.extend({method:Q("completion/complete"),params:hJ});var YJ=Qn.extend({completion:Pn({values:C(O()).max(100),total:fn(rn().int()),hasMore:fn(dn())})}),pJ=Y({uri:O().startsWith("file://"),name:O().optional(),_meta:vn(O(),gn()).optional()}),QJ=pn.extend({method:Q("roots/list"),params:ui.optional()}),dc=Qn.extend({roots:C(pJ)}),FJ=$i.extend({method:Q("notifications/roots/list_changed"),params:vi.optional()}),z3=bn([jl,gc,PJ,Oc,_W,VW,NW,GW,JW,PW,pW,Co,Ac,Jl,Xl,hl,Yl]),C3=bn([Gl,Wl,bc,FJ,Mo]),R3=bn([yl,xo,kc,Wr,dc,Hl,Pl,Gr]),x3=bn([jl,gJ,jJ,QJ,Jl,Xl,hl,Yl]),a3=bn([Gl,Wl,rJ,FW,XW,nJ,CW,Mo,JJ]),s3=bn([yl,DW,YJ,zW,TW,yW,jW,HW,pl,aW,Hl,Pl,Gr]);class Z extends Error{constructor(n,i,r){super(`MCP error ${n}: ${i}`);this.code=n,this.data=r,this.name="McpError"}static fromError(n,i,r){if(n===a.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new UD(o.elicitations,i)}return new Z(n,i,r)}}class UD extends Z{constructor(n,i=`URL elicitation${n.length>1?"s":""} required`){super(a.UrlElicitationRequired,i,{elicitations:n})}get elicitations(){return this.data?.elicitations??[]}}function lt(n){return n==="completed"||n==="failed"||n==="cancelled"}var KJ=Symbol("Let zodToJsonSchema decide on which parser to use");var hV=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Lc(n){let r=Zu(n)?.method;if(!r)throw Error("Schema is missing a method literal");let o=V0(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function Nc(n,i){let r=ot(n,i);if(!r.success)throw r.error;return r.data}var EJ=60000;class yc{constructor(n){if(this._options=n,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(Gl,(i)=>{this._oncancel(i)}),this.setNotificationHandler(Wl,(i)=>{this._onprogress(i)}),this.setRequestHandler(jl,(i)=>({})),this._taskStore=n?.taskStore,this._taskMessageQueue=n?.taskMessageQueue,this._taskStore)this.setRequestHandler(Jl,async(i,r)=>{let o=await this._taskStore.getTask(i.params.taskId,r.sessionId);if(!o)throw new Z(a.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Xl,async(i,r)=>{let o=async()=>{let t=i.params.taskId;if(this._taskMessageQueue){let u;while(u=await this._taskMessageQueue.dequeue(t,r.sessionId)){if(u.type==="response"||u.type==="error"){let l=u.message,$=l.id,I=this._requestResolvers.get($);if(I)if(this._requestResolvers.delete($),u.type==="response")I(l);else{let g=l,b=new Z(g.error.code,g.error.message,g.error.data);I(b)}else{let g=u.type==="response"?"Response":"Error";this._onerror(Error(`${g} handler missing for request ${$}`))}continue}await this._transport?.send(u.message,{relatedRequestId:r.requestId})}}let e=await this._taskStore.getTask(t,r.sessionId);if(!e)throw new Z(a.InvalidParams,`Task not found: ${t}`);if(!lt(e.status))return await this._waitForTaskUpdate(t,r.signal),await o();if(lt(e.status)){let u=await this._taskStore.getTaskResult(t,r.sessionId);return this._clearTaskQueue(t),{...u,_meta:{...u._meta,[ut]:{taskId:t}}}}return await o()};return await o()}),this.setRequestHandler(hl,async(i,r)=>{try{let{tasks:o,nextCursor:t}=await this._taskStore.listTasks(i.params?.cursor,r.sessionId);return{tasks:o,nextCursor:t,_meta:{}}}catch(o){throw new Z(a.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Yl,async(i,r)=>{try{let o=await this._taskStore.getTask(i.params.taskId,r.sessionId);if(!o)throw new Z(a.InvalidParams,`Task not found: ${i.params.taskId}`);if(lt(o.status))throw new Z(a.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(i.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(i.params.taskId);let t=await this._taskStore.getTask(i.params.taskId,r.sessionId);if(!t)throw new Z(a.InvalidParams,`Task not found after cancellation: ${i.params.taskId}`);return{_meta:{},...t}}catch(o){if(o instanceof Z)throw o;throw new Z(a.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(n){if(!n.params.requestId)return;this._requestHandlerAbortControllers.get(n.params.requestId)?.abort(n.params.reason)}_setupTimeout(n,i,r,o,t=!1){this._timeoutInfo.set(n,{timeoutId:setTimeout(o,i),startTime:Date.now(),timeout:i,maxTotalTimeout:r,resetTimeoutOnProgress:t,onTimeout:o})}_resetTimeout(n){let i=this._timeoutInfo.get(n);if(!i)return!1;let r=Date.now()-i.startTime;if(i.maxTotalTimeout&&r>=i.maxTotalTimeout)throw this._timeoutInfo.delete(n),Z.fromError(a.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:r});return clearTimeout(i.timeoutId),i.timeoutId=setTimeout(i.onTimeout,i.timeout),!0}_cleanupTimeout(n){let i=this._timeoutInfo.get(n);if(i)clearTimeout(i.timeoutId),this._timeoutInfo.delete(n)}async connect(n){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=n;let i=this.transport?.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(t)=>{r?.(t),this._onerror(t)};let o=this._transport?.onmessage;this._transport.onmessage=(t,e)=>{if(o?.(t,e),qo(t)||lD(t))this._onresponse(t);else if(vc(t))this._onrequest(t,e);else if(uD(t))this._onnotification(t);else this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){let n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let i=Z.fromError(a.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of n.values())r(i)}_onerror(n){this.onerror?.(n)}_onnotification(n){let i=this._notificationHandlers.get(n.method)??this.fallbackNotificationHandler;if(i===void 0)return;Promise.resolve().then(()=>i(n)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(n,i){let r=this._requestHandlers.get(n.method)??this.fallbackRequestHandler,o=this._transport,t=n.params?._meta?.[ut]?.taskId;if(r===void 0){let I={jsonrpc:"2.0",id:n.id,error:{code:a.MethodNotFound,message:"Method not found"}};if(t&&this._taskMessageQueue)this._enqueueTaskMessage(t,{type:"error",message:I,timestamp:Date.now()},o?.sessionId).catch((g)=>this._onerror(Error(`Failed to enqueue error response: ${g}`)));else o?.send(I).catch((g)=>this._onerror(Error(`Failed to send an error response: ${g}`)));return}let e=new AbortController;this._requestHandlerAbortControllers.set(n.id,e);let u=rD(n.params)?n.params.task:void 0,l=this._taskStore?this.requestTaskStore(n,o?.sessionId):void 0,$={signal:e.signal,sessionId:o?.sessionId,_meta:n.params?._meta,sendNotification:async(I)=>{if(e.signal.aborted)return;let g={relatedRequestId:n.id};if(t)g.relatedTask={taskId:t};await this.notification(I,g)},sendRequest:async(I,g,b)=>{if(e.signal.aborted)throw new Z(a.ConnectionClosed,"Request was cancelled");let w={...b,relatedRequestId:n.id};if(t&&!w.relatedTask)w.relatedTask={taskId:t};let f=w.relatedTask?.taskId??t;if(f&&l)await l.updateTaskStatus(f,"input_required");return await this.request(I,g,w)},authInfo:i?.authInfo,requestId:n.id,requestInfo:i?.requestInfo,taskId:t,taskStore:l,taskRequestedTtl:u?.ttl,closeSSEStream:i?.closeSSEStream,closeStandaloneSSEStream:i?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(u)this.assertTaskHandlerCapability(n.method)}).then(()=>r(n,$)).then(async(I)=>{if(e.signal.aborted)return;let g={result:I,jsonrpc:"2.0",id:n.id};if(t&&this._taskMessageQueue)await this._enqueueTaskMessage(t,{type:"response",message:g,timestamp:Date.now()},o?.sessionId);else await o?.send(g)},async(I)=>{if(e.signal.aborted)return;let g={jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(I.code)?I.code:a.InternalError,message:I.message??"Internal error",...I.data!==void 0&&{data:I.data}}};if(t&&this._taskMessageQueue)await this._enqueueTaskMessage(t,{type:"error",message:g,timestamp:Date.now()},o?.sessionId);else await o?.send(g)}).catch((I)=>this._onerror(Error(`Failed to send response: ${I}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(n.id)===e)this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){let{progressToken:i,...r}=n.params,o=Number(i),t=this._progressHandlers.get(o);if(!t){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}let e=this._responseHandlers.get(o),u=this._timeoutInfo.get(o);if(u&&e&&u.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),e(l);return}t(r)}_onresponse(n){let i=Number(n.id),r=this._requestResolvers.get(i);if(r){if(this._requestResolvers.delete(i),qo(n))r(n);else{let e=new Z(n.error.code,n.error.message,n.error.data);r(e)}return}let o=this._responseHandlers.get(i);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}this._responseHandlers.delete(i),this._cleanupTimeout(i);let t=!1;if(qo(n)&&n.result&&typeof n.result==="object"){let e=n.result;if(e.task&&typeof e.task==="object"){let u=e.task;if(typeof u.taskId==="string")t=!0,this._taskProgressTokens.set(u.taskId,i)}}if(!t)this._progressHandlers.delete(i);if(qo(n))o(n);else{let e=Z.fromError(n.error.code,n.error.message,n.error.data);o(e)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(n,i,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(n,i,r)}}catch(e){yield{type:"error",error:e instanceof Z?e:new Z(a.InternalError,String(e))}}return}let t;try{let e=await this.request(n,Gr,r);if(e.task)t=e.task.taskId,yield{type:"taskCreated",task:e.task};else throw new Z(a.InternalError,"Task creation did not return a task");while(!0){let u=await this.getTask({taskId:t},r);if(yield{type:"taskStatus",task:u},lt(u.status)){if(u.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:t},i,r)};else if(u.status==="failed")yield{type:"error",error:new Z(a.InternalError,`Task ${t} failed`)};else if(u.status==="cancelled")yield{type:"error",error:new Z(a.InternalError,`Task ${t} was cancelled`)};return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:t},i,r)};return}let l=u.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise(($)=>setTimeout($,l)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof Z?e:new Z(a.InternalError,String(e))}}}request(n,i,r){let{relatedRequestId:o,resumptionToken:t,onresumptiontoken:e,task:u,relatedTask:l}=r??{};return new Promise(($,I)=>{let g=(d)=>{I(d)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(n.method),u)this.assertTaskCapability(n.method)}catch(d){g(d);return}r?.signal?.throwIfAborted();let b=this._requestMessageId++,w={...n,jsonrpc:"2.0",id:b};if(r?.onprogress)this._progressHandlers.set(b,r.onprogress),w.params={...n.params,_meta:{...n.params?._meta||{},progressToken:b}};if(u)w.params={...w.params,task:u};if(l)w.params={...w.params,_meta:{...w.params?._meta||{},[ut]:l}};let f=(d)=>{this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(d)}},{relatedRequestId:o,resumptionToken:t,onresumptiontoken:e}).catch((h)=>this._onerror(Error(`Failed to send cancellation: ${h}`)));let p=d instanceof Z?d:new Z(a.RequestTimeout,String(d));I(p)};this._responseHandlers.set(b,(d)=>{if(r?.signal?.aborted)return;if(d instanceof Error)return I(d);try{let p=ot(i,d.result);if(!p.success)I(p.error);else $(p.data)}catch(p){I(p)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let c=r?.timeout??EJ,S=()=>f(Z.fromError(a.RequestTimeout,"Request timed out",{timeout:c}));this._setupTimeout(b,c,r?.maxTotalTimeout,S,r?.resetTimeoutOnProgress??!1);let k=l?.taskId;if(k){let d=(p)=>{let h=this._responseHandlers.get(b);if(h)h(p);else this._onerror(Error(`Response handler missing for side-channeled request ${b}`))};this._requestResolvers.set(b,d),this._enqueueTaskMessage(k,{type:"request",message:w,timestamp:Date.now()}).catch((p)=>{this._cleanupTimeout(b),I(p)})}else this._transport.send(w,{relatedRequestId:o,resumptionToken:t,onresumptiontoken:e}).catch((d)=>{this._cleanupTimeout(b),I(d)})})}async getTask(n,i){return this.request({method:"tasks/get",params:n},Hl,i)}async getTaskResult(n,i,r){return this.request({method:"tasks/result",params:n},i,r)}async listTasks(n,i){return this.request({method:"tasks/list",params:n},Pl,i)}async cancelTask(n,i){return this.request({method:"tasks/cancel",params:n},ID,i)}async notification(n,i){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(n.method);let r=i?.relatedTask?.taskId;if(r){let u={...n,jsonrpc:"2.0",params:{...n.params,_meta:{...n.params?._meta||{},[ut]:i.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:u,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(n.method)&&!n.params&&!i?.relatedRequestId&&!i?.relatedTask){if(this._pendingDebouncedNotifications.has(n.method))return;this._pendingDebouncedNotifications.add(n.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(n.method),!this._transport)return;let u={...n,jsonrpc:"2.0"};if(i?.relatedTask)u={...u,params:{...u.params,_meta:{...u.params?._meta||{},[ut]:i.relatedTask}}};this._transport?.send(u,i).catch((l)=>this._onerror(l))});return}let e={...n,jsonrpc:"2.0"};if(i?.relatedTask)e={...e,params:{...e.params,_meta:{...e.params?._meta||{},[ut]:i.relatedTask}}};await this._transport.send(e,i)}setRequestHandler(n,i){let r=Lc(n);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,t)=>{let e=Nc(n,o);return Promise.resolve(i(e,t))})}removeRequestHandler(n){this._requestHandlers.delete(n)}assertCanSetRequestHandler(n){if(this._requestHandlers.has(n))throw Error(`A request handler for ${n} already exists, which would be overridden`)}setNotificationHandler(n,i){let r=Lc(n);this._notificationHandlers.set(r,(o)=>{let t=Nc(n,o);return Promise.resolve(i(t))})}removeNotificationHandler(n){this._notificationHandlers.delete(n)}_cleanupTaskProgressHandler(n){let i=this._taskProgressTokens.get(n);if(i!==void 0)this._progressHandlers.delete(i),this._taskProgressTokens.delete(n)}async _enqueueTaskMessage(n,i,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(n,i,r,o)}async _clearTaskQueue(n,i){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(n,i);for(let o of r)if(o.type==="request"&&vc(o.message)){let t=o.message.id,e=this._requestResolvers.get(t);if(e)e(new Z(a.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t);else this._onerror(Error(`Resolver missing for request ${t} during task ${n} cleanup`))}}}async _waitForTaskUpdate(n,i){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(n);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,t)=>{if(i.aborted){t(new Z(a.InvalidRequest,"Request cancelled"));return}let e=setTimeout(o,r);i.addEventListener("abort",()=>{clearTimeout(e),t(new Z(a.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(n,i){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!n)throw Error("No request provided");return await r.createTask(o,n.id,{method:n.method,params:n.params},i)},getTask:async(o)=>{let t=await r.getTask(o,i);if(!t)throw new Z(a.InvalidParams,"Failed to retrieve task: Task not found");return t},storeTaskResult:async(o,t,e)=>{await r.storeTaskResult(o,t,e,i);let u=await r.getTask(o,i);if(u){let l=Mo.parse({method:"notifications/tasks/status",params:u});if(await this.notification(l),lt(u.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>{return r.getTaskResult(o,i)},updateTaskStatus:async(o,t,e)=>{let u=await r.getTask(o,i);if(!u)throw new Z(a.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(lt(u.status))throw new Z(a.InvalidParams,`Cannot update task "${o}" from terminal status "${u.status}" to "${t}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,t,e,i);let l=await r.getTask(o,i);if(l){let $=Mo.parse({method:"notifications/tasks/status",params:l});if(await this.notification($),lt(l.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>{return r.listTasks(o,i)}}}}function DD(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function SD(n,i){let r={...n};for(let o in i){let t=o,e=i[t];if(e===void 0)continue;let u=r[t];if(DD(u)&&DD(e))r[t]={...u,...e};else r[t]=e}return r}var nk=Z4(O6(),1),ik=Z4(sO(),1);function b7(){let n=new nk.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ik.default(n),n}class H6{constructor(n){this._ajv=n??b7()}getValidator(n){let i="$id"in n&&typeof n.$id==="string"?this._ajv.getSchema(n.$id)??this._ajv.compile(n):this._ajv.compile(n);return(r)=>{if(i(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(i.errors)}}}}class X6{constructor(n){this._server=n}requestStream(n,i,r){return this._server.requestStream(n,i,r)}createMessageStream(n,i){let r=this._server.getClientCapabilities();if((n.tools||n.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(n.messages.length>0){let o=n.messages[n.messages.length-1],t=Array.isArray(o.content)?o.content:[o.content],e=t.some((I)=>I.type==="tool_result"),u=n.messages.length>1?n.messages[n.messages.length-2]:void 0,l=u?Array.isArray(u.content)?u.content:[u.content]:[],$=l.some((I)=>I.type==="tool_use");if(e){if(t.some((I)=>I.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!$)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if($){let I=new Set(l.filter((b)=>b.type==="tool_use").map((b)=>b.id)),g=new Set(t.filter((b)=>b.type==="tool_result").map((b)=>b.toolUseId));if(I.size!==g.size||![...I].every((b)=>g.has(b)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:n},xo,i)}elicitInputStream(n,i){let r=this._server.getClientCapabilities(),o=n.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let t=o==="form"&&n.mode===void 0?{...n,mode:"form"}:n;return this.requestStream({method:"elicitation/create",params:t},Wr,i)}async getTask(n,i){return this._server.getTask({taskId:n},i)}async getTaskResult(n,i,r){return this._server.getTaskResult({taskId:n},i,r)}async listTasks(n,i){return this._server.listTasks(n?{cursor:n}:void 0,i)}async cancelTask(n,i){return this._server.cancelTask({taskId:n},i)}}function tk(n,i,r){if(!n)throw Error(`${r} does not support task creation (required for ${i})`);switch(i){case"tools/call":if(!n.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${i})`);break;default:break}}function rk(n,i,r){if(!n)throw Error(`${r} does not support task creation (required for ${i})`);switch(i){case"sampling/createMessage":if(!n.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${i})`);break;case"elicitation/create":if(!n.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${i})`);break;default:break}}class h6 extends yc{constructor(n,i){super(i);if(this._serverInfo=n,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ro.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let t=this._loggingLevels.get(o);return t?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(t):!1},this._capabilities=i?.capabilities??{},this._instructions=i?.instructions,this._jsonSchemaValidator=i?.jsonSchemaValidator??new H6,this.setRequestHandler(gc,(r)=>this._oninitialize(r)),this.setNotificationHandler(bc,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Oc,async(r,o)=>{let t=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:e}=r.params,u=Ro.safeParse(e);if(u.success)this._loggingLevels.set(t,u.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new X6(this)};return this._experimental}registerCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=SD(this._capabilities,n)}setRequestHandler(n,i){let o=Zu(n)?.method;if(!o)throw Error("Schema is missing a method literal");let t;if(Ur(o)){let u=o;t=u._zod?.def?.value??u.value}else{let u=o;t=u._def?.value??u.value}if(typeof t!=="string")throw Error("Schema method literal must be a string");if(t==="tools/call"){let u=async(l,$)=>{let I=ot(Co,l);if(!I.success){let f=I.error instanceof Error?I.error.message:String(I.error);throw new Z(a.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:g}=I.data,b=await Promise.resolve(i(l,$));if(g.task){let f=ot(Gr,b);if(!f.success){let c=f.error instanceof Error?f.error.message:String(f.error);throw new Z(a.InvalidParams,`Invalid task creation result: ${c}`)}return f.data}let w=ot(pl,b);if(!w.success){let f=w.error instanceof Error?w.error.message:String(w.error);throw new Z(a.InvalidParams,`Invalid tools/call result: ${f}`)}return w.data};return super.setRequestHandler(n,u)}return super.setRequestHandler(n,i)}assertCapabilityForMethod(n){switch(n){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${n})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${n})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${n})`);break;case"ping":break}}assertNotificationCapability(n){switch(n){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${n})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${n})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${n})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${n})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(n){if(!this._capabilities)return;switch(n){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${n})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${n})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${n})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${n})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${n})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${n})`);break;case"ping":case"initialize":break}}assertTaskCapability(n){rk(this._clientCapabilities?.tasks?.requests,n,"Client")}assertTaskHandlerCapability(n){if(!this._capabilities)return;tk(this._capabilities.tasks?.requests,n,"Server")}async _oninitialize(n){let i=n.params.protocolVersion;return this._clientCapabilities=n.params.capabilities,this._clientVersion=n.params.clientInfo,{protocolVersion:nD.includes(i)?i:uc,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"},yl)}async createMessage(n,i){if(n.tools||n.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(n.messages.length>0){let r=n.messages[n.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],t=o.some(($)=>$.type==="tool_result"),e=n.messages.length>1?n.messages[n.messages.length-2]:void 0,u=e?Array.isArray(e.content)?e.content:[e.content]:[],l=u.some(($)=>$.type==="tool_use");if(t){if(o.some(($)=>$.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!l)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let $=new Set(u.filter((g)=>g.type==="tool_use").map((g)=>g.id)),I=new Set(o.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if($.size!==I.size||![...$].every((g)=>I.has(g)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(n.tools)return this.request({method:"sampling/createMessage",params:n},kc,i);return this.request({method:"sampling/createMessage",params:n},xo,i)}async elicitInput(n,i){switch(n.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=n;return this.request({method:"elicitation/create",params:o},Wr,i)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=n.mode==="form"?n:{...n,mode:"form"},t=await this.request({method:"elicitation/create",params:o},Wr,i);if(t.action==="accept"&&t.content&&o.requestedSchema)try{let u=this._jsonSchemaValidator.getValidator(o.requestedSchema)(t.content);if(!u.valid)throw new Z(a.InvalidParams,`Elicitation response content does not match requested schema: ${u.errorMessage}`)}catch(e){if(e instanceof Z)throw e;throw new Z(a.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return t}}}createElicitationCompletionNotifier(n,i){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:n}},i)}async listRoots(n,i){return this.request({method:"roots/list",params:n},dc,i)}async sendLoggingMessage(n,i){if(this._capabilities.logging){if(!this.isMessageIgnored(n.level,i))return this.notification({method:"notifications/message",params:n})}}async sendResourceUpdated(n){return this.notification({method:"notifications/resources/updated",params:n})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import ek from"node:process";class P6{append(n){this._buffer=this._buffer?Buffer.concat([this._buffer,n]):n}readMessage(){if(!this._buffer)return null;let n=this._buffer.indexOf(`
|
||
`);if(n===-1)return null;let i=this._buffer.toString("utf8",0,n).replace(/\r$/,"");return this._buffer=this._buffer.subarray(n+1),w7(i)}clear(){this._buffer=void 0}}function w7(n){return vD.parse(JSON.parse(n))}function ok(n){return JSON.stringify(n)+`
|
||
`}class Y6{constructor(n=ek.stdin,i=ek.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new P6,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw 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(){while(!0)try{let n=this._readBuffer.readMessage();if(n===null)break;this.onmessage?.(n)}catch(n){this.onerror?.(n)}}async close(){if(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(n){return new Promise((i)=>{let r=ok(n);if(this._stdout.write(r))i();else this._stdout.once("drain",i)})}}import{dirname as q4,join as JF}from"node:path";import{fileURLToPath as HF}from"node:url";class Ei extends Error{name="KyError";get isKyError(){return!0}}class ti extends Ei{name="HTTPError";response;request;options;data;constructor(n,i,r){let o=n.status||n.status===0?n.status:"",t=n.statusText??"",e=`${o} ${t}`.trim(),u=e?`status code ${e}`:"an unknown error";super(`Request failed with ${u}: ${i.method} ${i.url}`);this.response=n,this.request=i,this.options=r}}class de extends Ei{name="NetworkError";request;constructor(n,i){super(`Request failed due to a network error: ${n.method} ${n.url}`,i);this.request=n}}class Le extends Error{name="NonError";value;constructor(n){let i="Non-error value was thrown";try{if(typeof n==="string")i=n;else if(n&&typeof n==="object"&&"message"in n&&typeof n.message==="string")i=n.message}catch{}super(i);this.value=n}}class qr extends Ei{name="ForceRetryError";customDelay;code;customRequest;constructor(n){let i=n?.cause?n.cause instanceof Error?n.cause:new Le(n.cause):void 0;super(n?.code?`Forced retry: ${n.code}`:"Forced retry",i?{cause:i}:void 0);this.customDelay=n?.delay,this.code=n?.code,this.customRequest=n?.request}}class p6 extends Error{name="SchemaValidationError";issues;constructor(n){super("Response schema validation failed");this.issues=n}}class ki extends Ei{name="TimeoutError";request;constructor(n){super(`Request timed out: ${n.method} ${n.url}`);this.request=n}}var Q6=(()=>{let n=!1,i=!1,r=typeof globalThis.ReadableStream==="function",o=typeof globalThis.Request==="function";if(r&&o)try{i=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&t.message==="unsupported BodyInit type")return!1;throw t}return n&&!i})(),uk=typeof globalThis.AbortController==="function",Sv=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",lk=typeof globalThis.ReadableStream==="function",vk=typeof globalThis.FormData==="function",Av=["get","post","put","patch","head","delete"],f7=()=>{return};f7();var $k={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},_r=2147483647,Ik=40,Ov=Symbol("stop");class kv{options;constructor(n){this.options=n}}var gk=(n)=>new kv(n),bk={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},wk={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var dv=new TextEncoder,c7=(n)=>{if(!n)return 0;if(n instanceof FormData){let i=0;for(let[r,o]of n)i+=Ik,i+=dv.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,i+=typeof o==="string"?dv.encode(o).byteLength:o.size;return i}if(n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof n==="string")return dv.encode(n).byteLength;if(n instanceof URLSearchParams)return dv.encode(n.toString()).byteLength;return 0},fk=(n,i,r)=>{let o,t=0;return n.pipeThrough(new TransformStream({transform(e,u){if(u.enqueue(e),o){t+=o.byteLength;let l=i===0?0:t/i;if(l>=1)l=1-Number.EPSILON;r?.({percent:l,totalBytes:Math.max(i,t),transferredBytes:t},o)}o=e},flush(){if(o)t+=o.byteLength,r?.({percent:1,totalBytes:Math.max(i,t),transferredBytes:t},o)}}))},ck=(n,i)=>{if(!n.body)return n;let r={status:n.status,statusText:n.statusText,headers:n.headers};if(n.status===204)return new Response(null,r);let o=Math.max(0,Number(n.headers.get("content-length"))||0);return new Response(fk(n.body,o,i),r)},Uk=(n,i,r)=>{if(!n.body)return n;let o=c7(r??n.body);return new Request(n,{duplex:"half",body:fk(n.body,o,i)})};var Xi=(n)=>n!==null&&typeof n==="object";var U7=Symbol("replaceOption"),F6=(n)=>Xi(n)&&n[U7]===!0?{isReplace:!0,value:n.value}:{isReplace:!1,value:n};var ye=(...n)=>{for(let i of n)if((!Xi(i)||Array.isArray(i))&&i!==void 0)throw TypeError("The `options` argument must be an object");return V6({},...n)},B6=(n={},i={})=>{let r=new globalThis.Headers(n),o=i instanceof globalThis.Headers,t=new globalThis.Headers(i);for(let[e,u]of t.entries())if(o&&u==="undefined"||u===void 0)r.delete(e);else r.set(e,u);return r},K6=(n)=>{if(!Xi(n)||Array.isArray(n))return!1;let i=Object.getPrototypeOf(n);return i===Object.prototype||i===null},Er=(n)=>{if(n instanceof URLSearchParams){let i=new URLSearchParams(n),r=n[ct];if(r)i[ct]=new Set(r);return i}if(n instanceof globalThis.Headers)return new globalThis.Headers(n);if(Array.isArray(n))return[...n];if(K6(n))return{...n};return n},D7=(n)=>Object.fromEntries(Object.entries(n).filter((i)=>i[1]!==void 0)),S7=(n,i)=>{if(K6(n)&&K6(i))return D7({...n,...i});return B6(n,i)};function Ne(n,i,r){return Object.hasOwn(i,r)&&i[r]===void 0?[]:V6(n[r]??[],i[r]??[])}var Lv=(n={},i={})=>({init:Ne(n,i,"init"),beforeRequest:Ne(n,i,"beforeRequest"),beforeRetry:Ne(n,i,"beforeRetry"),beforeError:Ne(n,i,"beforeError"),afterResponse:Ne(n,i,"afterResponse")}),ct=Symbol("deletedParameters"),A7=(n,i)=>{let r=new URLSearchParams,o=new Set;for(let t of[n,i]){if(t===void 0)continue;if(t instanceof URLSearchParams){for(let[u,l]of t.entries())r.append(u,l),o.delete(u);let e=t[ct];if(e)for(let u of e)r.delete(u),o.add(u)}else if(Array.isArray(t))for(let e of t){if(!Array.isArray(e)||e.length!==2)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1])),o.delete(String(e[0]))}else if(Xi(t))for(let[e,u]of Object.entries(t))if(u===void 0)r.delete(e),o.add(e);else r.append(e,String(u)),o.delete(e);else{let e=new URLSearchParams(t);for(let[u,l]of e.entries())r.append(u,l),o.delete(u)}}if(o.size>0)r[ct]=o;return r},V6=(...n)=>{let i={},r={},o={},t,e=[];for(let u of n)if(Array.isArray(u)){if(!Array.isArray(i))i=[];i=[...i,...u]}else if(Xi(u)){for(let[l,$]of Object.entries(u)){if(l==="signal"&&$ instanceof globalThis.AbortSignal){e.push($);continue}let I=F6($),{isReplace:g}=I;if($=I.value,l==="context"){if($!==void 0&&$!==null&&(!Xi($)||Array.isArray($)))throw TypeError("The `context` option must be an object");i={...i,context:$===void 0||$===null?{}:g?{...$}:{...i.context,...$}};continue}if(l==="searchParams"){if($===void 0||$===null)t=void 0;else if(g)t=$;else t=t===void 0?$:A7(t,$);continue}if(Xi($)&&!g&&l in i)$=V6(i[l],$);i={...i,[l]:$}}if(Xi(u.hooks)){let{value:l,isReplace:$}=F6(u.hooks);o=$?Lv({},l):Lv(o,l),i.hooks=o}if(Xi(u.headers)){let{value:l,isReplace:$}=F6(u.headers);r=$?Er(l):S7(r,l),i.headers=r}}if(t!==void 0)i.searchParams=t;if(e.length>0)if(e.length===1)i.signal=e[0];else if(Sv)i.signal=AbortSignal.any(e);else i.signal=e.at(-1);return i};var Sk=(n)=>Av.includes(n)?n.toUpperCase():n,O7=["get","put","head","delete","options","trace"],k7=[408,413,429,500,502,503,504],d7=[413,429,503],Dk={limit:2,methods:O7,statusCodes:k7,afterStatusCodes:d7,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:(n)=>0.3*2**(n-1)*1000,jitter:void 0,retryOnTimeout:!1},Ak=(n={})=>{if(typeof n==="number")return{...Dk,limit:n};if(n.methods&&!Array.isArray(n.methods))throw Error("retry.methods must be an array");if(n.statusCodes&&!Array.isArray(n.statusCodes))throw Error("retry.statusCodes must be an array");let i=Object.fromEntries(Object.entries({...n,methods:n.methods?.map((r)=>r.toLowerCase())}).filter(([,r])=>r!==void 0));return{...Dk,...i}};async function T6(n,i,r,o){return new Promise((t,e)=>{let u=setTimeout(()=>{if(r)r.abort();e(new ki(n))},o.timeout);o.fetch(n,i).then(t).catch(e).then(()=>{clearTimeout(u)})})}async function Nv(n,{signal:i}){return new Promise((r,o)=>{if(i)i.throwIfAborted(),i.addEventListener("abort",t,{once:!0});function t(){clearTimeout(e),o(i.reason)}let e=setTimeout(()=>{i?.removeEventListener("abort",t),r()},n)})}var Ok=(n)=>{let i={};for(let r in n){if(!Object.hasOwn(n,r))continue;if(!(r in wk)&&!(r in bk))i[r]=n[r]}return i},kk=(n)=>{if(n===void 0)return!1;if(Array.isArray(n))return n.length>0;if(n instanceof URLSearchParams)return n.size>0||Boolean(n[ct]?.size);if(typeof n==="object")return Object.keys(n).length>0;if(typeof n==="string")return n.trim().length>0;return Boolean(n)};var L7=Object.prototype.toString,N7=(n)=>L7.call(n)==="[object Error]",y7=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function q6(n){if(!(n&&N7(n)&&n.name==="TypeError"&&typeof n.message==="string"))return!1;let{message:r,stack:o}=n;if(r==="Load failed")return o===void 0||"__sentry_captured__"in n;if(r.startsWith("error sending request for url"))return!0;if(r==="Failed to fetch"||r.startsWith("Failed to fetch (")&&r.endsWith(")"))return!0;return y7.has(r)}var _6=(n,i)=>n instanceof i||n?.name===i.name;function dk(n){return _6(n,ti)}function Lk(n){return _6(n,de)}function Nk(n){return _6(n,ki)}var G7=10485760,j7="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",Ge=Symbol("timedOutResponseData"),W7=(n)=>{let i=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(n),r=i?.[1]??i?.[2];if(r)try{return new TextDecoder(r)}catch{}return new TextDecoder},yk="The `schema` argument must follow the Standard Schema specification",J7=(n)=>{if(typeof n!=="object")return n;return{...n,...n.methods&&{methods:[...n.methods]},...n.statusCodes&&{statusCodes:[...n.statusCodes]},...n.afterStatusCodes&&{afterStatusCodes:[...n.afterStatusCodes]}}},Wk=Object.prototype.toString,Gk=(n)=>n instanceof globalThis.Request||Wk.call(n)==="[object Request]",je=(n)=>n instanceof globalThis.Response||Wk.call(n)==="[object Response]",H7=(n)=>{if(Array.isArray(n))return n.map((i)=>[...i]);return Er(n)};function X7(n){let i={...n,json:Er(n.json),context:Er(n.context),headers:Er(n.headers),searchParams:H7(n.searchParams)};if(n.retry!==void 0)i.retry=J7(n.retry);return i}var jk=async(n,i)=>{if(typeof i!=="object"&&typeof i!=="function"||i===null)throw TypeError(yk);let r=i["~standard"];if(typeof r!=="object"||r===null||typeof r.validate!=="function")throw TypeError(yk);let o=await r.validate(n);if(o.issues)throw new p6(o.issues);return o.value};class Zr{static create(n,i){let r=i.hooks?.init??[],o=r.length>0?X7(i):i;for(let l of r)l(o);let t=new Zr(n,o),e=async()=>{if(typeof t.#n.timeout==="number"&&t.#n.timeout>_r)throw RangeError(`The \`timeout\` option cannot be greater than ${_r}`);if(typeof t.#n.totalTimeout==="number"&&t.#n.totalTimeout>_r)throw RangeError(`The \`totalTimeout\` option cannot be greater than ${_r}`);await Promise.resolve();let l=await t.#Y(),$=l??await t.#G(async()=>t.#D()),I=l!==void 0||t.#U();for(;;){if($===void 0)return $;if(je($))try{$=await t.#p($)}catch(b){if(!(b instanceof qr))throw b;let w=await t.#c(b,async()=>t.#D());if(w===void 0)return w;$=w,I=t.#U();continue}let g=$;if(!g.ok&&g.type!=="opaque"&&(typeof t.#n.throwHttpErrors==="function"?t.#n.throwHttpErrors(g.status):t.#n.throwHttpErrors)){let b=new ti(g,t.#l(g),t.#u()),w=b;if(b.data=await t.#H(g),I)throw w;let f=await t.#c(b,async()=>t.#D());if(f===void 0)return f;$=f,I=t.#U();continue}break}if(!je($))return $;if(t.#L($),t.#n.onDownloadProgress){if(typeof t.#n.onDownloadProgress!=="function")throw TypeError("The `onDownloadProgress` option must be a function");if(!lk)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let g=$.clone();return t.#r($),ck(g,t.#n.onDownloadProgress)}return $},u=(async()=>{try{return await e()}catch(l){if(!(l instanceof Error))throw l;if(t.#k.has(l))throw l;let $=l;for(let I of t.#n.hooks.beforeError){let g=await I({request:t.request,options:t.#u(),error:$,retryCount:t.#t});if(g instanceof Error)$=g}throw $}finally{let l=t.#O;if(t.#f(l?.body??void 0),t.request!==l)t.#f(t.request.body??void 0)}})();for(let[l,$]of Object.entries($k)){if(l==="bytes"&&typeof globalThis.Response?.prototype?.bytes!=="function")continue;u[l]=async(I)=>{t.request.headers.set("accept",t.request.headers.get("accept")||$);let g=await u;if(l!=="json")return g[l]();let b=await g.text();if(b===""){if(I!==void 0)return jk(void 0,I);return JSON.parse(b)}let w=o.parseJson?await o.parseJson(b,{request:t.#l(g),response:g}):JSON.parse(b);return I===void 0?w:jk(w,I)}}return u}static#W(n){if(n&&typeof n==="object"&&!Array.isArray(n)&&!(n instanceof URLSearchParams))return Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0));return n}request;#o;#t=0;#i;#n;#O;#v;#k=new WeakSet;#$;#w;#I=!1;#d=new WeakMap;constructor(n,i={}){if(this.#i=n,Object.hasOwn(i,"prefixUrl"))throw Error(j7);if(this.#n={...i,headers:B6(this.#i.headers,i.headers),hooks:Lv({},i.hooks),method:Sk(i.method??this.#i.method??"GET"),prefix:String(i.prefix||""),retry:Ak(i.retry),throwHttpErrors:i.throwHttpErrors??!0,timeout:i.timeout??1e4,totalTimeout:i.totalTimeout??!1,fetch:i.fetch??globalThis.fetch.bind(globalThis),context:i.context??{}},typeof this.#i!=="string"&&!(this.#i instanceof URL||this.#i instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(typeof this.#i==="string"){if(this.#n.prefix){let o=this.#n.prefix.replace(/\/+$/,""),t=this.#i.replace(/^\/+/,"");this.#i=`${o}/${t}`}if(this.#n.baseUrl){let o;try{o=new URL(this.#i)}catch{}if(!o)this.#i=new URL(this.#i,new Request(this.#n.baseUrl).url)}}if(uk&&Sv)this.#v=this.#n.signal??this.#i.signal,this.#o=new globalThis.AbortController,this.#n.signal=this.#y();if(Q6)this.#n.duplex="half";if(this.#n.json!==void 0)this.#n.body=this.#n.stringifyJson?.(this.#n.json)??JSON.stringify(this.#n.json),this.#n.headers.set("content-type",this.#n.headers.get("content-type")??"application/json");let r=i.headers&&new globalThis.Headers(i.headers).has("content-type");if(this.#i instanceof globalThis.Request&&(vk&&this.#n.body instanceof globalThis.FormData||this.#n.body instanceof URLSearchParams)&&!r)this.#n.headers.delete("content-type");if(this.request=new globalThis.Request(this.#i,this.#n),kk(this.#n.searchParams)){let o=new URL(this.request.url),t=this.#n.searchParams?.[ct];if(t)for(let e of t)o.searchParams.delete(e);if(typeof this.#n.searchParams==="string"){let e=this.#n.searchParams.replace(/^\?/,"");if(e!=="")o.search=o.search?`${o.search}&${e}`:`?${e}`}else{let e=new URLSearchParams(Zr.#W(this.#n.searchParams));for(let[u,l]of e.entries())o.searchParams.append(u,l)}if(this.#n.searchParams&&typeof this.#n.searchParams==="object"&&!Array.isArray(this.#n.searchParams)&&!(this.#n.searchParams instanceof URLSearchParams)){for(let[e,u]of Object.entries(this.#n.searchParams))if(u===void 0)o.searchParams.delete(e)}this.request=new globalThis.Request(o,this.#n)}if(this.#n.onUploadProgress&&typeof this.#n.onUploadProgress!=="function")throw TypeError("The `onUploadProgress` option must be a function");this.#w=typeof this.#n.totalTimeout==="number"?this.#j():void 0}#e(){let n=this.#n.retry.delay(this.#t+1),i=n;if(this.#n.retry.jitter===!0)i=Math.random()*n;else if(typeof this.#n.retry.jitter==="function"){if(i=this.#n.retry.jitter(n),!Number.isFinite(i)||i<0)i=n}return Math.min(this.#n.retry.backoffLimit,i)}async#J(n){if(this.#t>=this.#n.retry.limit)throw n;let i=n instanceof Error?n:new Le(n);if(i instanceof qr)return i.customDelay??this.#e();if(!this.#n.retry.methods.includes(this.request.method.toLowerCase()))throw n;if(this.#n.retry.shouldRetry!==void 0){let r=await this.#n.retry.shouldRetry({error:i,retryCount:this.#t+1});if(r===!1)throw n;if(r===!0)return this.#e()}if(Nk(n)){if(!this.#n.retry.retryOnTimeout)throw n;return this.#e()}if(dk(n)){if(!this.#n.retry.statusCodes.includes(n.response.status))throw n;let r=n.response.headers.get("Retry-After")??n.response.headers.get("RateLimit-Reset")??n.response.headers.get("X-RateLimit-Retry-After")??n.response.headers.get("X-RateLimit-Reset")??n.response.headers.get("X-Rate-Limit-Reset");if(r&&this.#n.retry.afterStatusCodes.includes(n.response.status)){let o=Number(r)*1000;if(Number.isNaN(o))o=Date.parse(r)-Date.now();else if(o>=Date.parse("2024-01-01"))o-=Date.now();if(!Number.isFinite(o))return Math.min(this.#n.retry.maxRetryAfter,this.#e());return o=Math.max(0,o),Math.min(this.#n.retry.maxRetryAfter,o)}if(n.response.status===413)throw n;return this.#e()}if(!Lk(n))throw n;return this.#e()}#L(n){let i=this.#l(n);if(this.#n.parseJson)n.json=async()=>{let r=await n.text();if(r==="")return JSON.parse(r);return this.#n.parseJson(r,{request:i,response:n})};return n}async#H(n){let i=await this.#h(n,this.#N());if(i===Ge){this.#g();return}if(!i)return;if(!this.#X(n.headers.get("content-type")??""))return i;let r=await this.#P(i,n,this.#N(),this.#l(n));if(r===Ge){this.#g();return}return r}#N(){let n=this.#n.timeout===!1?1e4:this.#n.timeout,i=this.#b();if(i===void 0)return n;if(i<=0)throw new ki(this.request);return Math.min(n,i)}#X(n){let i=(n.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(i)}async#h(n,i){let{body:r}=n;if(!r)try{return await n.text()}catch{return}let o;try{o=r.getReader()}catch{return}let t=W7(n.headers.get("content-type")??""),e=[],u=0,l=(async()=>{try{for(;;){let{done:g,value:b}=await o.read();if(g)break;if(u+=b.byteLength,u>G7){o.cancel().catch(()=>{return});return}e.push(t.decode(b,{stream:!0}))}}catch{return}return e.push(t.decode()),e.join("")})(),$=new Promise((g)=>{let b=setTimeout(()=>{g(Ge)},i);l.finally(()=>{clearTimeout(b)})}),I=await Promise.race([l,$]);if(I===Ge)o.cancel().catch(()=>{return});return I}async#P(n,i,r,o){let t;try{return await Promise.race([Promise.resolve().then(()=>this.#n.parseJson?this.#n.parseJson(n,{request:o,response:i}):JSON.parse(n)),new Promise((e)=>{t=setTimeout(()=>{e(Ge)},r)})])}catch{return}finally{clearTimeout(t)}}#f(n){if(!n)return;n.cancel().catch(()=>{return})}#r(n){this.#f(n.body??void 0)}#y(){return this.#v?AbortSignal.any([this.#v,this.#o.signal]):this.#o.signal}#g(){let n=this.#b();if(n!==void 0&&n<=0)throw new ki(this.request)}async#Y(){for(let n of this.#n.hooks.beforeRequest){let i=await n({request:this.request,options:this.#u(),retryCount:0});if(Gk(i))this.#S(i);else if(je(i))return i}return}async#p(n){let i=this.#l(n);for(let r of this.#n.hooks.afterResponse){let o=this.#A(n.clone(),i);this.#L(o);let t;try{t=await r({request:this.request,options:this.#u(),response:o,retryCount:this.#t})}catch(u){if(o!==n)this.#r(o);throw this.#r(n),u}if(t instanceof kv){if(o!==n)this.#r(o);throw this.#r(n),new qr(t.options)}let e=je(t)?this.#A(t,i):n;if(o!==n&&o!==e&&o.body!==e.body)this.#r(o);if(n!==e&&n.body!==e.body)this.#r(n);n=e}return n}async#G(n){try{return await n()}catch(i){return this.#c(i,n)}}async#c(n,i){this.#I=!1;let r=Math.min(await this.#J(n),_r),o={signal:this.#v},t=this.#b();if(t!==void 0){if(t<=0)throw new ki(this.request);if(r>=t)throw await Nv(t,o),new ki(this.request)}if(await Nv(r,o),this.#g(),n instanceof qr&&n.customRequest){let e=new globalThis.Request(n.customRequest,this.#n.signal?{signal:this.#n.signal}:void 0);this.#S(e)}for(let e of this.#n.hooks.beforeRetry){let u;try{u=await e({request:this.request,options:this.#u(),error:n,retryCount:this.#t+1})}catch(l){if(l instanceof Error&&l!==n)this.#k.add(l);throw l}if(Gk(u)){this.#S(u);break}if(je(u))return this.#I=!0,this.#t++,u;if(u===Ov)return}return this.#g(),this.#t++,this.#G(i)}#U(){let n=this.#I;return this.#I=!1,n}async#D(){if(this.#o?.signal.aborted)this.#o=new globalThis.AbortController,this.#n.signal=this.#y(),this.request=new globalThis.Request(this.request,{signal:this.#n.signal});let n=Ok(this.#n),i=this.#n.retry.limit>0?this.request.clone():void 0,r=this.#Q(this.request,this.#n.body??void 0);if(this.#O=r,i)this.request=i;try{let o=this.#b();if(o!==void 0&&o<=0)throw new ki(this.request);let t=this.#n.timeout===!1?o:o===void 0?this.#n.timeout:Math.min(this.#n.timeout,o),e=t===void 0?await this.#n.fetch(r,n):await T6(r,n,this.#o,{timeout:t,fetch:this.#n.fetch});return this.#A(e,r)}catch(o){if(q6(o))throw new de(this.request,{cause:o});throw o}}#b(){if(this.#w===void 0)return;let n=this.#j()-this.#w;return Math.max(0,this.#n.totalTimeout-n)}#j(){return globalThis.performance?.now()??Date.now()}#u(){if(!this.#$){let{hooks:n,json:i,parseJson:r,stringifyJson:o,searchParams:t,timeout:e,totalTimeout:u,throwHttpErrors:l,fetch:$,...I}=this.#n;this.#$=Object.freeze(I)}return this.#$}#S(n){this.#$=void 0,this.request=n}#l(n){return this.#d.get(n)??this.request}#A(n,i){return this.#d.set(n,i),n}#Q(n,i){if(!this.#n.onUploadProgress||!n.body||!Q6)return n;return Uk(n,this.#n.onUploadProgress,i??this.#n.body??void 0)}}/*! MIT License © Sindre Sorhus */var E6=(n)=>{let i=(r,o)=>Zr.create(r,ye(n,o));for(let r of Av)i[r]=(o,t)=>Zr.create(o,ye(n,t,{method:r}));return i.create=(r)=>E6(ye(r)),i.extend=(r)=>{if(typeof r==="function")r=r(n??{});return E6(ye(n,r))},i.stop=Ov,i.retry=gk,i},h7=E6(),Zi=h7;async function Jk(n){if(n.source.type!=="direct"&&n.source.type!=="seal")throw Error(`Unsupported Seal source: ${n.source.type}`);let i=n.seal.url??n.source.sealUrl,r=n.source.type==="seal"?n.source:void 0;return{token:n.source.token,expiresAt:Date.now()+n.source.expiresIn*1000,enterprise:{provider:r?"seal":"direct",corpId:n.source.corpId??n.id,staffId:n.source.staffId,sealUrl:i,tenantId:r?.tenantId,tenantSlug:n.seal.tenantSlug??r?.tenantSlug,tenantName:r?.tenantName,raw:{sourceType:n.source.type}}}}import{existsSync as F7,mkdirSync as K7,readFileSync as B7,writeFileSync as V7}from"node:fs";import{dirname as T7,join as q7}from"node:path";import{homedir as _7}from"node:os";var Hk=v.object({token:v.string(),expiresAt:v.number(),url:v.string().url().optional()}),P7=v.object({provider:v.string(),corpId:v.string().optional(),staffId:v.string(),sealUrl:v.string().url(),tenantId:v.string().optional(),tenantSlug:v.string().optional(),tenantName:v.string().optional(),raw:v.unknown().optional()}),Y7=v.object({token:v.string(),expiresAt:v.number(),enterprise:P7}),p7=v.object({openapi:Hk.optional(),closeapi:Hk.optional()}),Q7=v.object({seal:Y7.optional(),hose:p7.optional()}),Xk=v.record(v.string(),Q7);function hk(){return process.env.SEAL_HOME_TOKEN_STORE??q7(_7(),".config","seal-home","seal_tokens.json")}function mr(){let n=hk();if(!F7(n))return{};try{return Xk.parse(JSON.parse(B7(n,"utf-8")))}catch{return{}}}function yv(n){let i=hk();K7(T7(i),{recursive:!0}),V7(i,JSON.stringify(n,null,2))}function Pk(n){return mr()[n]?.seal}function Yk(n,i){let r=mr();yv({...r,[n]:{...r[n],seal:i}})}function pk(n){let i=mr(),r=i[n];if(!r)return;yv({...i,[n]:{...r,seal:void 0}})}function We(n){return mr()[n]?.hose??{}}function Z6(n,i){let r=mr();yv({...r,[n]:{...r[n],hose:i}})}function Gv(n){let i=mr();delete i[n],yv(i)}var E7=["https://app.ekuaibao.com","https://dd2.hosecloud.com","https://wx2.ekuaibao.com","https://kdcloud2.ekuaibao.com","https://ddenterprise.ekuaibao.com","https://feishu.ekuaibao.com"],Z7=[".ekuaibao.com",".hosecloud.com"],m7="/web/thirdparty.html",Fk=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,m6=new Map,M6=new Map;function di(n){return n.replace(/\/+$/,"")}function M7(n){let i;try{i=new URL(n.trim())}catch{throw Error("Invalid Hose assistance link: expected a valid HTTPS URL")}if(i.protocol!=="https:"||i.port||!z7(i.hostname)||i.pathname.replace(/\/+$/,"")!==m7)throw Error("Invalid Hose assistance link: expected an HTTPS */web/thirdparty.html URL from ekuaibao.com or hosecloud.com");let r=i.searchParams.getAll("accessToken").filter(Boolean),o=i.searchParams.getAll("ekbCorpId").filter(Boolean);if(r.length!==1||o.length!==1)throw Error("Invalid Hose assistance link: accessToken and ekbCorpId are required exactly once");let t=o[0].trim().toLowerCase();if(!Fk.test(t))throw Error("Invalid Hose assistance link: ekbCorpId is not a valid tenant slug");return{corpId:t,accessToken:r[0]}}async function jv(n){let i=typeof n==="string"?M7(n):C7(n),r=`https://${i.corpId}.sealai.cc`,o=await Zi.get(`${r}/api/auth/oauth2/session/oem-hosecloud`,{searchParams:{token:i.accessToken,returnToken:"1"},timeout:30000}).json(),t=o.token??o.accessToken??o.data?.token??o.data?.accessToken;if(!t)throw Error("Seal SSO did not return a bearer token");let e=o.expiresIn??o.expires_in??o.data?.expiresIn??o.data?.expires_in??3600;return{corpId:i.corpId,sealUrl:r,token:t,expiresIn:Number.isFinite(e)&&e>0?e:3600}}function Wv(n,i){let r=i.hoseCorpConfig&&typeof i.hoseCorpConfig==="object"?i.hoseCorpConfig:void 0,o=[i.tenantSlug,r?.corporationId].filter((t)=>typeof t==="string"&&Boolean(t));if(o.length>0&&!o.some((t)=>t.toLowerCase()===n))throw Error("Hose assistance link tenant mismatch: the Seal tenant does not match ekbCorpId")}function z7(n){let i=n.toLowerCase();return Z7.some((r)=>i.endsWith(r))}function C7(n){let i=typeof n?.corpId==="string"?n.corpId.trim().toLowerCase():"",r=typeof n?.accessToken==="string"?n.accessToken.trim():"";if(!Fk.test(i)||!r)throw Error("Invalid Hose assistance link: accessToken and ekbCorpId are required");return{corpId:i,accessToken:r}}function Kk(n,i=60){return Boolean(n&&Date.now()<n.expiresAt-i*1000)}function Je(n,i){if(n.seal.url)return n.seal.url;if(i.sealUrl)return i.sealUrl;return`https://${i.corpId.toLowerCase()}.sealai.cc`}function R7(n){return n.staffId.includes(":")?n.staffId:`${n.corpId}:${n.staffId}`}function Bk(n){return Zi.create({prefix:di(n.domain),timeout:30000,hooks:{beforeError:[async({error:i})=>{let r=i instanceof ti?await i.response.text().catch(()=>""):"";return i.message=`${i.message}${r?`: ${r}`:""}`,i}]}})}async function x7(n){let i=Bk(n),r=n.appKey??n.key,o=n.appSecurity??n.password;if(!r||!o)throw Error("Hose source requires appKey/key and appSecurity/password");let t=await i.post("api/openapi/v1/auth/getAccessToken",{json:{appKey:r,appSecurity:o}}).json(),e=t.value?.accessToken??t.accessToken??t.token;if(!e)throw Error("Hose login did not return an access token");return{token:e,expiresAt:Date.now()+3600000}}async function Jv(n){if(n.source.type!=="hose")throw Error(`Unsupported Seal source: ${n.source.type}`);let i=We(n.id);if(Kk(i.openapi))return i.openapi.token;let r=m6.get(n.id);if(r)return r;let o=x7(n.source).then((t)=>{return Z6(n.id,{...We(n.id),openapi:t}),t.token}).finally(()=>m6.delete(n.id));return m6.set(n.id,o),o}async function Hv(n,i,r=7200){let o=Bk(n),t=R7(n),u=(await o.post("api/openapi/v1.1/provisional/getProvisionalAuth",{searchParams:{accessToken:i},json:{uid:t,pageType:"home",expireDate:r}}).json()).value?.message;if(!u)throw Error("Hose CloseAPI did not return a provisional auth URL");let l=new URL(u).searchParams.get("accessToken");if(!l)throw Error("Hose provisional auth URL did not include accessToken");return{token:l,url:u,expiresAt:Date.now()+r*1000}}async function Vk(n){if(n.source.type!=="hose")throw Error(`Unsupported Seal source: ${n.source.type}`);let i=n.source,r=We(n.id);if(Kk(r.closeapi)&&r.closeapi.url)return r.closeapi;let o=M6.get(n.id);if(o)return o;let t=Jv(n).then((e)=>Hv(i,e)).then((e)=>{return Z6(n.id,{...We(n.id),closeapi:e}),e}).finally(()=>M6.delete(n.id));return M6.set(n.id,t),t}async function Tk(n){if(n.source.type!=="hose")throw Error(`Unsupported Seal source: ${n.source.type}`);let i=(await Vk(n)).url;if(!i)throw Error("Hose provisional auth URL was not available");return i}async function qk(n,i=7200){if(n.source.type!=="hose")throw Error(`Unsupported Seal source: ${n.source.type}`);let r=await Jv(n),o=await Hv(n.source,r,i);if(!o.url)throw Error("Hose provisional auth URL was not available");return{corpId:n.source.corpId,staffId:n.source.staffId,url:o.url,expiresIn:i}}async function _k(n){if(n.source.type!=="hose")throw Error(`Unsupported Seal source: ${n.source.type}`);let i=await Vk(n),r=Je(n,n.source),o=await Zi.get(`${di(r)}/api/auth/oauth2/session/oem-hosecloud`,{searchParams:{token:i.token,returnToken:"1"},timeout:30000}).json(),t=o.token??o.accessToken??o.data?.token??o.data?.accessToken;if(!t)throw Error("Seal SSO did not return a bearer token");let e=o.expiresIn??o.expires_in??o.data?.expiresIn??o.data?.expires_in??3600,u={provider:"hose",corpId:n.source.corpId,staffId:n.source.staffId,sealUrl:di(r),tenantSlug:n.seal.tenantSlug,raw:{sourceType:"hose",hoseDomain:di(n.source.domain)}};return{token:t,expiresAt:Date.now()+e*1000,enterprise:u}}async function Xv(n,i,r){if(r){let u=di(r),l=await Qk(u,n,i);if(!l)throw Error(`Failed to authenticate on specified domain: ${u}. Please verify appKey/appSecurity and domain connectivity.`);return l}let o=E7.map(async(u)=>{try{return await Qk(u,n,i)}catch{return}}),e=(await Promise.all(o)).filter((u)=>Boolean(u));if(e.length>0&&e[0])return e[0];throw Error("Failed to authenticate with appKey/appSecurity on all 6 standard Hose domains (app.ekuaibao.com, dd2.hosecloud.com, wx2.ekuaibao.com, kdcloud2.ekuaibao.com, ddenterprise.ekuaibao.com, feishu.ekuaibao.com). "+'If your enterprise uses a private cloud or custom domain (such as 美年大健康), please specify the "domain" parameter explicitly.')}async function Qk(n,i,r){try{let o=await fetch(`${n}/api/openapi/v1/auth/getAccessToken`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({appKey:i,appSecurity:r}),signal:AbortSignal.timeout(8000)});if(!o.ok)return;let t=await o.json();if(t.value?.errorCode)return;let e=t.value?.accessToken??t.accessToken,u=t.value?.corporationId??t.value?.corporation?.id;if(!e||!u)return;return{domain:n,corpId:u,corpName:t.value?.corporation?.name,openapiToken:e,expireTime:t.value?.expireTime}}catch{return}}async function hv(n,i){let r=`${di(n)}/api/openapi/v1/roleDefGroups?accessToken=${encodeURIComponent(i)}`,o=await fetch(r,{headers:{"content-type":"application/json",Accept:"application/json"},signal:AbortSignal.timeout(1e4)});if(!o.ok){let u=await o.text().catch(()=>"");throw Error(`Failed to fetch Hose role definition groups: ${o.status} ${u}`)}return((await o.json()).items??[]).map((u)=>({id:u.id,name:u.name,enName:u.enName,roleDefs:(u.roleDefs??[]).map((l)=>({id:l.id,name:l.name,enName:l.enName,sourceType:l.sourceType,sourceTypeValue:l.sourceTypeValue,groupId:u.id,groupName:u.name}))}))}async function z6(n,i,r,o="id"){let t=r.startsWith("$")?r.slice(1):r,e=`${di(n)}/api/openapi/v1/roledefs/$${t}?accessToken=${encodeURIComponent(i)}&staffBy=${encodeURIComponent(o)}&pathType=name`,u=await fetch(e,{headers:{"content-type":"application/json",Accept:"application/json"},signal:AbortSignal.timeout(1e4)});if(!u.ok){let g=await u.text().catch(()=>"");throw Error(`Failed to fetch Hose role staffs for ${t}: ${u.status} ${g}`)}let $=(await u.json()).value;if(!$)throw Error(`Hose role staff query returned empty result for ${t}`);let I=[];for(let g of $.contents??[])for(let b of g.staffs??[])if(b&&!I.includes(b))I.push(b);return{id:$.id??t,name:$.name??"",count:$.count??I.length,staffs:I}}async function C6(n,i,r){if(r.length===0)return[];let o=`${di(n)}/api/openapi/v1/staffs/getStaffIds?accessToken=${encodeURIComponent(i)}`,t=await fetch(o,{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({type:"STAFFID",conditionIds:r.slice(0,100)}),signal:AbortSignal.timeout(1e4)});if(!t.ok){let u=await t.text().catch(()=>"");throw Error(`Failed to fetch Hose staff details: ${t.status} ${u}`)}return(await t.json()).items??[]}var Pv=new Map;function Ek(n,i){return Date.now()>=n.expiresAt-i*1000}async function a7(n){switch(n.source.type){case"hose":return _k(n);case"direct":case"seal":return Jk(n)}}async function Yv(n){let i=n.auth.refreshTtl,r=Pv.get(n.id);if(r&&!Ek(r,i))return r;let o=Pk(n.id);if(o&&!Ek(o,i))return Pv.set(n.id,o),o;let t=await a7(n);return Pv.set(n.id,t),Yk(n.id,t),t}async function Zk(n){return(await Yv(n)).enterprise}function mk(n){Pv.delete(n),pk(n)}async function An(n){let i=await Yv(n);return Zi.create({prefix:i.enterprise.sealUrl,timeout:30000,headers:{Authorization:`Bearer ${i.token}`},hooks:{beforeError:[async({error:r})=>{if(r instanceof ti&&r.response.status===401)mk(n.id);let o=r instanceof ti?await r.response.text().catch(()=>""):"";return r.message=`${r.message}${o?`: ${o}`:""}`,r}]}})}async function Mk(n,i){let r=await Yv(n);return He(r.enterprise.sealUrl,i)}function He(n,i){return Zi.create({prefix:n.replace(/\/+$/,""),timeout:30000,headers:{Authorization:`Bearer ${i}`},hooks:{beforeError:[async({error:r})=>{let o=r instanceof ti?await r.response.text().catch(()=>""):"";return r.message=`${r.message}${o?`: ${o}`:""}`,r}]}})}var zk={name:"seal-home",version:"0.9.8",type:"module",module:"src/server.ts",bin:{"seal-home":"src/cli.ts"},scripts:{dev:"bun run --watch src/server.ts",start:"bun run src/server.ts",probe:"bun run src/probe.ts",cli:"bun run src/cli.ts",check:"tsc --noEmit","build:binary":"node scripts/build-binary.mjs","build:plugin":"node scripts/build-plugin.mjs",bump:"bun run scripts/bump-version.ts","openapi:bundle":"bun run scripts/bundle-openapi.ts","openapi:raw":"bun run scripts/generate-raw-openapi.ts",test:"bun test"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0",ky:"^2.0.2",zod:"^4.4.3"},devDependencies:{"@types/bun":"^1.3.14","bun-types":"^1.3.14",typescript:"^5.9.3",yaml:"^2.9.0"}};var R=zk.version;import{existsSync as R6,mkdirSync as u5,readFileSync as Rk,readdirSync as l5,writeFileSync as v5}from"node:fs";import{homedir as xk}from"node:os";import{dirname as $5,join as x6}from"node:path";var n5=v.object({type:v.literal("hose"),domain:v.string().url().default("https://app.ekuaibao.com"),appKey:v.string().optional(),appSecurity:v.string().optional(),key:v.string().optional(),password:v.string().optional(),staffId:v.string(),corpId:v.string(),sealUrl:v.string().url().optional()}).superRefine((n,i)=>{if(!n.appKey&&!n.key)i.addIssue({code:"custom",path:["appKey"],message:"Hose source requires appKey or key"});if(!n.appSecurity&&!n.password)i.addIssue({code:"custom",path:["appSecurity"],message:"Hose source requires appSecurity or password"})}),i5=v.object({type:v.literal("direct"),token:v.string(),sealUrl:v.string().url(),expiresIn:v.number().int().positive().default(3600),staffId:v.string().default("direct"),corpId:v.string().optional()}),t5=v.object({type:v.literal("seal"),token:v.string(),sealUrl:v.string().url(),expiresIn:v.number().int().positive().default(3600),staffId:v.string().default("seal"),corpId:v.string().optional(),tenantId:v.string().optional(),tenantSlug:v.string().optional(),tenantName:v.string().optional(),providerUserId:v.string().optional(),provider:v.string().optional(),providerName:v.string().optional()}),r5=v.discriminatedUnion("type",[n5,i5,t5]),o5=v.object({url:v.string().url().optional(),tenantSlug:v.string().optional(),endpoints:v.object({approvalStylePreferences:v.string().default("api/v1/agent/ai-approval/config")}).default({approvalStylePreferences:"api/v1/agent/ai-approval/config"})}).default({endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}}),e5=v.object({refreshTtl:v.number().int().positive().default(300)}).default({refreshTtl:300}),Ck=v.object({id:v.string(),name:v.string(),seal:o5,source:r5,auth:e5}),pv=v.object({stateful:v.boolean().default(!1),defaultCorpId:v.string().min(1).optional()});var ak="enterprises",a6="SEAL_HOME_ENTERPRISES_DIR",I5="SEAL_HOME_USER_ENTERPRISES_DIR",g5="SEAL_HOME_CONFIG_FILE",b5=x6(xk(),".config","seal-home","config.json"),s6=x6(xk(),".config","seal-home","enterprises");function hi(){let n=w5(),i=new Map;for(let r of n)for(let o of l5(r).filter((t)=>t.endsWith(".json")).filter((t)=>!t.startsWith("example."))){let t=Rk(x6(r,o),"utf-8"),e=Ck.parse(JSON.parse(t));i.set(e.id,e)}return Array.from(i.values())}function w5(){let n=process.env[a6]?.trim();if(n)return R6(n)?[n]:[];let i=process.env[I5]?.trim()||s6;return[ak,i].filter((r)=>R6(r))}function n4(){return process.env[a6]?.trim()||s6}function Kt(){return[`${a6}=<path>`,ak,s6]}function Mr(){return process.env[g5]?.trim()||b5}function bi(){let n=Mr();if(!R6(n))return pv.parse({});return pv.parse(JSON.parse(Rk(n,"utf-8")))}function Qv(n){let i=pv.parse(n),r=Mr();return u5($5(r),{recursive:!0,mode:448}),v5(r,`${JSON.stringify(i,null,2)}
|
||
`,{mode:384}),i}function zr(n,i,r=[]){let o=i.corpId?.trim()||void 0,t=i.stateful?i.defaultCorpId?.trim()||void 0:void 0,e=o??t;if(e){let l=n.find(($)=>$.id===e);if(l)return l;throw Error(`No enterprise config found for ${e}`)}if(!i.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-home config mode stateful` to enable a default enterprise.");let u=n[0];if(u)return u;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(r.length?r.join(", "):"the configured enterprise directories"))}import{readFileSync as R5}from"node:fs";import{randomBytes as x5}from"node:crypto";import{randomBytes as dd}from"node:crypto";var f5=v.object({staffId:v.string(),name:v.string().optional(),code:v.string().default(""),bindTime:v.number().optional()}),c5=v.object({id:v.string(),tenantId:v.string(),name:v.string(),isAdmin:v.boolean().default(!1),permissions:v.array(v.string()).default([]),providerUserId:v.string().optional(),hosecloudStaff:f5.optional()}),U5=v.object({apiKey:v.string().optional(),corporationId:v.string().optional(),corporationName:v.string().optional()}),D5=v.object({id:v.string(),name:v.string(),tenantSlug:v.string().optional(),isDemo:v.boolean().default(!1),logoUrl:v.string().nullable().optional(),hoseCorpConfig:U5.optional()}),nd=v.object({user:c5,tenant:D5}),S5=v.object({id:v.string(),name:v.string(),email:v.string().nullable().optional(),emailVerified:v.boolean().optional(),image:v.string().nullable().optional(),tenantId:v.string().optional(),provider:v.string().optional(),providerUserId:v.string().optional(),mobile:v.string().nullable().optional(),status:v.string().optional(),permissions:v.array(v.string()).default([]),isAdmin:v.boolean().default(!1),hosecloudStaff:v.unknown().optional()}).passthrough(),A5=v.object({id:v.string(),token:v.string().optional(),expiresAt:v.string(),createdAt:v.string().optional(),updatedAt:v.string().optional(),ipAddress:v.string().optional(),userAgent:v.string().optional(),userId:v.string(),delegationId:v.string().nullable().optional()}).passthrough(),id=v.object({user:S5,session:A5}),Fv=v.object({id:v.string(),tenantId:v.string().optional(),code:v.number().optional(),description:v.string(),scope:v.string(),strictness:v.string(),status:v.string().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional()}),td=v.object({rules:v.array(Fv),hasPendingDeletes:v.boolean().default(!1)}),O5=v.object({code:v.string().optional(),description:v.string(),scope:v.string(),strictness:v.string()}),Kv=v.object({id:v.string(),tenantId:v.string().optional(),versionNumber:v.number(),versionName:v.string().nullable().optional(),publishedBy:v.string().nullable().optional(),publishedByName:v.string().nullable().optional(),rules:v.array(O5).default([]),publishedAt:v.number().optional(),createdAt:v.number().optional()}),rd=v.object({version:Kv,rulesCount:v.number()}),Xe=v.object({id:v.string(),tenantId:v.string().optional(),title:v.string(),purpose:v.string().default(""),contentType:v.string().default("policy"),content:v.string(),status:v.string().default("published"),enabled:v.boolean().default(!0),scenarios:v.array(v.string()).default([]),tags:v.array(v.string()).default([]),category:v.string().nullable().optional(),categoryTags:v.array(v.string()).default([]),createdBy:v.string().nullable().optional(),createdByName:v.string().nullable().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional(),updatedBy:v.string().nullable().optional(),updatedByName:v.string().nullable().optional(),isDeleted:v.boolean().default(!1)}),od=v.object({articles:v.array(Xe),total:v.number().optional()}),k5=v.object({explicitApprove:v.string().default(""),explicitReject:v.string().default(""),exemptApprove:v.string().default(""),review:v.string().default("")}).passthrough(),d5=v.object({type:v.string(),signKey:v.string().optional(),outboundName:v.string().optional(),mode:v.string().optional(),autoApprovalRate:v.number().optional(),apiKey:v.string().optional(),apiSecret:v.string().optional(),apiOrigin:v.string().optional(),corporationId:v.string().optional(),ebotSignKey:v.string().optional(),completionSignKey:v.string().optional(),outboundMessageId:v.string().optional(),completionMessageId:v.string().optional()}).passthrough(),L5=v.enum(["assisted","semi_automatic","fully_automatic"]),sk=v.object({id:v.string(),url:v.string().url()}).passthrough(),he=v.object({type:v.literal("webhook"),id:v.string(),name:v.string(),mode:L5,incomingDocumentWebhook:sk,outgoingResultWebhook:v.string().url(),incomingManualResultWebhook:sk,secret:v.string().min(1),autoApprovalRate:v.number().int().min(0).max(100).optional()}).passthrough(),i4=v.object({id:v.string().optional(),tenantId:v.string().optional(),tone:v.string().optional(),language:v.string().optional(),detailLevel:v.string().optional(),outputFormat:v.string().optional(),examples:v.array(v.string()).default([]),prohibitedPhrases:v.array(v.string()).default([]),customInstructions:v.string().optional(),updatedAt:v.number().optional(),decisionPreferences:k5.optional(),integrationSystem:v.string().optional(),integrations:v.array(d5).default([])}).passthrough(),N5=v.object({id:v.string().optional(),sn:v.string().optional(),title:v.string().optional(),name:v.string().optional(),fields:v.array(v.unknown()).optional()}).passthrough(),y5=v.object({_langfuseTraceId:v.string().optional(),simulation_batch_id:v.string().optional()}).passthrough(),Bv=v.object({id:v.string(),tenantId:v.string().optional(),agentId:v.string().optional(),status:v.string().optional(),taskMode:v.string().optional(),finalExecutionMode:v.string().optional(),sourceSystem:v.string().optional(),sourceDocumentSN:v.string().optional(),sourceDocumentId:v.string().optional(),documentId:v.string().optional(),document:N5.optional(),result:v.unknown().optional(),pipelineData:v.unknown().optional(),sourceExtendData:y5.optional(),ruleSetVersionNumber:v.number().optional(),ruleSetPublishedAt:v.number().optional(),ruleSetPublishedByName:v.string().optional(),createdAt:v.union([v.string(),v.number()]).optional(),updatedAt:v.union([v.string(),v.number()]).optional()}).passthrough(),t4=v.object({records:v.array(Bv).default([]),total:v.number().optional(),page:v.number().optional(),pageSize:v.number().optional()}).passthrough(),ed=v.object({id:v.string(),expiresAt:v.number().nullable().optional(),revokedAt:v.number().nullable().optional(),createdAt:v.number().nullable().optional(),lastUsedAt:v.number().nullable().optional(),useCount:v.number().default(0),note:v.string().nullable().optional(),link:v.string()}).passthrough(),ud=v.object({id:v.string(),token:v.string(),link:v.string()}).passthrough(),ld=v.object({userId:v.string(),password:v.string()}).passthrough(),vd=v.object({password:v.string()}).passthrough(),r4=v.object({_id:v.string(),tenantId:v.string().optional(),name:v.string(),mobile:v.string().optional(),email:v.string().optional(),departmentIds:v.array(v.string()).default([]),status:v.string().optional(),permissions:v.array(v.string()).default([]),createdAt:v.string().optional(),updatedAt:v.string().optional()}).passthrough(),$d=v.object({departments:v.array(v.record(v.string(),v.unknown())).default([]),users:v.array(r4).default([])}).passthrough(),Id=v.object({provider:v.string(),config:v.record(v.string(),v.unknown()).default({})}).passthrough(),gd=v.object({id:v.string(),name:v.string(),description:v.string().optional(),available:v.boolean().default(!0),fields:v.array(v.record(v.string(),v.unknown())).default([])}).passthrough(),bd=v.object({permissions:v.array(v.object({key:v.string(),name:v.string(),description:v.string().optional()}).passthrough()).default([])}).passthrough(),wd=v.object({configs:v.array(v.record(v.string(),v.unknown())).default([])}).passthrough(),fd=v.object({subscriptions:v.array(v.record(v.string(),v.unknown())).default([]),features:v.array(v.record(v.string(),v.unknown())).default([])}).passthrough(),cd=v.object({key:v.string(),type:v.string(),label:v.string(),column:v.string(),mask:v.string().optional()}).passthrough(),G5=v.object({columns:v.array(cd).default([]),fieldKey:v.string().optional(),keyColumn:v.string().optional(),sheetName:v.string().optional(),fieldLabel:v.string().optional()}).passthrough(),Ud=v.object({id:v.string().optional(),listSheets:v.array(G5).default([]),mainColumns:v.array(cd).default([]),workbookName:v.string().optional(),mainKeyColumn:v.string().optional(),mainSheetName:v.string().optional(),titleColumn:v.string().optional(),statusColumn:v.string().optional(),applicationDateColumn:v.string().optional(),updatedDateColumn:v.string().optional(),attachmentFieldKey:v.string().optional(),attachmentFieldLabel:v.string().optional()}).passthrough(),j5=v.object({approvalCode:v.string(),nodeId:v.string().optional(),flowIds:v.array(v.string()).max(100).optional(),limit:v.number().int().positive().max(100).optional(),dataCollectionMode:v.string().optional(),signKey:v.string().optional(),rejectNodeName:v.string().nullable().optional(),skipInvoiceGeneration:v.boolean().optional(),skipExpenseExtraction:v.boolean().optional(),disableAttachmentCache:v.boolean().optional(),thinkingDepthOverride:v.enum(["default","medium","high"]).optional(),startTime:v.number().optional(),endTime:v.number().optional(),templateId:v.string().optional(),packageIds:v.array(v.string()).optional(),packageLabel:v.string().optional(),runMode:v.string().optional(),schemaConfig:Ud.optional()}).passthrough(),W5=v.object({mode:v.string().optional(),conditions:v.array(v.object({label:v.string(),value:v.string()}).passthrough()).default([])}).passthrough(),J5=v.object({kind:v.string().optional(),stage:v.string().optional(),code:v.string().optional(),message:v.string().optional()}).passthrough(),o4=v.object({id:v.string(),tenantId:v.string().optional(),approvalCode:v.string().optional(),nodeId:v.string().optional(),sourceSystem:v.string().optional(),status:v.string().optional(),totalCount:v.number().default(0),processedCount:v.number().default(0),successCount:v.number().default(0),failedCount:v.number().default(0),createdCount:v.number().default(0),createFailedCount:v.number().default(0),params:j5.optional(),requestSummary:W5.nullable().optional(),resultSummary:J5.nullable().optional(),createdAt:v.union([v.string(),v.number()]).optional(),updatedAt:v.union([v.string(),v.number()]).optional()}).passthrough(),e4=v.object({batchId:v.string()}).passthrough(),H5=v.object({dataCollectionMode:v.string().optional(),flowIds:v.array(v.string()).max(100).optional(),rejectNodeName:v.string().nullable().optional(),skipInvoiceGeneration:v.boolean().optional(),skipExpenseExtraction:v.boolean().optional()}).passthrough(),Dd=v.object({id:v.string(),tenantId:v.string().optional(),name:v.string().optional(),description:v.string().optional(),approvalSystem:v.string().optional(),hosecloudConfig:H5.optional(),createdAt:v.union([v.string(),v.number()]).optional(),updatedAt:v.union([v.string(),v.number()]).optional()}).passthrough(),Sd=v.object({hasFeishu:v.boolean().default(!1),hasHosecloud:v.boolean().default(!1),hasWeaver:v.boolean().default(!1),hasHelios:v.boolean().default(!1),hasMaycur:v.boolean().default(!1),hasMaycurStandard:v.boolean().default(!1)}).passthrough(),Ad=v.object({signKey:v.string().optional(),displayName:v.string().optional(),corporationId:v.string().optional()}).passthrough(),Od=v.object({id:v.string(),tenantId:v.string().optional(),name:v.string().optional(),templateId:v.string().optional(),originalFileName:v.string().optional(),status:v.string().optional(),documentCount:v.number().optional(),attachmentCount:v.number().optional(),uploadedBy:v.string().optional(),schemaConfig:Ud.nullable().optional(),createdAt:v.union([v.string(),v.number()]).optional(),updatedAt:v.union([v.string(),v.number()]).optional()}).passthrough(),X5=v.object({hitScopes:v.array(v.string()).default([]),hitRuleIds:v.array(v.string()).default([]),notHitScopes:v.array(v.string()).default([]),notHitRuleIds:v.array(v.string()).default([])}).passthrough(),u4=v.object({id:v.string().min(1),name:v.string().min(1),enabled:v.boolean().default(!0),description:v.string().default(""),condition:X5.default({hitScopes:[],hitRuleIds:[],notHitScopes:[],notHitRuleIds:[]}),level:v.enum(["medium","high"])}).passthrough(),SM=v.object({defaultLevel:v.enum(["medium","high"]).default("medium"),routingPolicies:v.array(u4).default([])}).passthrough(),AM=v.object({signKey:v.string().min(1).optional(),outboundName:v.string().optional(),specificationId:v.string().optional(),specificationName:v.string().optional(),mode:v.enum(["fully_automatic","semi_automatic","assisted"]).default("assisted"),autoApprovalRate:v.number().min(0).max(100).optional(),rejectResubmitMethod:v.enum(["node_default","to_ebot","from_start"]).optional(),autoApproveNodeNames:v.array(v.string()).optional(),apiKey:v.string().min(1),apiSecret:v.string().min(1),apiOrigin:v.string().default("production"),customApiUrl:v.string().optional()}).passthrough(),kd=v.object({id:v.string().optional(),code:v.string().optional(),name:v.string().optional(),approvalSystem:v.string().optional()}).passthrough(),OM=v.object({total:v.number(),dedupeBy:v.string(),unique:v.number(),byStatus:v.record(v.string(),v.number()),bySourceSystem:v.record(v.string(),v.number())}).passthrough();var qv=v.object({success:v.boolean().optional()}).passthrough(),h5=v.object({items:v.array(v.object({_id:v.string()})).optional()}).passthrough(),P5=v.object({user:v.unknown().optional(),session:v.object({token:v.string().optional()}).optional()}).passthrough(),Ld=v.json();async function on(n,i){let r=await n.json();return i.parse(r.data??r)}async function Yi(n){return on(await n.get("api/v1/auth/me"),nd)}async function Nd(n){return on(await n.get("api/auth/get-session"),id)}async function Bt(n){return on(await n.get("api/v1/rules"),td)}async function yd(n,i){return on(await n.post("api/v1/rules",{json:i}),Fv)}async function Gd(n,i,r){return on(await n.put(`api/v1/rules/${i}`,{json:r}),Fv)}async function l4(n,i){await n.delete(`api/v1/rules/${i}`)}async function jd(n){let i=await n.post("api/v1/rules/batch-recode",{throwHttpErrors:!1}),r=await i.json().catch(()=>({}));return v.object({ok:v.boolean(),status:v.number(),body:v.unknown()}).parse({ok:i.ok,status:i.status,body:r})}async function Vt(n){return on(await n.get("api/v1/rule-set-versions"),v.array(Kv))}async function Ye(n,i){return on(await n.get(`api/v1/rule-set-versions/${i}`),Kv)}async function Wd(n,i){return on(await n.post("api/v1/rule-set-versions/publish",{json:{versionName:i}}),rd)}async function pe(n,i={}){let r=new URLSearchParams;return r.set("offset",String(i.offset??0)),r.set("limit",String(i.limit??20)),r.set("sortBy",i.sortBy??"createdAt"),r.set("sortOrder",i.sortOrder??"desc"),i.scenarios?.forEach((o,t)=>{r.set(`filter[scenarios][${t}]`,o)}),on(await n.get("api/v1/knowledge/articles",{searchParams:r}),od)}async function Jd(n,i){return on(await n.get(`api/v1/knowledge/articles/${i}`),Xe)}async function Hd(n,i){return on(await n.post("api/v1/knowledge/articles",{json:{...i,contentType:i.contentType??"policy",status:i.status??"published",scenarios:i.scenarios??[],tags:i.tags??[]}}),Xe)}async function Xd(n,i,r){let o=Object.fromEntries(Object.entries(r).filter(([,t])=>t!==void 0));return on(await n.patch(`api/v1/knowledge/articles/${i}`,{json:{attributes:o}}),Xe)}async function Gn(n,i="api/v1/agent/ai-approval/config"){return on(await n.get(i),i4)}async function Tt(n,i,r="api/v1/agent/ai-approval/config"){return on(await n.patch(r,{json:i}),i4)}async function v4(n,i,r="api/v1/agent/ai-approval/config"){let o=await n.post(r,{json:i}),t=await o.json().catch(()=>({})),e=qv.safeParse(t.data??t);return e.success?e.data.success??o.ok:o.ok}async function $4(n,i="api/v1/agent/ai-approval/config"){let r=await Gn(n,i);return Qd(r.integrations)}async function hd(n,i,r,o="api/v1/agent/ai-approval/config"){let t=await Gn(n,o),e=Qd(t.integrations),u=Y5(i,e,r);if(!await v4(n,{...t,integrations:[...t.integrations,u]},o))throw Error("Seal did not confirm saving the Webhook integration");return u}async function Pd(n,i,r,o="api/v1/agent/ai-approval/config"){let t=await Gn(n,o),e=Fd(t.integrations),u=Kd(e,i),l=he.parse({...u.integration,...r.name===void 0?{}:{name:Pe(r.name,"name")},...r.mode===void 0?{}:{mode:r.mode},...r.outgoingResultWebhook===void 0?{}:{outgoingResultWebhook:Vd(r.outgoingResultWebhook,"outgoingResultWebhook")},...r.autoApprovalRate===void 0?{}:{autoApprovalRate:Td(r.autoApprovalRate)},...r.rotateSecret||r.secret!==void 0?{secret:r.rotateSecret?Bd():Pe(r.secret??"","secret")}:{}});if(!await v4(n,{...t,integrations:t.integrations.map((I,g)=>g===u.index?l:I)},o))throw Error("Seal did not confirm saving the Webhook integration");return l}async function Yd(n,i,r="api/v1/agent/ai-approval/config"){let o=await Gn(n,r),t=Fd(o.integrations),e=Kd(t,i);if(!await v4(n,{...o,integrations:o.integrations.filter((l,$)=>$!==e.index)},r))throw Error("Seal did not confirm deleting the Webhook integration");return e.integration}function I4(n,i){let r=i.trim();if(!r)throw Error("Webhook selector must not be empty");let o=n.find((e)=>e.id===r);if(o)return o;let t=n.filter((e)=>e.name===r);if(t.length===1)return t[0];if(t.length>1)throw Error(`Multiple Webhook integrations match name: ${r}. Use the integration ID.`);throw Error(`Webhook integration not found: ${r}`)}function pd(n,i){let r=i?.trim().toLowerCase();if(!r)return n;return n.filter((o)=>[o.id,o.name,o.mode,o.outgoingResultWebhook,o.incomingDocumentWebhook.url,o.incomingManualResultWebhook.url].some((t)=>t.toLowerCase().includes(r)))}function Qd(n){return n.filter((i)=>i.type==="webhook").map((i)=>he.parse(i))}function Fd(n){return n.flatMap((i,r)=>{if(i.type!=="webhook")return[];return[{index:r,integration:he.parse(i)}]})}function Kd(n,i){let r=I4(n.map((o)=>o.integration),i);return n.find((o)=>o.integration.id===r.id)}function Y5(n,i,r){let o=Pe(r.name,"name"),t=r.mode??"assisted",e=Vd(r.outgoingResultWebhook,"outgoingResultWebhook"),u=Td(r.autoApprovalRate??60),l=p5(i),$=`wh_${l}_${dd(8).toString("hex").slice(0,7)}`,I=di(n);return he.parse({type:"webhook",id:`integration-${l}`,name:o,mode:t,incomingDocumentWebhook:{id:$,url:`${I}/api/v1/integrations/webhook/${$}/document`},outgoingResultWebhook:e,incomingManualResultWebhook:{id:$,url:`${I}/api/v1/integrations/webhook/${$}/manual-result`},secret:r.secret?Pe(r.secret,"secret"):Bd(),autoApprovalRate:u})}function p5(n){let i=new Set(n.map((o)=>o.id)),r=Date.now();while(i.has(`integration-${r}`))r+=1;return r}function Bd(){return dd(16).toString("hex")}function Pe(n,i){let r=n.trim();if(!r)throw Error(`Webhook ${i} must not be empty`);return r}function Vd(n,i){let r=Pe(n,i);try{return new URL(r).toString()}catch{throw Error(`Webhook ${i} must be a valid URL`)}}function Td(n){if(!Number.isInteger(n)||n<0||n>100)throw Error("Webhook autoApprovalRate must be an integer between 0 and 100");return n}async function _v(n,i={}){let[r,o,t]=await Promise.all([Bt(n),pe(n,{limit:i.documentLimit??50}),Gn(n,i.stylePreferencesEndpoint).then((e)=>({ok:!0,data:e}),(e)=>({ok:!1,error:e instanceof Error?e.message:String(e)}))]);return{rules:r,documents:o,stylePreferences:t}}async function Ut(n,i={}){let r=new URLSearchParams;return r.set("offset",String(i.offset??0)),r.set("limit",String(i.limit??50)),Pi(r,"fromTimestamp",i.fromTimestamp),Pi(r,"toTimestamp",i.toTimestamp),Pi(r,"startDate",i.startDate),Pi(r,"endDate",i.endDate),Pi(r,"status",i.status),Pi(r,"sourceSystem",i.sourceSystem),Pi(r,"taskMode",i.taskMode),Pi(r,"search",i.search),Pi(r,"sourceDocumentSN",i.sourceDocumentSN),Pi(r,"sourceDocumentId",i.sourceDocumentId),Q5(r,"manualApprovalStatus",i.manualApprovalStatus),on(await n.get("api/v1/approvals",{searchParams:r}),t4)}async function Li(n,i){return on(await n.get(`api/v1/approvals/${i}`),Bv)}async function g4(n,i){let r=await n.get(`api/v1/simulation/batch/${i}/records`).json(),o=r.data??r;if(Array.isArray(o))return v.array(Bv).parse(o);return t4.parse(o).records}async function qd(n,i){return on(await n.post("api/v1/simulation/create-batch",{json:i}),e4)}async function _d(n,i){return on(await n.post("api/v1/simulation/create-material-pack-batch",{json:i}),e4)}async function Ed(n,i={}){let r=await n.get("api/v1/simulation/batches",{searchParams:{limit:String(i.limit??50)}}).json(),o=r.data??r;return v.array(o4).parse(o)}async function b4(n,i){return on(await n.get(`api/v1/simulation/batch/${i}`),o4)}async function Zd(n){let i=await n.get("api/v1/simulation/templates").json(),r=i.data??i;return v.array(Dd).parse(r)}async function w4(n){return on(await n.get("api/v1/simulation/integration-status"),Sd)}async function f4(n){let i=await n.get("api/v1/simulation/hosecloud-integrations").json(),r=i.data??i;return v.array(Ad).parse(r)}async function md(n,i){let o=await(await n.delete(`api/v1/simulation/batch/${encodeURIComponent(i)}/data`)).json().catch(()=>({}));return o.data??o}async function Md(n,i){let r=i?"api/v1/simulation/hosecloud-specifications-by-sign-key":"api/v1/simulation/hosecloud-specifications",o=i?new URLSearchParams({signKey:i}):void 0,t=await n.get(r,{searchParams:o}).json(),e=t.data??t;return v.array(kd).parse(e)}async function zd(n,i){let r=await n.post("api/hosecloud/corporation",{json:i}).json(),o=r.data??r;return v.object({corporationId:v.string()}).parse(o)}async function Cd(n,i){let o=await(await n.post("api/hosecloud/outbound-config/sync",{json:i})).json().catch(()=>({}));return o.data??o}async function Rd(n,i){let r=new FormData;return r.append("file",new Blob([new Uint8Array(i.fileBuffer)]),i.fileName),on(await n.post("api/v1/material-packages/upload",{body:r}),Od)}function Pi(n,i,r){if(r)n.set(i,r)}function Q5(n,i,r){if(!r)return;(Array.isArray(r)?r:[r]).map((t)=>t.trim()).filter(Boolean).forEach((t,e)=>{n.set(`${i}[${e}]`,t)})}async function xd(n){return on(await n.get("api/v1/delegation/list"),v.array(ed))}async function Cr(n,i){return on(await n.post("api/v1/delegation/create",{json:i??{}}),ud)}async function ad(n,i){let r=await n.post("api/v1/delegation/revoke",{json:{tokenId:i}}),o=await r.json(),t=qv.safeParse(o.data??o);return t.success?t.data.success??r.ok:r.ok}async function sd(n,i){let r=i.departmentIds&&i.departmentIds.length>0?i.departmentIds:void 0;if(!r){let o=await n.get("api/v1/contacts/departments/root/children").json(),t=h5.safeParse(o.data??o),e=t.success?t.data.items?.[0]?._id:void 0;if(e)r=[e]}return on(await n.post("api/v1/contacts/local/users",{json:{name:i.name,phone:i.phone,permissions:i.permissions??[],departmentIds:r??[]}}),ld)}async function c4(n,i){return on(await n.post(`api/v1/contacts/local/users/${i}/reset-password`,{json:{}}),vd)}async function Vv(n,i){return on(await n.get(`api/v1/contacts/users/${i}`),r4)}async function Tv(n,i=""){return on(await n.get("api/v1/contacts/search",{searchParams:{query:i}}),$d)}async function nL(n,i){let r=await n.delete(`api/v1/contacts/local/users/${i}`),o=await r.json(),t=qv.safeParse(o.data??o);return t.success?t.data.success??r.ok:r.ok}async function U4(n,i){let r=await n.post(`api/v1/contacts/local/users/${i}/activate`,{json:{}}),o=await r.json(),t=qv.safeParse(o.data??o);return t.success?t.data.success??r.ok:r.ok}async function F5(n,i){let r=await n.post("api/auth/sms-otp/sign-in-password",{json:i}),o=r.headers.get("set-auth-token"),t=P5.parse(await r.json()),e=o??t.session?.token;if(!e)throw Error("Failed to retrieve authentication token from login response");return{token:e,user:t.user}}async function iL(n,i,r,o){let t;if(i.userIdOrPhone.startsWith("+")||/^\d{11}$/.test(i.userIdOrPhone)){let f=await Tv(n,i.userIdOrPhone),c=f.users.find((S)=>S.mobile?.includes(i.userIdOrPhone)||S._id===i.userIdOrPhone)??f.users[0];if(!c)throw Error(`User not found with phone/ID: ${i.userIdOrPhone}`);t=c}else t=await Vv(n,i.userIdOrPhone).catch(async()=>{let f=await Tv(n,i.userIdOrPhone),c=f.users.find((S)=>S.name===i.userIdOrPhone)??f.users[0];if(!c)throw Error(`User not found: ${i.userIdOrPhone}`);return c});if(t.status==="resigned")await U4(n,t._id),t=await Vv(n,t._id);let e=t,u=Array.isArray(e.identities)&&e.identities.some((f)=>f.provider&&f.provider!=="local")||!!e.apps?.hosecloud;if(u&&o&&o.source.type==="hose"){let c=(t.mobile||e.identities?.[0]?.providerId||"").replace(/^\+86/,""),S=e.identities?.find((d)=>d.provider==="hosecloud")?.providerId,k=e.apps?.hosecloud?.boundId||S||(c?`${o.source.corpId}:${c}`:void 0);if(k){let d=await Jv(o),h=(await Hv({...o.source,staffId:k},d)).token,j=Je(o,o.source),L;try{L=await Zi.get(`${di(j)}/api/auth/oauth2/session/oem-hosecloud`,{searchParams:{token:h,returnToken:"1"},timeout:30000}).json()}catch(x){if(x instanceof ti&&x.response.status===400)throw Error(`Seal AI 用户“${t.name}”未绑定合思账号,无法生成个人协助链接。`);throw x}let q=L.token??L.accessToken??L.data?.token;if(q){let x=await r(q),yn=await Cr(x,{note:i.note??`Delegation generated by admin for ${t.name}`});return{targetUser:t,delegation:yn,temporaryPassword:"N/A (Hose SSO)"}}}}let l;try{l=await c4(n,t._id)}catch(f){if(u)throw Error(`用户 "${t.name}" (${t.mobile||t._id}) 为合思同步账号 (provider: hosecloud),无 Seal 本地密码。`+"Seal 系统暂不支持对同步账号直接重置本地密码。");throw f}let I=(t.mobile||t.identities?.[0]?.providerId||"").replace(/^\+86/,"");if(!I)throw Error(`User ${t.name} has no associated phone number for password login`);let{token:g}=await F5(n,{phone:I,password:l.password}),b=await r(g),w=await Cr(b,{note:i.note??`Delegation generated by admin for ${t.name}`});return{targetUser:t,delegation:w,temporaryPassword:l.password}}async function tL(n){return on(await n.get("api/v1/llm/config"),Id)}async function rL(n){return on(await n.get("api/v1/llm/providers"),v.array(gd))}async function oL(n){return on(await n.get("api/v1/permissions/available"),bd)}async function eL(n){return on(await n.get("api/v1/permissions/configs"),wd)}async function uL(n){return on(await n.get("api/v1/billing/status"),fd)}async function lL(n){let r=await(await n.get("api/v1/billing/plans")).json();return Ld.parse(r.data??r)}async function vL(n){let r=await(await n.get("api/v1/billing/features")).json();return Ld.parse(r.data??r)}var gL=300000,$L=new Map;function B5(n,i){return n.map((r)=>r.trim()).filter(Boolean).map((r)=>i?r:r.toLowerCase())}function V5(n,i){return i?n:n.toLowerCase()}function T5(n,i,r,o){let t=V5(n,o),e=i.filter((u)=>t.includes(u));if(r==="all"&&e.length!==i.length)return[];return e}function q5(n){if(typeof n==="string")return n.split(/\r?\n/);return JSON.stringify(n,null,2).split(/\r?\n/)}function _5(n,i){if(i.fields&&!i.fields.has(n.field))return[];let r=q5(n.value),o=[];return r.forEach((t,e)=>{let u=T5(t,i.keywords,i.matchMode,i.caseSensitive);if(u.length===0)return;let l=Math.max(0,e-i.contextLines),$=Math.min(r.length,e+i.contextLines+1),I={area:n.area,entityType:n.entityType,entityId:n.entityId,title:n.title,field:n.field,lineNumber:e+1,matchedKeywords:u,matchedText:Ev(t,i.maxChars),context:{before:i.snippetOnly?[]:r.slice(l,e).map((g)=>Ev(g,i.maxChars)),line:Ev(t,i.maxChars),after:i.snippetOnly?[]:r.slice(e+1,$).map((g)=>Ev(g,i.maxChars))},metadata:n.metadata};if(i.snippetOnly)I.context={before:[],line:I.context.line,after:[]};o.push(I)}),o}function Ev(n,i){if(!i||n.length<=i)return n;return`${n.slice(0,Math.max(0,i))}...`}function E5(n){return[{area:"rules",entityType:"rule",entityId:n.id,title:n.scope,field:"description",value:n.description,metadata:{scope:n.scope,strictness:n.strictness,status:n.status}},{area:"rules",entityType:"rule",entityId:n.id,title:n.scope,field:"scope",value:n.scope,metadata:{strictness:n.strictness,status:n.status}}]}function IL(n){return n.rules.flatMap((i,r)=>{let o=`${n.id}:${i.description.slice(0,32)}`,t={versionId:n.id,versionNumber:n.versionNumber,versionName:n.versionName,publishedByName:n.publishedByName,publishedAt:n.publishedAt,scope:i.scope,strictness:i.strictness,code:"code"in i?i.code:void 0,index:r};return[{area:"rules",entityType:"rule",entityId:o,title:`${n.versionName} / ${i.scope}`,field:"history.description",value:i.description,metadata:t},{area:"rules",entityType:"rule",entityId:o,title:`${n.versionName} / ${i.scope}`,field:"history.scope",value:i.scope,metadata:t}]})}function Z5(n){return[{area:"documents",entityType:"document",entityId:n.id,title:n.title,field:"title",value:n.title,metadata:{status:n.status,scenarios:n.scenarios,tags:n.tags}},{area:"documents",entityType:"document",entityId:n.id,title:n.title,field:"purpose",value:n.purpose,metadata:{status:n.status,scenarios:n.scenarios,tags:n.tags}},{area:"documents",entityType:"document",entityId:n.id,title:n.title,field:"content",value:n.content,metadata:{status:n.status,scenarios:n.scenarios,tags:n.tags}}]}function m5(n){let i=[];if(n.decisionPreferences)for(let[r,o]of Object.entries(n.decisionPreferences))i.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${r}`,value:o,metadata:{integrationSystem:n.integrationSystem}});return n.integrations.forEach((r,o)=>{i.push({area:"preferences",entityType:"integration",title:r.outboundName,field:`integrations[${o}]`,value:r,metadata:{type:r.type,outboundName:r.outboundName,mode:r.mode,corporationId:r.corporationId}})}),i}async function M5(n,i,r){let o=r.ruleVersionScope??"current",t=[i.id,`ruleVersionScope=${o}`,`ruleVersionId=${r.ruleVersionId??""}`,`ruleVersionNumber=${r.ruleVersionNumber??""}`,`latestRuleVersion=${r.latestRuleVersion??!1}`,`documentLimit=${r.documentLimit??100}`].join("|"),e=$L.get(t);if(!r.refresh&&e&&Date.now()<e.expiresAt)return e;let[u,l,$]=await Promise.all([z5(n,{scope:o,versionId:r.ruleVersionId,versionNumber:r.ruleVersionNumber,latest:r.latestRuleVersion}),pe(n,{limit:r.documentLimit??100}),Gn(n,i.seal.endpoints.approvalStylePreferences)]),I=Date.now(),g={entries:[...u,...l.articles.flatMap(Z5),...m5($)],fetchedAt:I,expiresAt:I+gL};return $L.set(t,g),g}async function z5(n,i){if(i.scope==="current")return(await Bt(n)).rules.flatMap(E5);if(i.scope==="version"){let o=await C5(n,i);return IL(o)}return(await Vt(n)).flatMap(IL)}async function C5(n,i){if(i.versionId)return Ye(n,i.versionId);let r=await Vt(n),o=i.versionNumber?r.find((t)=>t.versionNumber===i.versionNumber):r[0];if(!o)throw Error(i.versionNumber?`Rule version not found: ${i.versionNumber}`:"No rule versions found");return o}async function bL(n,i,r){let o=r.matchMode??"any",t=r.caseSensitive??!1,e=r.contextLines??3,u=new Set(r.areas??["rules","documents","preferences"]),l=r.maxResults??50,$=r.ruleVersionScope??"current",I=B5(r.keywords,t),g=r.fields?.length?new Set(r.fields):void 0;if(I.length===0)throw Error("keywords must contain at least one non-empty string");let b=await M5(n,i,{documentLimit:r.documentLimit,refresh:r.refresh,ruleVersionScope:$,ruleVersionId:r.ruleVersionId,ruleVersionNumber:r.ruleVersionNumber,latestRuleVersion:r.latestRuleVersion}),w=b.entries.filter((f)=>u.has(f.area)).flatMap((f)=>_5(f,{keywords:I,matchMode:o,caseSensitive:t,contextLines:e,snippetOnly:r.snippetOnly,maxChars:r.maxChars,fields:g}));return{query:{keywords:r.keywords,matchMode:o,areas:Array.from(u),caseSensitive:t,contextLines:e,refresh:r.refresh??!1,ruleVersionScope:$,ruleVersionId:r.ruleVersionId,ruleVersionNumber:r.ruleVersionNumber,latestRuleVersion:r.latestRuleVersion??!1,snippetOnly:r.snippetOnly??!1,maxChars:r.maxChars,fields:r.fields},cache:{fetchedAt:new Date(b.fetchedAt).toISOString(),expiresAt:new Date(b.expiresAt).toISOString(),ttlMs:gL},total:w.length,returned:Math.min(w.length,l),results:w.slice(0,l)}}var St=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:v.object({}),handler:async(n)=>Yi(n)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:v.object({}),handler:async(n)=>Nd(n)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:v.object({}),handler:async(n)=>xd(n)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:v.object({note:v.string().optional().describe("授权链接的备注或说明信息")}),handler:async(n,i)=>Cr(n,i)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:v.object({tokenId:v.string().describe("授权链接 ID (delegation record ID)")}),handler:async(n,i)=>ad(n,i.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:v.object({name:v.string().describe("用户姓名"),phone:v.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:v.array(v.string()).optional().describe("权限列表,默认为 []"),departmentIds:v.array(v.string()).optional().describe("关联部门 ID 数组")}),handler:async(n,i)=>sd(n,i)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:v.object({userId:v.string().describe("用户 ID (_id)")}),handler:async(n,i)=>c4(n,i.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:v.object({userId:v.string().describe("用户 ID (_id)")}),handler:async(n,i)=>Vv(n,i.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:v.object({keyword:v.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async(n,i)=>Tv(n,i.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:v.object({userId:v.string().describe("用户 ID (_id)")}),handler:async(n,i)=>nL(n,i.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:v.object({userId:v.string().describe("用户 ID (_id)")}),handler:async(n,i)=>U4(n,i.userId)},{name:"seal_user_delegation_create",description:"为指定 Seal 用户(按用户ID、手机号或姓名)重置密码登录并生成其专属授权链接 (Delegation)",parameters:v.object({userIdOrPhone:v.string().describe("目标用户 ID、手机号或姓名"),note:v.string().optional().describe("授权链接备注信息")}),handler:async(n,i,r)=>iL(n,i,(o)=>Mk(r.corp,o),r.corp)},{name:"seal_llm_config_get",description:"查询当前 Seal 租户的大模型 (LLM) 配置",parameters:v.object({}),handler:async(n)=>tL(n)},{name:"seal_llm_providers_list",description:"查询支持的大模型 (LLM) 供应商与配置属性字段",parameters:v.object({}),handler:async(n)=>rL(n)},{name:"seal_permissions_available_list",description:"查询系统可选权限清单(如超级管理员、智能审核管理、数据管理等)",parameters:v.object({}),handler:async(n)=>oL(n)},{name:"seal_permissions_configs_list",description:"查询当前租户已绑定的权限配置",parameters:v.object({}),handler:async(n)=>eL(n)},{name:"seal_billing_status_get",description:"查询当前 Seal 租户的订阅状态与各功能额度(AI审批、审核规则、知识文档等)",parameters:v.object({}),handler:async(n)=>uL(n)},{name:"seal_billing_plans_list",description:"查询系统支持的订阅套餐列表",parameters:v.object({}),handler:async(n)=>lL(n)},{name:"seal_billing_features_list",description:"查询系统支持的功能特性定义列表",parameters:v.object({}),handler:async(n)=>vL(n)},{name:"seal_approval_rules_list",description:"列出 Seal 当前草稿审批规则;支持 countOnly、fields、limit 以避免返回规则正文",parameters:v.object({countOnly:v.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:v.array(v.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:v.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:v.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async(n,i)=>{let r=await Bt(n);return rQ(r,i)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:v.object({dryRun:v.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:v.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async(n,i,r)=>{let o=await Bt(n);if(i.dryRun)return{corpId:r.corp.id,corpName:r.corp.name,dryRun:!0,beforeCount:o.rules.length,deleted:0,afterCount:o.rules.length,hasPendingDeletes:o.hasPendingDeletes};let t=[],e=0;for(let I of o.rules)try{await l4(n,I.id),e+=1}catch(g){t.push({ruleId:I.id,error:g instanceof Error?g.message:String(g)})}let u=[],l;if(e>0&&i.recode!==!1){if(l=await jd(n),l&&typeof l==="object"&&"ok"in l&&l.ok!==!0)u.push("batch-recode did not complete; current rules were still deleted")}let $=await Bt(n);return{corpId:r.corp.id,corpName:r.corp.name,dryRun:!1,beforeCount:o.rules.length,deleted:e,failed:t,afterCount:$.rules.length,hasPendingDeletes:$.hasPendingDeletes,warnings:u,recode:l}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:v.object({description:v.string().describe("规则描述"),scope:v.string().describe("适用场景"),strictness:v.enum(["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]).describe("严格程度")}),handler:async(n,i)=>yd(n,i)},{name:"seal_approval_rule_update",description:"更新 Seal 草稿审批规则",parameters:v.object({ruleId:v.string().describe("规则 ID"),description:v.string().optional(),scope:v.string().optional(),strictness:v.enum(["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]).optional()}),handler:async(n,i)=>{let{ruleId:r,...o}=i;return Gd(n,r,o)}},{name:"seal_approval_rule_delete",description:"删除 Seal 草稿审批规则",parameters:v.object({ruleId:v.string().describe("规则 ID")}),handler:async(n,i)=>{return await l4(n,i.ruleId),{success:!0}}},{name:"seal_approval_rule_versions_list",description:"列出 Seal 已发布审批规则版本摘要,不展开每个版本的规则快照",parameters:v.object({}),handler:async(n)=>{let i=await Vt(n);return{count:i.length,latest:i[0]?D4(i[0]):void 0,versions:i.map(D4)}}},{name:"seal_approval_rule_version_get",description:"获取指定 Seal 已发布审批规则版本详情,包含该版本的规则快照",parameters:v.object({versionId:v.string().optional().describe("规则版本 ID"),versionNumber:v.number().int().positive().optional().describe("规则版本号"),latest:v.boolean().optional().describe("为 true 时获取最新版本")}),handler:async(n,i)=>{if(i.versionId)return Ye(n,i.versionId);let r=await Vt(n),o=i.versionNumber?r.find((t)=>t.versionNumber===i.versionNumber):r[0];if(!o)throw Error(i.versionNumber?`Rule version not found: ${i.versionNumber}`:"No rule versions found");return o}},{name:"seal_approval_rule_version_publish",description:"发布 Seal 草稿审批规则为新版本",parameters:v.object({versionName:v.string().describe("版本名称")}),handler:async(n,i)=>Wd(n,i.versionName)},{name:"seal_approval_rule_get",description:"按版本号/code/runtime-id/record-id 定位单条规则,避免拉取整版规则快照",parameters:v.object({versionId:v.string().optional().describe("规则版本 ID"),versionNumber:v.number().int().positive().optional().describe("规则版本号"),latest:v.boolean().optional().describe("为 true 时取最新版本"),code:v.string().optional().describe("规则展示编号,如 #0038;没有后端 code 时按版本内序号匹配"),runtimeId:v.string().optional().describe("运行时规则 ID,如 rule-205;按版本内序号匹配"),recordId:v.string().optional().describe("从运行记录推断 ruleSetVersionNumber")}),handler:async(n,i)=>{let r=await UQ(n,i),o=DQ(r,{code:i.code,runtimeId:i.runtimeId});if(!o)throw Error(`Rule not found in version ${r.versionNumber}`);return o}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:v.object({scenarios:v.array(v.string()).optional().describe("场景过滤"),offset:v.number().int().nonnegative().optional(),limit:v.number().int().positive().optional()}),handler:async(n,i)=>pe(n,i)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:v.object({documentId:v.string().describe("文档 ID")}),handler:async(n,i)=>Jd(n,i.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:v.object({title:v.string(),purpose:v.string(),content:v.string().describe("正文,通常为 Markdown"),contentType:v.string().optional(),status:v.string().optional(),scenarios:v.array(v.string()).optional(),tags:v.array(v.string()).optional()}),handler:async(n,i)=>Hd(n,i)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:v.object({documentId:v.string(),title:v.string().optional(),purpose:v.string().optional(),content:v.string().optional(),contentType:v.string().optional(),status:v.string().optional(),enabled:v.boolean().optional(),scenarios:v.array(v.string()).optional(),tags:v.array(v.string()).optional()}),handler:async(n,i)=>{let{documentId:r,...o}=i;return Xd(n,r,o)}},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:v.object({keywords:v.array(v.string()).min(1).describe("关键词组"),matchMode:v.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:v.array(v.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:v.boolean().optional().describe("是否大小写敏感"),contextLines:v.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:v.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:v.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:v.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:v.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:v.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:v.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:v.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:v.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:v.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:v.array(v.string()).optional().describe("只搜索指定字段,如 history.description、description、scope")}),handler:async(n,i,r)=>bL(n,r.corp,i)},{name:"seal_approval_context_get",description:"聚合获取 Seal 现有审批规则、审批文档和审批风格偏好",parameters:v.object({documentLimit:v.number().int().positive().optional().describe("最多返回的审批文档数量"),ruleVersionId:v.string().optional().describe("指定已发布规则版本 ID;指定后 rules 返回该版本快照"),ruleVersionNumber:v.number().int().positive().optional().describe("指定已发布规则版本号;指定后 rules 返回该版本快照"),latestRuleVersion:v.boolean().optional().describe("为 true 时 rules 返回最新已发布版本快照")}),handler:async(n,i,r)=>{let o=await _v(n,{documentLimit:i.documentLimit,stylePreferencesEndpoint:r.corp.seal.endpoints.approvalStylePreferences});if(!i.ruleVersionId&&!i.ruleVersionNumber&&!i.latestRuleVersion)return o;let t=await k4(n,i);return{...o,rules:{version:D4(t),rules:t.rules}}}},{name:"seal_approval_style_preferences_get",description:"获取 Seal 审批风格偏好配置",parameters:v.object({}),handler:async(n,i,r)=>Gn(n,r.corp.seal.endpoints.approvalStylePreferences)},{name:"seal_approval_style_preferences_update",description:"更新 Seal 审批风格偏好配置",parameters:v.object({tone:v.string().optional(),language:v.string().optional(),detailLevel:v.string().optional(),outputFormat:v.string().optional(),examples:v.array(v.string()).optional(),prohibitedPhrases:v.array(v.string()).optional(),customInstructions:v.string().optional()}),handler:async(n,i,r)=>Tt(n,i,r.corp.seal.endpoints.approvalStylePreferences)},{name:"seal_webhook_list",description:"列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",parameters:v.object({query:v.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),includeSecret:v.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")}),handler:async(n,i,r)=>{let o=pd(await $4(n,r.corp.seal.endpoints.approvalStylePreferences),i.query);return{count:o.length,integrations:o.map((t)=>Qe(t,i.includeSecret===!0))}}},{name:"seal_webhook_get",description:"按 Webhook 集成 ID 或名称精确查找一条集成",parameters:v.object({selector:v.string().min(1).describe("Webhook 集成 ID 或名称"),includeSecret:v.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")}),handler:async(n,i,r)=>{let o=I4(await $4(n,r.corp.seal.endpoints.approvalStylePreferences),i.selector);return Qe(o,i.includeSecret===!0)}},{name:"seal_webhook_add",description:"新增 Webhook 集成并通过 AI 审批配置保存接口持久化",parameters:v.object({name:v.string().min(1).describe("集成名称"),mode:v.enum(["assisted","semi_automatic","fully_automatic"]).optional(),outgoingResultWebhook:v.string().url().describe("Seal 完成 AI 审核后回调的外部地址"),autoApprovalRate:v.number().int().min(0).max(100).optional(),secret:v.string().min(1).optional().describe("可选;不传则生成 32 位十六进制 secret")}),handler:async(n,i,r)=>{let o=tQ(r.corp),t=await hd(n,o,i,r.corp.seal.endpoints.approvalStylePreferences);return{saved:!0,integration:Qe(t,!0)}}},{name:"seal_webhook_update",description:"更新现有 Webhook 集成并通过 AI 审批配置保存接口持久化",parameters:v.object({selector:v.string().min(1).describe("Webhook 集成 ID 或名称"),name:v.string().min(1).optional(),mode:v.enum(["assisted","semi_automatic","fully_automatic"]).optional(),outgoingResultWebhook:v.string().url().optional(),autoApprovalRate:v.number().int().min(0).max(100).optional(),secret:v.string().min(1).optional(),rotateSecret:v.boolean().optional().describe("生成新 secret;与 secret 二选一")}),handler:async(n,i,r)=>{if(i.secret!==void 0&&i.rotateSecret)throw Error("Webhook secret and rotateSecret cannot be used together");let o=await Pd(n,i.selector,i,r.corp.seal.endpoints.approvalStylePreferences);return{saved:!0,integration:Qe(o,i.secret!==void 0||i.rotateSecret===!0)}}},{name:"seal_webhook_delete",description:"删除指定 Webhook 集成并通过 AI 审批配置保存接口持久化",parameters:v.object({selector:v.string().min(1).describe("Webhook 集成 ID 或名称"),confirm:v.boolean().describe("必须明确传 true 才执行删除")}),handler:async(n,i,r)=>{if(!i.confirm)throw Error("Refusing to delete Webhook integration without confirm=true");let o=await Yd(n,i.selector,r.corp.seal.endpoints.approvalStylePreferences);return{deleted:!0,integration:Qe(o,!1)}}},{name:"seal_approval_runs_search",description:"查询 Seal 审批/审核运行记录总表,并整理合思单据到 Langfuse trace/session 的桥接字段",parameters:v.object({offset:v.number().int().nonnegative().optional(),limit:v.number().int().positive().max(100).optional(),fromTimestamp:v.string().optional(),toTimestamp:v.string().optional(),startDate:v.string().optional().describe("运行记录创建开始时间戳(毫秒),对应前端 startDate"),endDate:v.string().optional().describe("运行记录创建结束时间戳(毫秒),对应前端 endDate"),status:v.string().optional(),taskMode:v.string().optional(),manualApprovalStatus:v.union([v.string(),v.array(v.string())]).optional().describe("人工审核状态,如 TERMINATED 对应已驳回"),sourceDocumentSN:v.string().optional(),sourceDocumentId:v.string().optional(),humanResult:v.string().optional().describe("按人工审批结果做本地包含匹配,如 驳回、通过、reject"),query:v.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配"),includeBridge:v.boolean().optional().describe("是否返回完整 bridge 数组;默认 false,避免长输出")}),handler:async(n,i)=>{let r=i.query?.trim(),o=await Ut(n,NQ({...i,search:r})),t=await AL(n,o.records,{humanResult:i.humanResult});return{...o,records:t.map(qt),...i.includeBridge?{bridge:Mv(t)}:{}}}},{name:"seal_approval_runs_summary",description:"按本地日期/时区汇总 Seal 审批运行记录,返回状态、模式统计和精简记录,避免长 JSON 输出",parameters:v.object({date:v.string().optional().describe("本地日期,格式 YYYY-MM-DD;默认使用 timezone 下的今天"),timezone:v.string().optional().describe("IANA 时区,默认 Asia/Shanghai"),offset:v.number().int().nonnegative().optional(),limit:v.number().int().positive().max(100).optional(),startDate:v.string().optional().describe("运行记录创建开始时间戳(毫秒),对应前端 startDate"),endDate:v.string().optional().describe("运行记录创建结束时间戳(毫秒),对应前端 endDate"),status:v.string().optional(),taskMode:v.string().optional(),manualApprovalStatus:v.union([v.string(),v.array(v.string())]).optional().describe("人工审核状态,如 TERMINATED 对应已驳回"),sourceDocumentSN:v.string().optional(),sourceDocumentId:v.string().optional(),humanResult:v.string().optional().describe("按人工审批结果做本地包含匹配,如 驳回、通过、reject"),query:v.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async(n,i)=>{let r=i.timezone??"Asia/Shanghai",o=i.date??dL(Date.now(),r)??"",t=await Ut(n,{offset:i.offset,limit:i.limit??100,startDate:i.startDate,endDate:i.endDate,status:i.status,taskMode:i.taskMode,manualApprovalStatus:XL(i.manualApprovalStatus,i.humanResult),sourceDocumentSN:i.sourceDocumentSN,sourceDocumentId:i.sourceDocumentId}),e=(await AL(n,t.records,{query:i.query,humanResult:i.humanResult})).filter((u)=>dL(u.createdAt,r)===o);return lQ(e,{date:o,timezone:r,fetched:t.records.length,total:t.total})}},{name:"seal_approval_run_get",description:"获取 Seal 单条审批/审核运行记录详情;可用 fields 只取 metadata、document.fields、result.summary 等局部字段",parameters:v.object({recordId:v.string().describe("Seal approval run record ID"),fields:v.union([v.string(),v.array(v.string())]).optional().describe("逗号分隔或数组形式的字段路径,如 metadata、document.fields、result.summary"),summary:v.boolean().optional().describe("返回单据摘要、AI 结果、人工结果和版本号")}),handler:async(n,i)=>{let r=await Li(n,i.recordId);if(i.summary)return vQ(r);let o={...r,aliases:yQ(r),humanResult:_t(r)},t=cL(i.fields);return t.length>0?GL(o,t):o}},{name:"seal_approval_run_cited_rules_get",description:"从审批运行结果中抽取 AI 引用或命中的规则及应用分析",parameters:v.object({recordId:v.string().describe("Seal approval run record ID")}),handler:async(n,i)=>{let r=await Li(n,i.recordId);return $Q(r)}},{name:"seal_approval_run_document_summary_get",description:"返回单据关键字段、附件摘要、AI/人工结果,避免拉取完整原始单据",parameters:v.object({recordId:v.string().describe("Seal approval run record ID")}),handler:async(n,i)=>{let r=await Li(n,i.recordId);return WL(r)}},{name:"seal_approval_run_attachments_get",description:"从审批运行记录中抽取附件、发票附件和字段位置,不返回完整单据正文和规则结果",parameters:v.object({recordId:v.string().describe("Seal approval run record ID"),summary:v.boolean().optional().describe("只返回附件列表摘要")}),handler:async(n,i)=>{let r=await Li(n,i.recordId);return JL(r,{summary:i.summary})}},{name:"seal_approval_run_result_get",description:"返回审批运行结果摘要;summary=true 时只返回 decision、summary、风险点数量、命中规则数量、traceId 等",parameters:v.object({recordId:v.string().describe("Seal approval run record ID"),summary:v.boolean().optional()}),handler:async(n,i)=>{let r=await Li(n,i.recordId);if(i.summary)return Rv(r);return{recordId:r.id,result:r.result}}},{name:"seal_approval_run_url_get",description:"获取合思企业协助链接,按需附带单据链接;支持只取企业协助链接,或按 Seal recordId/合思 sourceDocumentSN 查询单据链接",parameters:v.object({recordId:v.string().optional().describe("Seal approval run record ID"),sourceDocumentSN:v.string().optional().describe("合思/易快报单号"),sourceDocumentId:v.string().optional().describe("合思/易快报源单据 ID")}),handler:async(n,i,r)=>{let o=Boolean(i.recordId||i.sourceDocumentSN||i.sourceDocumentId),t=o?await OQ(n,i):void 0,e=r.corp.source,u=e.type==="hose"?await Tk(r.corp):void 0,l=T(t?.sourceExtendData?.hosecloudViewUrl);return{enterpriseAssistUrl:u,enterpriseUrl:u,hoseDomain:e.type==="hose"?kQ(e.domain):void 0,documentUrl:l,recordId:t?.id,sourceDocumentSN:t?.sourceDocumentSN,sourceDocumentId:t?.sourceDocumentId,sourceSystem:t?.sourceSystem,missing:{enterpriseAssistUrl:u?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:o&&!l?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:v.object({query:v.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:v.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:v.string().optional().describe("模拟批次 ID"),latest:v.boolean().optional().describe("只返回最新一条匹配记录"),fields:v.union([v.string(),v.array(v.string())]).optional().describe("限制返回字段"),limit:v.number().int().positive().max(100).optional(),maxScan:v.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:v.boolean().optional()}),handler:async(n,i)=>{let r=i.sn??i.query;if(!r)throw Error("query or sn is required");let o=await dQ(n,{query:r,sn:i.sn,batchId:i.batchId,latest:i.latest,limit:i.latest?1:i.limit??20,maxScan:i.maxScan??1000}),t=await Promise.all(o.records.map((l)=>Li(n,l.id))),e=cL(i.fields),u=t.map((l)=>AQ(l,e));return{query:r,sourceDocumentSN:i.sn,simulationBatchId:i.batchId,latest:i.latest??!1,total:o.total,scanned:o.scanned,matched:u.length,records:u,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-home tool seal_approval_search --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-home tool seal_approval_context_get --json '{"ruleVersionNumber":14}'`},...i.includeBridge?{bridge:Mv(t)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:v.object({batchId:v.string().describe("simulation batch ID"),query:v.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async(n,i)=>{let r=G4(await g4(n,i.batchId),i.query);return{batchId:i.batchId,count:r.length,records:r.map(qt),bridge:Mv(r)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:v.object({mode:v.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:v.array(v.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:v.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:v.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:v.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:v.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:v.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:v.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:v.array(v.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:v.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:v.record(v.string(),v.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),rawParams:v.record(v.string(),v.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async(n,i)=>{let r=i.mode??"hosecloud",o=i.signKey;if(r==="hosecloud"&&!o){if(o=(await f4(n)).find((l)=>l.signKey)?.signKey,!o)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let t=eQ({mode:r,flowIds:i.flowIds,rejectNodeName:i.rejectNodeName,thinkingDepthOverride:i.thinkingDepthOverride,skipInvoiceGeneration:i.skipInvoiceGeneration,skipExpenseExtraction:i.skipExpenseExtraction,disableAttachmentCache:i.disableAttachmentCache,signKey:o,packageIds:i.packageIds,templateId:i.templateId,schemaConfig:i.schemaConfig,rawParams:i.rawParams});return{...r==="material_pack"?await _d(n,t):await qd(n,t),created:!0,next:{getBatch:"seal-home simulation get <batchId>",getRecords:"seal-home simulation batch-records <batchId>",listBatches:"seal-home simulation list"}}}},{name:"seal_simulation_batches_list",description:"列出 Seal 模拟测试批次摘要(含状态、统计计数与展示摘要)",parameters:v.object({limit:v.number().int().positive().max(100).optional().describe("最多返回批次数量, 默认 50")}),handler:async(n,i)=>{let r=await Ed(n,{limit:i.limit??50});return{count:r.length,batches:r.map(uQ),next:{getBatch:"seal-home simulation get <batchId>",getRecords:"seal-home simulation batch-records <batchId>"}}}},{name:"seal_simulation_batch_get",description:"获取某一次 Seal 模拟测试批次的详情,包含服务端回显的创建参数、展示摘要和任务统计",parameters:v.object({batchId:v.string().describe("simulation batch ID")}),handler:async(n,i)=>{return{batch:await b4(n,i.batchId),next:{getRecords:"seal-home simulation batch-records <batchId>"}}}},{name:"seal_simulation_templates_get",description:"列出 Seal 模拟测试模板(我的模板,保存常用配置快速复用)",parameters:v.object({}),handler:async(n)=>{let i=await Zd(n);return{count:i.length,templates:i.map((r)=>({id:r.id,name:r.name,description:r.description,approvalSystem:r.approvalSystem,hosecloudConfig:r.hosecloudConfig,updatedAt:r.updatedAt})),next:{createBatch:"seal-home simulation create --mode hosecloud --flow-ids ..."}}}},{name:"seal_simulation_integrations_get",description:"查询模拟测试可用的来源集成状态与合思集成选项(signKey 等)",parameters:v.object({}),handler:async(n)=>{let[i,r]=await Promise.all([w4(n),f4(n)]);return{status:i,hosecloudIntegrations:r}}},{name:"seal_simulation_material_package_upload",description:"上传材料包 ZIP 到 Seal 模拟测试;服务端解析 Excel/AI 推断配置并返回材料包 id 与 schemaConfig(字段映射确认后用于创建模拟批次)",parameters:v.object({filePath:v.string().describe("材料包 ZIP 文件路径(含 信息表.xlsx 与附件)")}),handler:async(n,i)=>{if(!i.filePath)throw Error("filePath is required");let r=R5(i.filePath),o=i.filePath.split(/[\\/]/).pop()??"material-pack.zip",t=await Rd(n,{fileName:o,fileBuffer:r});return{materialPackage:t,next:{createBatch:`seal-home simulation create --mode material_pack --package-ids ${t.id} --schema-config schema.json`}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:v.object({recordId:v.string().optional(),sourceDocumentSN:v.string().optional(),sourceDocumentId:v.string().optional(),simulationBatchId:v.string().optional(),limit:v.number().int().positive().max(100).optional()}),handler:async(n,i)=>{let o=(i.simulationBatchId?await g4(n,i.simulationBatchId):(await Ut(n,{limit:i.limit??50,search:i.sourceDocumentSN??i.sourceDocumentId,sourceDocumentSN:i.sourceDocumentSN,sourceDocumentId:i.sourceDocumentId})).records).filter((t)=>GQ(t,{recordId:i.recordId,sourceDocumentSN:i.sourceDocumentSN,sourceDocumentId:i.sourceDocumentId}));return{count:o.length,records:o.map(qt),bridge:Mv(o)}}},{name:"seal_simulation_batch_wait",description:"等待 Seal 模拟测试批次完成(轮询状态直到 completed/failed/canceled 或超时)",parameters:v.object({batchId:v.string().describe("模拟批次 ID"),timeout:v.string().default("10m").describe("最长等待时间, 默认 10m"),pollInterval:v.string().default("2s").describe("轮询间隔, 默认 2s")}),handler:async(n,i)=>{let r=fL(i.timeout??"10m"),o=fL(i.pollInterval??"2s"),t=Date.now();while(!0){let e=await b4(n,i.batchId),u=(e.status??"").toLowerCase();if(["completed","failed","cancelled","canceled"].includes(u))return{batch:e,completed:!0,status:u,elapsedMs:Date.now()-t,next:{getRecords:`seal-home simulation batch-records ${i.batchId}`}};if(Date.now()-t>=r)throw Error(`等待模拟批次 ${i.batchId} 超时(已等待 ${(Date.now()-t)/1000}s)。可稍后执行 seal-home simulation get ${i.batchId} 查看状态`);await new Promise((l)=>setTimeout(l,o))}}},{name:"seal_simulation_batch_clean",description:"删除模拟测试批次产生的测试数据",parameters:v.object({batchId:v.string().describe("模拟批次 ID")}),handler:async(n,i)=>{let r=await md(n,i.batchId);return{batchId:i.batchId,cleaned:!0,result:r}}},{name:"seal_simulation_specifications_list",description:"列出指定合思集成可用的单据模板列表",parameters:v.object({signKey:v.string().optional().describe("合思集成 sign-key")}),handler:async(n,i)=>{let r=await Md(n,i.signKey);return{count:r.length,specifications:r}}},{name:"seal_deploy_hosecloud_requirements",description:"获取合思出站发布所需配置字段与说明",parameters:v.object({}),handler:async()=>{return{input:`JSON via --json '{"apiKey":"...","apiSecret":"...","mode":"assisted"}'`,questions:[{field:"apiOrigin",prompt:"使用哪一种合思版本或 API 环境?(production/custom)",required:!0,default:"production"},{field:"customApiUrl",prompt:"自定义环境的 API 地址是什么?",requiredWhen:"apiOrigin=custom"},{field:"apiKey",prompt:"合思 API Key(appKey)是什么?",required:!0,secret:!0},{field:"apiSecret",prompt:"合思 API Secret(appSecurity)是什么?",required:!0,secret:!0},{field:"mode",prompt:"使用全自动、半自动还是辅助审核?(fully_automatic/semi_automatic/assisted)",required:!0,default:"assisted"},{field:"autoApprovalRate",prompt:"自动审批比例是多少?(0-100)",requiredWhen:"mode!=assisted"},{field:"rejectResubmitMethod",prompt:"驳回重提后从哪个节点继续?(node_default/to_ebot/from_start)"},{field:"autoApproveNodeNames",prompt:"哪些节点允许自动审批?(string[])"},{field:"outboundName",prompt:"合思出站消息名称是什么?",default:"SealAI 审批"}]}}},{name:"seal_deploy_hosecloud_list",description:"列出当前已配置的合思集成列表",parameters:v.object({}),handler:async(n)=>{let r=((await Gn(n)).integrations??[]).filter((o)=>o.type==="hosecloud");return{count:r.length,integrations:r.map(Zv)}}},{name:"seal_deploy_hosecloud_get",description:"查询单个合思集成配置详情",parameters:v.object({signKey:v.string().describe("合思集成 sign-key")}),handler:async(n,i)=>{let o=((await Gn(n)).integrations??[]).find((t)=>t.type==="hosecloud"&&t.signKey===i.signKey);if(!o)throw Error(`未找到合思配置:${i.signKey}`);return Zv(o)}},{name:"seal_deploy_hosecloud_status",description:"检查合思集成与多平台集成状态",parameters:v.object({}),handler:async(n)=>{let i=await w4(n),o=((await Gn(n)).integrations??[]).filter((t)=>t.type==="hosecloud");return{status:i,integrations:o.map(Zv)}}},{name:"seal_deploy_hosecloud_configure",description:"校验合思凭据并保存合思集成配置",parameters:v.object({apiKey:v.string().describe("合思 API Key"),apiSecret:v.string().describe("合思 API Secret"),signKey:v.string().optional().describe("集成 signKey,不提供则自动生成"),outboundName:v.string().optional().describe("出站消息名称"),specificationId:v.string().optional(),specificationName:v.string().optional(),mode:v.enum(["fully_automatic","semi_automatic","assisted"]).default("assisted"),autoApprovalRate:v.number().min(0).max(100).optional(),rejectResubmitMethod:v.enum(["node_default","to_ebot","from_start"]).optional(),autoApproveNodeNames:v.array(v.string()).optional(),apiOrigin:v.string().default("production"),customApiUrl:v.string().optional()}),handler:async(n,i)=>{if(i.apiOrigin==="custom"&&!i.customApiUrl)throw Error("自定义合思环境必须提供 customApiUrl");let r=await zd(n,{apiKey:i.apiKey,apiSecret:i.apiSecret,apiOrigin:i.apiOrigin,customApiUrl:i.customApiUrl}),o=await Gn(n),t=i.signKey??x5(6).toString("hex"),e={type:"hosecloud",...i,signKey:t,corporationId:r.corporationId},u=(o.integrations??[]).filter((l)=>l.type!=="hosecloud"||l.signKey!==t);return u.push(e),await Tt(n,{...o,integrationSystem:"hosecloud",integrations:u}),{integration:Zv(e)}}},{name:"seal_deploy_hosecloud_sync",description:"同步合思出站消息配置并完成发布",parameters:v.object({signKey:v.string().describe("合思集成 sign-key")}),handler:async(n,i,r)=>{let t=((await Gn(n)).integrations??[]).find((l)=>l.type==="hosecloud"&&l.signKey===i.signKey);if(!t)throw Error(`未找到合思配置:${i.signKey}`);let e=(r.corp.seal.url??`https://${r.corp.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),u=await Cd(n,{signKey:i.signKey,webhookUrl:`${e}/api/hosecloud/outbound?config_id=${encodeURIComponent(i.signKey)}`,completionWebhookUrl:`${e}/api/hosecloud/flow/completion?config_id=${encodeURIComponent(i.signKey)}`,messageName:t.outboundName??"SealAI 审批",mode:t.mode??"assisted"});return{signKey:i.signKey,synced:!0,result:u}}},{name:"seal_preference_get",description:"获取当前决策偏好、思考深度偏好与绑定的规则版本",parameters:v.object({}),handler:async(n)=>{let i=await Gn(n);return{decisionPreferences:i.decisionPreferences,thinkingDepthPreference:i.thinkingDepthPreference,ruleSetVersionId:i.ruleSetVersionId}}},{name:"seal_preference_decision_update",description:"修改审核决策偏好(立即影响当前运行中的审核智能体及后续决策)",parameters:v.object({explicitApprove:v.string().optional(),explicitReject:v.string().optional(),exemptApprove:v.string().optional(),review:v.string().optional()}),handler:async(n,i)=>{let r=await Gn(n),o={...r,decisionPreferences:{...r.decisionPreferences,...i}};return await Tt(n,o),{decisionPreferences:o.decisionPreferences}}},{name:"seal_preference_thinking_depth_set",description:"修改默认思考深度(medium 或 high)",parameters:v.object({defaultLevel:v.enum(["medium","high"]).describe("默认思考深度")}),handler:async(n,i)=>{let r=await Gn(n),o={...r,thinkingDepthPreference:{defaultLevel:i.defaultLevel,routingPolicies:r.thinkingDepthPreference?.routingPolicies??[]}};return await Tt(n,o),{thinkingDepthPreference:o.thinkingDepthPreference}}},{name:"seal_preference_thinking_depth_policies_list",description:"列出思考深度路由策略列表",parameters:v.object({}),handler:async(n)=>{return{policies:(await Gn(n)).thinkingDepthPreference?.routingPolicies??[]}}},{name:"seal_preference_thinking_depth_policies_upsert",description:"新增或修改思考深度路由策略",parameters:u4,handler:async(n,i)=>{let r=await Gn(n),t=(r.thinkingDepthPreference?.routingPolicies??[]).filter((u)=>u.id!==i.id);t.push(i);let e={...r,thinkingDepthPreference:{defaultLevel:r.thinkingDepthPreference?.defaultLevel??"medium",routingPolicies:t}};return await Tt(n,e),{policy:i,policies:t}}},{name:"seal_preference_thinking_depth_policies_remove",description:"删除一条思考深度路由策略",parameters:v.object({policyId:v.string().describe("路由策略 ID")}),handler:async(n,i)=>{let r=await Gn(n),o=r.thinkingDepthPreference?.routingPolicies??[],t=o.filter((u)=>u.id!==i.policyId);if(t.length===o.length)throw Error(`未找到路由策略:${i.policyId}`);let e={...r,thinkingDepthPreference:{defaultLevel:r.thinkingDepthPreference?.defaultLevel??"medium",routingPolicies:t}};return await Tt(n,e),{removedId:i.policyId,policies:t}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:v.object({since:v.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:v.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:v.string().optional(),sourceSystem:v.string().optional(),taskMode:v.string().optional()}),handler:async(n,i)=>{let r=await Ut(n,{limit:1000,status:i.status,sourceSystem:i.sourceSystem,taskMode:i.taskMode}),o=i.dedupeBy??"sourceDocumentSN",t=r.records,e={},u={},l=new Set;for(let $ of t){let I=$.status??"unknown";e[I]=(e[I]??0)+1;let g=$.sourceSystem??"unknown";u[g]=(u[g]??0)+1;let b=$[o];if(b)l.add(String(b))}return{total:t.length,dedupeBy:o,unique:l.size,byStatus:e,bySourceSystem:u}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:v.object({status:v.string().optional(),sourceSystem:v.string().optional(),taskMode:v.string().optional(),search:v.string().optional()}),handler:async(n,i)=>{let r=await Ut(n,{limit:1,status:i.status,sourceSystem:i.sourceSystem,taskMode:i.taskMode,search:i.search});return{total:r.total??r.records.length}}}],NL=new Map(St.map((n)=>[n.name,n])),a5=["seal_whoami","seal_approval_search","seal_approval_context_get"],s5=["seal_session_get","seal_approval_rules_list","seal_approval_rules_clear","seal_approval_rule_create","seal_approval_rule_update","seal_approval_rule_delete","seal_approval_rule_versions_list","seal_approval_rule_version_get","seal_approval_rule_get","seal_approval_rule_version_publish","seal_approval_documents_list","seal_approval_document_get","seal_approval_document_create","seal_approval_document_update","seal_approval_style_preferences_get","seal_approval_style_preferences_update","seal_webhook_list","seal_webhook_get","seal_webhook_add","seal_webhook_update","seal_webhook_delete","seal_approval_runs_summary","seal_approval_runs_stats","seal_approval_runs_count","seal_approval_run_get","seal_approval_run_cited_rules_get","seal_approval_run_document_summary_get","seal_approval_run_attachments_get","seal_approval_run_result_get","seal_approval_run_url_get","seal_approval_run_pick","seal_simulation_batch_records_get","seal_simulation_batch_create","seal_simulation_batch_wait","seal_simulation_batch_clean","seal_simulation_batches_list","seal_simulation_batch_get","seal_simulation_templates_get","seal_simulation_integrations_get","seal_simulation_specifications_list","seal_simulation_material_package_upload","seal_deploy_hosecloud_requirements","seal_deploy_hosecloud_list","seal_deploy_hosecloud_get","seal_deploy_hosecloud_status","seal_deploy_hosecloud_configure","seal_deploy_hosecloud_sync","seal_preference_get","seal_preference_decision_update","seal_preference_thinking_depth_set","seal_preference_thinking_depth_policies_list","seal_preference_thinking_depth_policies_upsert","seal_preference_thinking_depth_policies_remove","seal_approval_run_langfuse_bridge_get"],yL={"session.get":"seal_session_get","rule.list":"seal_approval_rules_list","rule.clear":"seal_approval_rules_clear","rule.create":"seal_approval_rule_create","rule.update":"seal_approval_rule_update","rule.delete":"seal_approval_rule_delete","rule.versions.list":"seal_approval_rule_versions_list","rule.version.get":"seal_approval_rule_version_get","rule.get":"seal_approval_rule_get","rule.publish":"seal_approval_rule_version_publish","doc.list":"seal_approval_documents_list","doc.get":"seal_approval_document_get","doc.create":"seal_approval_document_create","doc.update":"seal_approval_document_update","style.get":"seal_approval_style_preferences_get","style.update":"seal_approval_style_preferences_update","webhook.list":"seal_webhook_list","webhook.get":"seal_webhook_get","webhook.add":"seal_webhook_add","webhook.update":"seal_webhook_update","webhook.delete":"seal_webhook_delete","runs.summary":"seal_approval_runs_summary","runs.stats":"seal_approval_runs_stats","runs.count":"seal_approval_runs_count","runs.get":"seal_approval_run_get","runs.citedRules":"seal_approval_run_cited_rules_get","runs.documentSummary":"seal_approval_run_document_summary_get","runs.attachments":"seal_approval_run_attachments_get","runs.result":"seal_approval_run_result_get","runs.url":"seal_approval_run_url_get","runs.pick":"seal_approval_run_pick","batch.records.get":"seal_simulation_batch_records_get","batch.create":"seal_simulation_batch_create","batch.wait":"seal_simulation_batch_wait","batch.clean":"seal_simulation_batch_clean","batch.list":"seal_simulation_batches_list","batch.get":"seal_simulation_batch_get","batch.templates.list":"seal_simulation_templates_get","batch.integrations.get":"seal_simulation_integrations_get","batch.specifications.list":"seal_simulation_specifications_list","batch.materialPackageUpload":"seal_simulation_material_package_upload","deploy.hosecloud.requirements":"seal_deploy_hosecloud_requirements","deploy.hosecloud.list":"seal_deploy_hosecloud_list","deploy.hosecloud.get":"seal_deploy_hosecloud_get","deploy.hosecloud.status":"seal_deploy_hosecloud_status","deploy.hosecloud.configure":"seal_deploy_hosecloud_configure","deploy.hosecloud.sync":"seal_deploy_hosecloud_sync","preference.get":"seal_preference_get","preference.decision.update":"seal_preference_decision_update","preference.thinkingDepth.set":"seal_preference_thinking_depth_set","preference.thinkingDepth.policies.list":"seal_preference_thinking_depth_policies_list","preference.thinkingDepth.policies.upsert":"seal_preference_thinking_depth_policies_upsert","preference.thinkingDepth.policies.remove":"seal_preference_thinking_depth_policies_remove","langfuse.bridge.get":"seal_approval_run_langfuse_bridge_get"},Uz=[...a5.map((n)=>Fe(n)),{...Fe("seal_approval_runs_search"),name:"seal_runs_search",description:"查询 Seal 审批/审核运行记录,返回精简记录并按需提供 Langfuse trace/session 关联"},{name:"seal_action",description:"Seal 低频管理操作统一入口。传 action=help 查看可用动作;支持 rule/doc/style/webhook/runs/batch/langfuse 等管理与诊断操作。",parameters:v.object({action:v.string().describe("动作名,如 help、rule.create、doc.update、webhook.list、runs.summary、langfuse.bridge.get;也兼容旧 tool 名"),payload:v.record(v.string(),v.unknown()).optional().describe("动作参数对象")}),handler:async(n,i,r)=>nQ(n,i,r)}];function jn(n,i={}){if(i.includeMcpAliases&&n==="seal_runs_search")return Fe("seal_approval_runs_search");return NL.get(n)}async function nQ(n,i,r){let o=i.action?.trim();if(!o||o==="help")return wL(i.payload?.topic);let t=yL[o]??o;if(!iQ(t))return{error:`Unsupported seal_action action: ${o}`,help:wL(i.payload?.topic)};let e=Fe(t),u=i.payload??{};return e.handler(n,u,r)}function wL(n){let i=typeof n==="string"?n.trim():void 0,r=Object.entries(yL).filter(([o])=>!i||o.startsWith(`${i}.`)).map(([o,t])=>{let e=Fe(t);return{action:o,toolName:t,description:e.description}});return{usage:"seal_action({ action, payload })",topics:["session","rule","doc","style","webhook","runs","batch","langfuse"],actions:r}}function Fe(n){let i=NL.get(n);if(!i)throw Error(`Missing Seal tool: ${n}`);return i}function iQ(n){return s5.includes(n)}function Qe(n,i){return i?n:{...n,secret:"<redacted>"}}function tQ(n){if(n.seal.url)return n.seal.url;if(n.source.type==="hose")return Je(n,n.source);return n.source.sealUrl}function rQ(n,i){let r=n.rules.length;if(i.countOnly||i.limit===0)return{count:r};let o=i.offset??0,t=n.rules.slice(o,i.limit===void 0?void 0:o+i.limit),e=i.fields;return{count:r,hasPendingDeletes:n.hasPendingDeletes,rules:e?t.map((u)=>oQ(u,e)):t}}function oQ(n,i){let r={};for(let o of i)if(n[o]!==void 0)r[o]=n[o];return r}function fL(n){let i=n.match(/^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)?$/i);if(!i||!i[1])return 600000;let r=parseFloat(i[1]);switch((i[2]??"s").toLowerCase()){case"ms":return r;case"s":return r*1000;case"m":return r*60*1000;case"h":return r*3600*1000;case"d":return r*86400*1000;default:return r*1000}}function Zv(n){return Object.fromEntries(Object.entries(n).map(([i,r])=>[i,["apiKey","apiSecret","secret"].includes(i)&&typeof r==="string"?"***":r]))}function eQ(n){let i=n.sourceSystem??n.mode??"hosecloud",r={skipInvoiceGeneration:n.skipInvoiceGeneration??!0,skipExpenseExtraction:n.skipExpenseExtraction??!0,thinkingDepthOverride:n.thinkingDepthOverride??"default",disableAttachmentCache:n.disableAttachmentCache??!1},o=n.flowIds??(typeof n.documentSn==="string"?n.documentSn.split(",").map((t)=>t.trim()).filter(Boolean):n.documentSn);if(i==="hosecloud"){if(!o?.length&&n.startTime===void 0)throw Error("hosecloud 模式需要提供 flowIds(单号列表)");if(Object.assign(r,{dataCollectionMode:"2",rejectNodeName:n.rejectNodeName??null,sourceSystem:"hosecloud"}),o?.length)r.flowIds=o;if(n.signKey)r.signKey=n.signKey;if(n.startTime!==void 0)r.startTime=n.startTime;if(n.endTime!==void 0)r.endTime=n.endTime;if(n.status)r.status=n.status;if(n.limit)r.limit=n.limit}else if(i==="material_pack"||i==="material-pack"){let t=n.packageIds??(n.packageId?[n.packageId]:void 0);if(!t?.length)throw Error("material_pack 模式需要提供 packageIds(材料包 id)");let e=n.templateId??n.schemaConfig?.id;if(!e)throw Error("material_pack 模式需要提供 templateId(或 schemaConfig.id)");if(Object.assign(r,{templateId:e,packageIds:t,approvalCode:n.approvalCode??"material_pack",nodeId:n.nodeId??"material_pack",runMode:n.runMode??"import_and_simulate"}),n.schemaConfig!==void 0)r.schemaConfig=n.schemaConfig}else if(i==="weaver")Object.assign(r,{sourceSystem:"weaver",workflowTypeId:n.workflowTypeId,requestIds:n.requestIds,flowStatusList:n.flowStatusList,nodeId:n.nodeId,startTime:n.startTime,endTime:n.endTime,status:n.status,limit:n.limit??100,rejectNodeName:n.rejectNodeName??null});else if(i==="helios")Object.assign(r,{sourceSystem:"helios",documentType:n.documentType,businessCodes:n.businessCodes,rejectNodeName:n.rejectNodeName??null});else if(i==="maycur"||i==="maycur-standard")Object.assign(r,{sourceSystem:i,formCodes:n.formCodes??o,createdAtStart:n.startTime,createdAtEnd:n.endTime,formSubTypeBizCode:n.formSubTypeBizCode,formStatus:n.formStatus,pageNo:n.pageNo??1,pageSize:n.pageSize??100,signKey:n.signKey});else if(i==="feishu")Object.assign(r,{sourceSystem:"feishu",approvalCode:n.approvalCode,nodeId:n.nodeId,startTime:n.startTime,endTime:n.endTime,status:n.status,limit:n.limit??100,signKey:n.signKey});else Object.assign(r,{sourceSystem:i});if(n.rawParams)Object.assign(r,n.rawParams);return r}function uQ(n){return{id:n.id,status:n.status,approvalCode:n.approvalCode,sourceSystem:n.sourceSystem,totalCount:n.totalCount,processedCount:n.processedCount,successCount:n.successCount,failedCount:n.failedCount,createdCount:n.createdCount,createFailedCount:n.createFailedCount,requestSummary:n.requestSummary,resultSummary:n.resultSummary,createdAt:n.createdAt}}function qt(n){let i=n.sourceDocumentSN,r=_t(n),o=Rv(n);return{id:n.id,tenantId:n.tenantId,agentId:n.agentId,status:n.status,taskMode:n.taskMode,finalExecutionMode:n.finalExecutionMode,sourceSystem:n.sourceSystem,sourceDocumentSN:i,sourceDocumentId:n.sourceDocumentId,documentId:n.documentId,simulationBatchId:n.sourceExtendData?.simulation_batch_id,langfuseTraceId:n.sourceExtendData?._langfuseTraceId,langfuseSessionFallback:i?`hosecloud-${i}`:void 0,ruleSetVersionNumber:n.ruleSetVersionNumber,ruleSetPublishedAt:n.ruleSetPublishedAt,ruleSetPublishedByName:n.ruleSetPublishedByName,humanResult:r?.value,humanResultPath:r?.path,aiDecision:o.decision,aiSummary:o.summary,createdAt:n.createdAt,updatedAt:n.updatedAt}}function lQ(n,i){return{date:i.date,timezone:i.timezone,fetched:i.fetched,matched:n.length,total:i.total,statusCounts:kL(n,(r)=>r.status??"unknown"),taskModeCounts:kL(n,(r)=>r.taskMode??"unknown"),records:n.map((r)=>{let o=qt(r);return{createdAt:LL(o.createdAt,i.timezone),sourceDocumentSN:o.sourceDocumentSN,sourceDocumentId:o.sourceDocumentId,status:o.status,taskMode:o.taskMode,finalExecutionMode:o.finalExecutionMode,simulationBatchId:o.simulationBatchId,langfuseTraceId:o.langfuseTraceId,langfuseSessionFallback:o.langfuseSessionFallback,ruleSetVersionNumber:o.ruleSetVersionNumber,ruleSetPublishedAt:LL(o.ruleSetPublishedAt,i.timezone),ruleSetPublishedByName:o.ruleSetPublishedByName,humanResult:o.humanResult,humanResultPath:o.humanResultPath,recordId:o.id}})}}function cL(n){if(!n)return[];return(Array.isArray(n)?n:n.split(",")).map((r)=>r.trim()).filter(Boolean)}function GL(n,i){let r={};for(let o of i){if(o==="metadata"){r.metadata=jL(n);continue}let t=mi(n,o);if(t!==void 0)bQ(r,o,t)}return r}function jL(n){let i=qt(n);return{recordId:i.id,tenantId:i.tenantId,agentId:i.agentId,sourceSystem:i.sourceSystem,sourceDocumentSN:i.sourceDocumentSN,sourceDocumentId:i.sourceDocumentId,documentId:i.documentId,status:i.status,taskMode:i.taskMode,finalExecutionMode:i.finalExecutionMode,simulationBatchId:i.simulationBatchId,langfuseTraceId:i.langfuseTraceId,langfuseSessionFallback:i.langfuseSessionFallback,ruleSetVersionNumber:i.ruleSetVersionNumber,ruleSetPublishedAt:i.ruleSetPublishedAt,ruleSetPublishedByName:i.ruleSetPublishedByName,createdAt:i.createdAt,updatedAt:i.updatedAt}}function vQ(n){return{metadata:jL(n),document:WL(n).document,aiResult:Rv(n),manualResult:_t(n)?.value,manualResultPath:_t(n)?.path,ruleSetVersionNumber:n.ruleSetVersionNumber,ruleSetPublishedAt:n.ruleSetPublishedAt,ruleSetPublishedByName:n.ruleSetPublishedByName}}function Rv(n){let i=Rr(n.result);return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,traceId:n.sourceExtendData?._langfuseTraceId,langfuseTraceId:n.sourceExtendData?._langfuseTraceId,decision:zv(i,["decision","manualApproval.decision","manualApproval.result","review.decision","finalDecision"]),summary:zv(i,["summary","result.summary","review.summary","conclusion"]),riskPointCount:UL(i,["riskPoints","risks","risk_points","review.riskPoints"]),matchedRuleCount:UL(i,["matchedRules","hitRules","ruleResults","rules","review.matchedRules"])}}function WL(n){let i=Rr(n.document),r=fQ(n.document),o=r.map((t)=>`${t.label??t.path??""}:${t.value??""}`).join(`
|
||
`);return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,document:Dt({id:i?.id,sn:i?.sn??i?.sourceDocumentSN??n.sourceDocumentSN,title:i?.title??i?.name,template:zv(i,["template.name","templateName","form.name","formName","formTitle"]),amount:mv(r,["金额","报销金额","付款金额","合计","价税合计"])??zv(i,["amount","totalAmount","expenseAmount"]),expenseType:mv(r,["费用类型","费用类别","报销类型"]),costCompany:mv(r,["费用承担公司","承担公司","成本中心","费用归属"]),payee:mv(r,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:r.slice(0,30)}),invoices:cQ(n),attachments:JL(n,{summary:!0}).attachments,aiResult:Rv(n),manualResult:_t(n)?.value,hints:Dt({amountMentions:DL(o,["金额","合计","税率"],8),partyMentions:DL(o,["买方","卖方","甲方","乙方","收款"],8)})}}function JL(n,i={}){let r=[["document",n.document],["result",n.result],["pipelineData",n.pipelineData],["sourceExtendData",n.sourceExtendData]],o=[],t=new Set;for(let[e,u]of r)A4(u,e,o,t);return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,count:o.length,attachments:i.summary?o.map((e)=>Dt({path:e.path,kind:e.kind,fileName:e.fileName,mimeType:e.mimeType,fileId:e.fileId,sourceField:e.sourceField})):o}}function $Q(n){let i=[["result.citedRules",mi(n,"result.citedRules")],["result.matchedRules",mi(n,"result.matchedRules")],["result.ruleResults",mi(n,"result.ruleResults")],["result.rules",mi(n,"result.rules")],["pipelineData.citedRules",mi(n,"pipelineData.citedRules")],["pipelineData.matchedRules",mi(n,"pipelineData.matchedRules")]],r=[],o=new Set;for(let[t,e]of i)(Array.isArray(e)?e:e&&typeof e==="object"?Object.values(e):[]).forEach((l,$)=>{let I=Rr(l);if(!I)return;let g=T(I.runtimeRuleId)??T(I.runtimeId)??T(I.id)??T(I.ruleId),b=T(I.ruleCode)??T(I.code)??(g?SQ(g):void 0),w=Dt({runtimeRuleId:g,ruleCode:b,versionNumber:wQ(I.versionNumber)??n.ruleSetVersionNumber,scope:T(I.scope),strictness:T(I.strictness),appliedAnalysis:I.appliedAnalysis??I.analysis??I.reasoning,checkResult:I.checkResult??I.result??I.decision,findings:I.findings??I.riskPoints??I.evidence,sourcePath:`${t}.${$}`}),f=JSON.stringify(w);if(!o.has(f))o.add(f),r.push(w)});return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,ruleSetVersionNumber:n.ruleSetVersionNumber,count:r.length,rules:r}}function A4(n,i,r,o){if(Array.isArray(n)){n.forEach((e,u)=>A4(e,`${i}.${u}`,r,o));return}let t=Rr(n);if(!t)return;if(IQ(t,i)){let e=Dt({path:i,fieldPath:i,kind:gQ(i,t),fileName:T(t.fileName)??T(t.filename)??T(t.name)??T(t.originalName),mimeType:T(t.mimeType)??T(t.mimetype)??T(t.contentType),fileId:T(t.fileId)??T(t.id)??T(t.attachmentId),ossPath:T(t.ossPath)??T(t.ossKey)??T(t.key),url:T(t.url)??T(t.signedUrl)??T(t.downloadUrl)??T(t.previewUrl),invoiceId:T(t.invoiceId),sourceField:T(t.fieldName)??T(t.label)}),u=JSON.stringify(e);if(!o.has(u))o.add(u),r.push(e)}for(let[e,u]of Object.entries(t))A4(u,`${i}.${e}`,r,o)}function IQ(n,i){let r=Object.keys(n).map((e)=>e.toLowerCase());return/(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(i)&&["filename","fileName","mimeType","mimetype","contentType","fileId","ossPath","signedUrl","downloadUrl","previewUrl","attachmentId"].some((e)=>r.includes(e.toLowerCase()))}function gQ(n,i){let r=`${n} ${T(i.type)??""}`.toLowerCase();if(r.includes("invoice")||r.includes("发票"))return"invoice";if(r.includes("receipt"))return"receipt";return"attachment"}function zv(n,i){if(!n)return;for(let r of i){let o=mi(n,r);if(o!==void 0)return o}return}function UL(n,i){if(!n)return 0;for(let r of i){let o=mi(n,r);if(Array.isArray(o))return o.length;if(o&&typeof o==="object")return Object.keys(o).length;if(typeof o==="number")return o}return 0}function mi(n,i){return i.split(".").reduce((r,o)=>{if(r===void 0||r===null)return;if(Array.isArray(r)){let t=Number(o);return Number.isInteger(t)?r[t]:void 0}if(typeof r==="object")return r[o];return},n)}function bQ(n,i,r){let o=i.split("."),t=n;for(let e of o.slice(0,-1)){let u=t[e];if(!u||typeof u!=="object"||Array.isArray(u))t[e]={};t=t[e]}t[o[o.length-1]??i]=r}function Dt(n){return Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0))}function Rr(n){return n&&typeof n==="object"&&!Array.isArray(n)?n:void 0}function wQ(n){return typeof n==="number"&&Number.isFinite(n)?n:void 0}function fQ(n){let i=[];return O4(n,"document",i),i}function O4(n,i,r){if(Array.isArray(n)){n.forEach((u,l)=>O4(u,`${i}.${l}`,r));return}let o=Rr(n);if(!o)return;let t=T(o.label)??T(o.name)??T(o.title)??T(o.fieldName),e=o.value??o.displayValue??o.text??o.content;if(t&&e!==void 0&&typeof e!=="object")r.push(Dt({path:i,label:t,value:e,type:T(o.type)??T(o.fieldType)}));for(let[u,l]of Object.entries(o)){if(u==="attachments")continue;O4(l,`${i}.${u}`,r)}}function mv(n,i){return n.find((o)=>{let t=T(o.label)??"";return i.some((e)=>t.includes(e))})?.value}function cQ(n){let i=[];return Cv(n.result,"result",i),Cv(n.document,"document",i),i.slice(0,20)}function Cv(n,i,r){if(Array.isArray(n)){n.forEach((t,e)=>Cv(t,`${i}.${e}`,r));return}let o=Rr(n);if(!o)return;if(/invoice|发票/i.test(i))r.push(Dt({path:i,fileName:T(o.fileName)??T(o.filename)??T(o.name),buyer:o.buyer??o.buyerName??o.purchaserName,seller:o.seller??o.sellerName,amount:o.amount??o.totalAmount??o.total,taxRate:o.taxRate,category:o.category??o.type}));for(let[t,e]of Object.entries(o))Cv(e,`${i}.${t}`,r)}function DL(n,i,r){return n.split(/\r?\n/).filter((o)=>i.some((t)=>o.includes(t))).slice(0,r)}function Mv(n){return n.map((i)=>{let r=qt(i);return{recordId:r.id,tenantId:r.tenantId,agentId:r.agentId,sourceDocumentSN:r.sourceDocumentSN,sourceDocumentId:r.sourceDocumentId,simulationBatchId:r.simulationBatchId,langfuseTraceId:r.langfuseTraceId,langfuseSessionFallback:r.langfuseSessionFallback,ruleSetVersionNumber:r.ruleSetVersionNumber,ruleSetPublishedAt:r.ruleSetPublishedAt,ruleSetPublishedByName:r.ruleSetPublishedByName,resolution:r.langfuseTraceId?"trace":r.langfuseSessionFallback?"session-fallback":"unresolved"}})}function D4(n){return{id:n.id,tenantId:n.tenantId,versionNumber:n.versionNumber,versionName:n.versionName,publishedBy:n.publishedBy,publishedByName:n.publishedByName,rulesCount:n.rules.length,publishedAt:n.publishedAt,createdAt:n.createdAt}}async function UQ(n,i){if(i.recordId&&!i.versionId&&!i.versionNumber&&!i.latest){let r=await Li(n,i.recordId);if(!r.ruleSetVersionNumber)throw Error(`Approval run ${i.recordId} has no ruleSetVersionNumber`);return k4(n,{versionNumber:r.ruleSetVersionNumber})}return k4(n,i)}function DQ(n,i){let r=S4(i.code),o=HL(i.runtimeId),t=r?Number(r.slice(1)):o;if(!t||t<1)throw Error("Pass --code '#0038' or --runtime-id rule-205");let e=n.rules.find(($,I)=>{let g=$;return S4(T(g.code)??T(g.ruleCode))===r||I+1===t});if(!e)return;let u=e,l=n.rules.indexOf(e)+1;return Dt({runtimeRuleId:T(u.runtimeRuleId)??`rule-${l}`,ruleCode:S4(T(u.code)??T(u.ruleCode))??y4(l),versionId:n.id,versionNumber:n.versionNumber,versionName:n.versionName,publishedAt:n.publishedAt,publishedByName:n.publishedByName,description:e.description,scope:e.scope,strictness:e.strictness,status:T(u.status)})}function S4(n){if(!n)return;let i=n.match(/\d+/)?.[0];return i?y4(Number(i)):n}function HL(n){if(!n)return;let i=n.match(/(\d+)$/);return i?Number(i[1]):void 0}function SQ(n){let i=HL(n);return i?y4(i):void 0}function y4(n){return`#${String(n).padStart(4,"0")}`}function AQ(n,i){let r=qt(n),o={recordId:r.id,sourceDocumentSN:r.sourceDocumentSN,sourceDocumentId:r.sourceDocumentId,simulationBatchId:r.simulationBatchId,status:r.status,taskMode:r.taskMode,ruleSetVersionNumber:r.ruleSetVersionNumber,langfuseTraceId:r.langfuseTraceId,manualResult:r.humanResult,aiDecision:r.aiDecision,aiSummary:r.aiSummary,createdAt:r.createdAt};if(i.length===0)return o;return GL(o,i)}async function OQ(n,i){if(i.recordId)return Li(n,i.recordId);let o=(await Ut(n,{limit:1,search:i.sourceDocumentSN??i.sourceDocumentId,sourceDocumentSN:i.sourceDocumentSN,sourceDocumentId:i.sourceDocumentId})).records[0];if(!o){let t=i.sourceDocumentSN?`sourceDocumentSN ${i.sourceDocumentSN}`:`sourceDocumentId ${i.sourceDocumentId}`;throw Error(`Approval run not found for ${t}`)}return Li(n,o.id)}function kQ(n){return n.replace(/\/+$/,"")}function T(n){return typeof n==="string"&&n.trim()?n:void 0}async function dQ(n,i){let r=Math.min(100,Math.max(i.limit,20)),o=[],t,e=0;while(e<i.maxScan&&o.length<i.limit){let u=await Ut(n,{offset:e,limit:Math.min(r,i.maxScan-e),search:i.sn??i.query,sourceDocumentSN:i.sn});t=u.total,e+=u.records.length;let l=G4(u.records,i.query).filter(($)=>!i.sn||$.sourceDocumentSN===i.sn).filter(($)=>!i.batchId||$.sourceExtendData?.simulation_batch_id===i.batchId);if(o.push(...l),u.records.length===0||t!==void 0&&e>=t)break}return o.sort((u,l)=>SL(l.createdAt)-SL(u.createdAt)),{total:t,scanned:e,records:o.slice(0,i.latest?1:i.limit)}}function SL(n){if(typeof n==="number")return n;if(typeof n==="string"){let i=Date.parse(n);return Number.isFinite(i)?i:0}return 0}async function k4(n,i){if(i.versionId)return Ye(n,i.versionId);let r=await Vt(n),o=i.versionNumber?r.find((t)=>t.versionNumber===i.versionNumber):r[0];if(!o)throw Error(i.versionNumber?`Rule version not found: ${i.versionNumber}`:"No rule versions found");return o}function G4(n,i){let r=i?.trim().toLowerCase();if(!r)return n;return n.filter((o)=>{return[o.id,o.sourceDocumentSN,o.sourceDocumentId,o.documentId,o.sourceExtendData?._langfuseTraceId,o.sourceExtendData?.simulation_batch_id,o.status,o.taskMode,o.finalExecutionMode,o.sourceSystem,o.ruleSetVersionNumber,o.ruleSetPublishedByName].some((e)=>d4(e,r))||L4(o,r)})}function d4(n,i){if(n===null||n===void 0)return!1;if(typeof n==="string"||typeof n==="number"||typeof n==="boolean")return String(n).toLowerCase().includes(i);return!1}function L4(n,i,r=0){if(r>6)return!1;if(d4(n,i))return!0;if(!n||typeof n!=="object")return!1;if(Array.isArray(n))return n.some((o)=>L4(o,i,r+1));return Object.entries(n).some(([o,t])=>d4(o,i)||L4(t,i,r+1))}function LQ(n,i){let r=i?.trim().toLowerCase();if(!r)return n;return n.filter((o)=>_t(o)?.value.toLowerCase().includes(r))}function NQ(n){return{...n,manualApprovalStatus:XL(n.manualApprovalStatus,n.humanResult)}}function XL(n,i){if(n)return n;let r=i?.trim().toLowerCase();if(!r)return;if(["驳回","已驳回","拒绝","不通过","terminated","reject","rejected","denied"].includes(r))return"TERMINATED";return}async function AL(n,i,r){let o=G4(i,r.query);if(!r.humanResult?.trim())return o;let t=await Promise.all(o.map(async(e)=>{if(_t(e))return e;try{return await Li(n,e.id)}catch{return e}}));return LQ(t,r.humanResult)}function yQ(n){return{originalDocumentData:{path:"document",frontendLabel:"单据原始数据",description:"前端详情页展示的单据原始数据对象",id:n.document?.id??n.documentId,sourceDocumentSN:n.document?.sourceDocumentSN??n.sourceDocumentSN,sourceDocumentId:n.document?.sourceDocumentId??n.sourceDocumentId},aiDocumentFields:{path:"document.fields",frontendLabel:"AI 看的单据",description:"AI 审核实际读取的字段数组,即单据原始数据中的 fields",fieldCount:n.document?.fields?.length},aiDocument:{path:"document.fields",frontendLabel:"AI 看的单据",description:"兼容别名,等同于 aiDocumentFields",aliasOf:"aiDocumentFields",fieldCount:n.document?.fields?.length},sourceDocument:{path:"sourceExtendData.hosecloudViewUrl",description:"合思原始单据入口;详情响应中只有入口和源单据 ID,不包含完整原始单据 JSON",sourceSystem:n.sourceSystem,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,originalDocumentId:n.sourceExtendData?.original_document_id,viewUrl:n.sourceExtendData?.hosecloudViewUrl},aiResult:{path:"result",description:"AI 最终审核结构化结果"},aiAuditLog:{path:"pipelineData.logs",description:"AI 审核过程日志"},manualApproval:{path:"manualApprovalRecord",description:"人工审核结果、节点和驳回原因"}}}function _t(n){let i=[["result",n.result],["pipelineData",n.pipelineData]];for(let[r,o]of i){let t=N4(o,r);if(t)return t}return}function N4(n,i,r=0){if(r>8||n===null||n===void 0)return;if(Array.isArray(n)){for(let o=0;o<n.length;o+=1){let t=N4(n[o],`${i}[${o}]`,r+1);if(t)return t}return}if(typeof n!=="object")return;for(let[o,t]of Object.entries(n)){let e=`${i}.${o}`,u=N4(t,e,r+1);if(u)return u;if(OL(o)||OL(e)){let l=hL(t);if(l)return{value:l,path:e}}}return}function OL(n){let i=n.toLowerCase(),r=i.includes("human")||i.includes("manual")||i.includes("reviewer")||i.includes("operator")||n.includes("人工")||n.includes("人工审批")||n.includes("人工审核"),o=i.includes("result")||i.includes("decision")||i.includes("outcome")||i.includes("conclusion")||i.includes("action")||n.includes("结果")||n.includes("结论")||n.includes("动作");return r&&o}function hL(n){if(typeof n==="string")return n.trim()||void 0;if(typeof n==="number"||typeof n==="boolean")return String(n);if(!n||typeof n!=="object")return;let i=n;for(let r of["label","name","text","value","result","decision","outcome","status","action"]){let o=hL(i[r]);if(o)return o}return}function GQ(n,i){if(i.recordId&&n.id!==i.recordId)return!1;if(i.sourceDocumentSN&&n.sourceDocumentSN!==i.sourceDocumentSN)return!1;if(i.sourceDocumentId&&n.sourceDocumentId!==i.sourceDocumentId)return!1;return!0}function kL(n,i){return n.reduce((r,o)=>{let t=i(o);return r[t]=(r[t]??0)+1,r},{})}function dL(n,i){let r=PL(n);if(!r)return;let o=YL(r,i),t=o.year,e=(o.month??"01").padStart(2,"0"),u=(o.day??"01").padStart(2,"0");return`${t}-${e}-${u}`}function LL(n,i){let r=PL(n);if(!r)return;let o=YL(r,i),t=(o.month??"01").padStart(2,"0"),e=(o.day??"01").padStart(2,"0"),u=(o.hour??"00").padStart(2,"0"),l=(o.minute??"00").padStart(2,"0"),$=(o.second??"00").padStart(2,"0");return`${o.year??"0000"}-${t}-${e} ${u}:${l}:${$}`}function PL(n){if(n===void 0)return null;let i=new Date(n);return Number.isNaN(i.getTime())?null:i}function YL(n,i){return Object.fromEntries(new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(n).filter((r)=>r.type!=="literal").map((r)=>[r.type,r.value]))}import{writeFileSync as jQ}from"node:fs";function pL(n){let i=[],r={},o;for(let t=0;t<n.length;t+=1){let e=n[t];if(!e)continue;if(e==="--json"){let u=n[t+1];if(!u)throw Error("--json requires a JSON object argument");o=JSON.parse(u),t+=1;continue}if(e.startsWith("-")){let u=e.replace(/^-+/,""),l=n[t+1];if(!l||l.startsWith("-"))r[u]=!0;else r[u]=l,t+=1;continue}i.push(e)}return{command:i,options:r,json:o}}function ri(n){if(n===void 0)return{};if(!n||typeof n!=="object"||Array.isArray(n))throw Error("--json must be an object");return n}function D(n){return typeof n==="string"?n:void 0}function ln(n){if(typeof n!=="string")return;let i=Number(n);if(!Number.isFinite(i))throw Error(`Invalid number: ${n}`);return i}function Tn(n){if(typeof n!=="string")return;let i=n.split(",").map((r)=>r.trim()).filter(Boolean);return i.length?i:void 0}function _(n){if(n===void 0)return;if(typeof n==="boolean")return n;if(n==="true")return!0;if(n==="false")return!1;throw Error(`Invalid boolean: ${n}`)}function At(n,i){let r=Un(n,i);if(!r)throw Error(`Missing required JSON field: ${i}`);return r}function Un(n,i){let r=n[i];return typeof r==="string"&&r.trim()?r.trim():void 0}function QL(n,i){let r=n[i];return typeof r==="number"&&Number.isFinite(r)?r:void 0}function j4(n){return n.replace(/[^a-zA-Z0-9._-]/g,"_")}function FL(n){let i=n.trim().toLowerCase();if(["stateful","state","有状态"].includes(i))return!0;if(["stateless","无状态"].includes(i))return!1;throw Error("Invalid config mode. Use stateful or stateless.")}function Ke(n){if(n==="latest")return{latest:!0};let i=Number(n);if(Number.isInteger(i)&&i>0)return{versionNumber:i};return{versionId:n}}function KL(n){if(!n)return{};let i=Ke(n);if("latest"in i)return{ruleVersionScope:"version",latestRuleVersion:!0};if("versionNumber"in i)return{ruleVersionScope:"version",ruleVersionNumber:i.versionNumber};return{ruleVersionScope:"version",ruleVersionId:i.versionId}}function BL(n){if(!n)return{};let i=Ke(n);if("latest"in i)return{latestRuleVersion:!0};if("versionNumber"in i)return{ruleVersionNumber:i.versionNumber};return{ruleVersionId:i.versionId}}function VL(n){if(!n)return{};let i=Ke(n);if("latest"in i)return{latest:!0};if("versionNumber"in i)return{versionNumber:i.versionNumber};return{versionId:i.versionId}}function W4(n){if(!n)return;let i=n.trim().toLowerCase().replace(/[\s-]+/g,"_"),o={assisted:"assisted",辅助:"assisted",semi_automatic:"semi_automatic",半自动:"semi_automatic",fully_automatic:"fully_automatic",全自动:"fully_automatic"}[i];if(!o)throw Error("Invalid Webhook mode. Use assisted, semi_automatic, or fully_automatic");return o}function J4(n){let i=ln(n.autoApprovalRate??n["auto-approval-rate"]??n["approval-rate"]);if(i!==void 0&&(!Number.isInteger(i)||i<0||i>100))throw Error("Webhook auto approval rate must be an integer between 0 and 100");return i}function H4(n){return _(n.showSecret)??_(n["show-secret"])}var WQ=100,JQ=120000,TL=["id","code","status","strictness","scope","createdAt","updatedAt"],HQ=200000;function X4(n){return n.map((i)=>typeof i==="string"?i:String(i)).join(" ")}function Be(n){if(!n.length)return"";return`${n.join(`
|
||
`)}
|
||
`}function Ve(n){return n.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function K(n,i={}){XQ(n,i);let r=`${JSON.stringify(n,null,2)}
|
||
`;if(i.outputFile){jQ(i.outputFile,r),console.log(JSON.stringify({outputFile:i.outputFile,bytes:Buffer.byteLength(r,"utf-8")},null,2));return}console.log(r.trimEnd())}function XQ(n,i={}){if(i.allowFull||i.outputFile)return;let r=Buffer.byteLength(JSON.stringify(n),"utf-8");if(r>HQ)throw Error(`Output is large (${r} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function qL(n,i){if(i)return;let r=n&&typeof n==="object"?n:{},o=typeof r.count==="number"?r.count:void 0,t=Array.isArray(r.rules)?r.rules.length:void 0,e=Buffer.byteLength(JSON.stringify(n),"utf-8"),u=o??t??0;if(u>WQ||e>JQ)throw Error(`Rule list is large (${u} rules, ${e} bytes). Use "seal-home rules list --summary" or "seal-home rules count"; pass --full only when you really need full descriptions.`)}function J(n){return{allowFull:_(n.full)===!0,outputFile:D(n.outputFile)??D(n["output-file"])}}function _L(){console.log(`seal-home CLI
|
||
|
||
Usage:
|
||
seal-home version
|
||
seal-home mcp
|
||
seal-home mcp config
|
||
seal-home mcp-config
|
||
seal-home skill dump
|
||
seal-home skill install [--dir <path>|--local]
|
||
seal-home skill status
|
||
seal-home http [--port 8787] [--host 127.0.0.1]
|
||
seal-home serve [--port 8787]
|
||
seal-home openapi
|
||
seal-home probe [<corpId>]
|
||
seal-home config paths
|
||
seal-home config get
|
||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||
seal-home update [--check] [--force] [--version <v>]
|
||
seal-home update check
|
||
seal-home update changelog [--limit <n>]
|
||
seal-home changelog [--limit <n>]
|
||
seal-home tools list
|
||
seal-home corps list [--corp <corpId>]
|
||
seal-home corps current [--corp <corpId>]
|
||
seal-home corps switch <corpId>
|
||
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
|
||
seal-home corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
|
||
seal-home corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
|
||
seal-home auth diagnose [--corp <corpId>]
|
||
seal-home auth hose-link [--corp <corpId>] [--expire 7200]
|
||
seal-home delegation list [--corp <corpId>]
|
||
seal-home delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
|
||
seal-home delegation revoke <tokenId> [--corp <corpId>]
|
||
seal-home users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
|
||
seal-home users search <keyword> [--corp <corpId>]
|
||
seal-home users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
|
||
seal-home users reset-password <userId> [--corp <corpId>]
|
||
seal-home users get <userId> [--corp <corpId>]
|
||
seal-home users delete <userId> [--corp <corpId>]
|
||
seal-home llm config [--corp <corpId>]
|
||
seal-home llm providers [--corp <corpId>]
|
||
seal-home permissions available [--corp <corpId>]
|
||
seal-home permissions configs [--corp <corpId>]
|
||
seal-home billing status [--corp <corpId>]
|
||
seal-home billing plans [--corp <corpId>]
|
||
seal-home billing features [--corp <corpId>]
|
||
seal-home webhook list [--query <text>] [--show-secret] [--corp <corpId>]
|
||
seal-home webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
|
||
seal-home webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
|
||
seal-home webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
|
||
seal-home webhook delete <idOrName> --yes [--corp <corpId>]
|
||
seal-home deploy hosecloud requirements [--corp <corpId>]
|
||
seal-home deploy hosecloud list [--corp <corpId>]
|
||
seal-home deploy hosecloud get <sign-key> [--corp <corpId>]
|
||
seal-home deploy hosecloud status [--corp <corpId>]
|
||
seal-home deploy hosecloud configure --json '{...}' [--corp <corpId>]
|
||
seal-home deploy hosecloud sync <sign-key> [--corp <corpId>]
|
||
seal-home preference get [--corp <corpId>]
|
||
seal-home preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
|
||
seal-home preference thinking-depth set --default <medium|high> [--corp <corpId>]
|
||
seal-home preference thinking-depth policies list [--corp <corpId>]
|
||
seal-home preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]
|
||
seal-home preference thinking-depth policies remove <policyId> [--corp <corpId>]
|
||
seal-home source config [--corp <corpId>]
|
||
seal-home tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
|
||
seal-home rules count [--corp <corpId>]
|
||
seal-home rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
|
||
seal-home rules clear [--corp <corpId>] [--dry-run|--yes]
|
||
seal-home rules versions [--corp <corpId>]
|
||
seal-home rules version <versionId|versionNumber|latest> [--corp <corpId>]
|
||
seal-home rules get --corp <corpId> --version <number|latest> --code '#0038'
|
||
seal-home rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
|
||
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
||
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
||
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
||
seal-home approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] [--corp <corpId>]
|
||
seal-home approval-runs count [--status APPROVED] [--corp <corpId>]
|
||
seal-home approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
||
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
||
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
||
seal-home approval-runs document-summary <recordId> [--corp <corpId>]
|
||
seal-home approval-runs attachments <recordId> [--summary] [--corp <corpId>]
|
||
seal-home approval-runs result <recordId> [--summary] [--corp <corpId>]
|
||
seal-home approval-runs url [--corp <corpId>]
|
||
seal-home approval-runs url <recordId> [--corp <corpId>]
|
||
seal-home approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
|
||
seal-home approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
|
||
seal-home simulation batch-records <batchId> [--corp <corpId>]
|
||
seal-home simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--corp <corpId>]
|
||
seal-home simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
|
||
seal-home simulation create --source-system weaver --request-ids "req-01,req-02" [--corp <corpId>]
|
||
seal-home simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
|
||
seal-home simulation clean <batchId> [--corp <corpId>]
|
||
seal-home simulation specifications [--integration <sign-key>] [--corp <corpId>]
|
||
seal-home simulation list [--limit 50] [--corp <corpId>]
|
||
seal-home simulation get <batchId> [--corp <corpId>]
|
||
seal-home simulation templates [--corp <corpId>]
|
||
seal-home simulation integrations [--corp <corpId>]
|
||
seal-home simulation package-upload <材料包.zip> [--corp <corpId>]
|
||
`)}function Nn(n){let i=hi(),r=bi();return zr(i,{stateful:r.stateful,defaultCorpId:r.defaultCorpId,corpId:n},Kt())}function xv(n=bi()){return{mode:n.stateful?"stateful":"stateless",stateful:n.stateful,...n.stateful&&n.defaultCorpId?{defaultCorpId:n.defaultCorpId}:{},configFile:Mr()}}async function H(n,i,r,o,t={}){K(await xr(n,i,r,o),t)}async function xr(n,i,r,o){let t=St.find((l)=>l.name===n);if(!t)throw Error(`Unknown Seal tool: ${n}`);let e=Object.fromEntries(Object.entries(o).filter(([,l])=>l!==void 0)),u=t.handler;return u(i,e,{corp:r})}async function EL(n,i,r,o,t){if(n==="summary"){let e=await xr("seal_approval_runs_summary",r,o,{date:D(t.options.date),timezone:D(t.options.timezone),limit:ln(t.options.limit),startDate:D(t.options.startDate),endDate:D(t.options.endDate),status:D(t.options.status),taskMode:D(t.options.taskMode),manualApprovalStatus:D(t.options.manualApprovalStatus),sourceDocumentSN:D(t.options.sourceDocumentSN),sourceDocumentId:D(t.options.sourceDocumentId),humanResult:D(t.options.humanResult),query:D(t.options.query)});if(e?.matched===0&&e?.total>0)console.error(`提示:在 ${e.date} 未匹配到记录(该企业共有 ${e.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-home approval-runs list --limit 10 查看最近记录。`);K(e,J(t.options));return}if(n==="stats"){await H("seal_approval_runs_stats",r,o,{since:D(t.options.since),dedupeBy:D(t.options.dedupeBy)??D(t.options["dedupe-by"]),status:D(t.options.status),sourceSystem:D(t.options.sourceSystem)??D(t.options["source-system"]),taskMode:D(t.options.taskMode)??D(t.options["task-mode"])},J(t.options));return}if(n==="count"){await H("seal_approval_runs_count",r,o,{status:D(t.options.status),sourceSystem:D(t.options.sourceSystem)??D(t.options["source-system"]),taskMode:D(t.options.taskMode)??D(t.options["task-mode"]),search:D(t.options.search)??D(t.options.query)},J(t.options));return}if(n==="search"||n==="list"){await H("seal_approval_runs_search",r,o,{limit:ln(t.options.limit),offset:ln(t.options.offset),startDate:D(t.options.startDate),endDate:D(t.options.endDate),status:D(t.options.status),taskMode:D(t.options.taskMode),manualApprovalStatus:D(t.options.manualApprovalStatus),sourceDocumentSN:D(t.options.sourceDocumentSN),sourceDocumentId:D(t.options.sourceDocumentId),humanResult:D(t.options.humanResult),query:D(t.options.query),includeBridge:_(t.options.includeBridge)},J(t.options));return}if(n==="bridge"){await H("seal_approval_run_langfuse_bridge_get",r,o,{recordId:D(t.options.recordId),sourceDocumentSN:D(t.options.sourceDocumentSN),sourceDocumentId:D(t.options.sourceDocumentId),simulationBatchId:D(t.options.simulationBatchId),limit:ln(t.options.limit)},J(t.options));return}if(n==="pick"){let e=i??D(t.options.query)??D(t.options.sn);if(!e)throw Error("Usage: seal-home approval-runs pick --sn <documentSN>");await H("seal_approval_run_pick",r,o,{query:e,sn:D(t.options.sn),batchId:D(t.options.batch)??D(t.options.batchId),latest:_(t.options.latest),fields:D(t.options.fields),limit:ln(t.options.limit),includeBridge:_(t.options.includeBridge)},J(t.options));return}if(n==="get"){let e=t.command[2];if(!e)throw Error("Missing approval run recordId");await H("seal_approval_run_get",r,o,{recordId:e,fields:D(t.options.fields),summary:_(t.options.summary)},J(t.options));return}if(n==="cited-rules"){let e=t.command[2];if(!e)throw Error("Usage: seal-home approval-runs cited-rules <recordId>");await H("seal_approval_run_cited_rules_get",r,o,{recordId:e},J(t.options));return}if(n==="document-summary"){let e=t.command[2];if(!e)throw Error("Usage: seal-home approval-runs document-summary <recordId>");await H("seal_approval_run_document_summary_get",r,o,{recordId:e},J(t.options));return}if(n==="attachments"){let e=t.command[2];if(!e)throw Error("Usage: seal-home approval-runs attachments <recordId>");await H("seal_approval_run_attachments_get",r,o,{recordId:e,summary:_(t.options.summary)},J(t.options));return}if(n==="result"){let e=t.command[2];if(!e)throw Error("Usage: seal-home approval-runs result <recordId> [--summary]");await H("seal_approval_run_result_get",r,o,{recordId:e,summary:_(t.options.summary)},J(t.options));return}if(n==="url"){await H("seal_approval_run_url_get",r,o,{recordId:i,sourceDocumentSN:D(t.options.sourceDocumentSN),sourceDocumentId:D(t.options.sourceDocumentId)},J(t.options));return}throw Error(`Unknown approval-runs command: ${n??""}. Run 'seal-home help' for available commands.`)}async function ML(n,i,r){if(n==="diagnose"){K(await hQ(i));return}if(n==="hose-link"){let o=ln(r.options.expire)??7200;K(await qk(i,o));return}throw Error(`Unknown auth command: ${n??""}. Run 'seal-home help' for available commands.`)}async function hQ(n){if(n.source.type!=="hose"){let c=await An(n),S=await Yi(c);return{corp:{id:n.id,name:n.name,sourceType:n.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:S.user,tenant:S.tenant}]}}Gv(n.id);let i=n.source,r=i.appKey??i.key,o=i.appSecurity??i.password,t=(n.seal.url??i.sealUrl??`https://${i.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),e=i.staffId.includes(":")?i.staffId:`${i.corpId}:${i.staffId}`,u=[];if(!r||!o)return{corp:{id:n.id,name:n.name,sourceType:n.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let l=await av("hose.openapi",async()=>{let c=await ZL(`${i.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:r,appSecurity:o}),S=Mi(c.value),k=Xn(S.accessToken)??Xn(c.accessToken)??Xn(c.token);if(!k)throw Error("Hose login did not return an access token");return{token:k,public:{corporationId:Xn(S.corporationId)??Xn(Mi(S.corporation).id),expireTime:Te(S.expireTime)}}});u.push(l.public);let $=l.private?.token,I=$?await av("hose.provisional",async()=>{let c=await ZL(`${i.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent($)}`,{uid:e,pageType:"home",expireDate:7200}),S=Xn(Mi(c.value).message);if(!S)throw Error("Hose CloseAPI did not return a provisional auth URL");let k=new URL(S).searchParams.get("accessToken");if(!k)throw Error("Hose provisional auth URL did not include accessToken");return{token:k,public:{uid:e,enterpriseUrl:Ve(S)}}}):h4("hose.provisional");u.push(I.public);let g=I.private?.token,b=g?await av("seal.sso",async()=>{let c=await mL(`${t}/api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(g)}&returnToken=1`),S=Mi(c.data),k=Xn(c.token)??Xn(c.accessToken)??Xn(S.token)??Xn(S.accessToken);if(!k)throw Error("Seal SSO did not return a bearer token");return{token:k,public:{sealUrl:t,expiresIn:Te(c.expiresIn)??Te(c.expires_in)??Te(S.expiresIn)??Te(S.expires_in)}}}):h4("seal.sso");u.push(b.public);let w=b.private?.token,f=w?await av("seal.whoami",async()=>{let c=await mL(`${t}/api/v1/auth/me`,{authorization:`Bearer ${w}`}),S=Mi(c.data),k=Mi(S.user??c.user),d=Mi(S.tenant??c.tenant);return{public:{user:{id:Xn(k.id),name:Xn(k.name),isAdmin:PQ(k.isAdmin),providerUserId:Xn(k.providerUserId)},tenant:{id:Xn(d.id),name:Xn(d.name),tenantSlug:Xn(d.tenantSlug),hoseCorpConfig:YQ(d.hoseCorpConfig)}}}}):h4("seal.whoami");return u.push(f.public),{corp:{id:n.id,name:n.name,sourceType:n.source.type},ok:u.every((c)=>c.ok===!0),stages:u}}async function av(n,i){try{let r=await i();return{public:{name:n,ok:!0,...CL(r.public)},private:r.token?{token:r.token}:void 0}}catch(r){return{public:{name:n,ok:!1,error:Ve(r instanceof Error?r.message:String(r))}}}}function h4(n){return{public:{name:n,ok:!1,skipped:!0}}}async function ZL(n,i){let r=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)});return zL(r)}async function mL(n,i={}){let r=await fetch(n,{headers:i});return zL(r)}async function zL(n){let i=await n.text();if(!n.ok)throw Error(`${n.status} ${i}`);let r=JSON.parse(i);return Mi(r)}function Mi(n){return n&&typeof n==="object"&&!Array.isArray(n)?n:{}}function Xn(n){return typeof n==="string"&&n?n:void 0}function Te(n){return typeof n==="number"&&Number.isFinite(n)?n:void 0}function PQ(n){return typeof n==="boolean"?n:void 0}function YQ(n){let i=Mi(n);return CL({corporationId:Xn(i.corporationId),corporationName:Xn(i.corporationName)})}function CL(n){return Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0))}async function RL(n,i,r,o){if(n==="status"||n==="get"){await H("seal_billing_status_get",i,r,{},J(o.options));return}if(n==="plans"){await H("seal_billing_plans_list",i,r,{},J(o.options));return}if(n==="features"){await H("seal_billing_features_list",i,r,{},J(o.options));return}throw Error(`Unknown billing command: ${n??""}. Run 'seal-home help' for available commands.`)}function xL(n,i,r){if(n==="paths"){K({candidates:Kt(),globalConfigFile:Mr()});return}if(n==="get"||n==="status"){K(xv());return}if(n==="mode"){let o=i??D(r.options.mode);if(!o){K(xv());return}let t=FL(o),e=D(r.options.corp),u=bi(),l=t?e?zr(hi(),{stateful:!0,corpId:e},Kt()).id:u.defaultCorpId:void 0,$=Qv({stateful:t,...l?{defaultCorpId:l}:{}});K(xv($));return}throw Error(`Unknown config command: ${n??""}. Run 'seal-home help' for available commands.`)}async function aL(n,i,r){await H("seal_approval_context_get",n,i,{documentLimit:ln(r.options.documentLimit),...BL(D(r.options.ruleVersion))},J(r.options))}import{existsSync as sL,mkdirSync as nN,writeFileSync as iN}from"node:fs";import{join as tN}from"node:path";async function ar(n){let[i,r]=await Promise.all([Zk(n),An(n)]),o=await Yi(r);return{...i,tenantId:o.tenant.id,tenantSlug:o.tenant.tenantSlug??i.tenantSlug,tenantName:o.tenant.name,raw:{...typeof i.raw==="object"&&i.raw!==null?i.raw:{},user:{id:o.user.id,name:o.user.name,isAdmin:o.user.isAdmin,providerUserId:o.user.providerUserId,hosecloudStaff:o.user.hosecloudStaff},tenant:o.tenant}}}async function rN(n,i,r){if(n==="list"){let o=D(r.options.corp),t=hi(),e=bi(),u=o??(e.stateful?e.defaultCorpId??t[0]?.id:void 0);if(t.length===0)console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");K(t.map((l)=>({id:l.id,name:l.name,sourceType:l.source.type,provider:l.source.provider??l.source.type,current:l.id===u})));return}if(n==="current"){let o=Nn(D(r.options.corp));K({id:o.id,name:o.name,sourceType:o.source.type,provider:o.source.provider??o.source.type});return}if(n==="switch"){let o=i;if(!o)throw Error("Usage: seal-home corps switch <corpId>");let t=bi();if(!t.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-home config mode stateful` first.");let e=Nn(o);Qv({...t,stateful:!0,defaultCorpId:e.id}),K({current:!0,id:e.id,name:e.name});return}if(n==="probe-hose"){await pQ(ri(r.json));return}if(n==="hose-staffs"){await QQ(ri(r.json));return}if(n==="add-hose"){await FQ(ri(r.json));return}if(n==="add-seal"){await KQ(ri(r.json));return}if(n==="add-link"){let o=i??D(r.options.link)??D(r.options.url);if(!o)throw Error("Usage: seal-home corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]");await BQ(o,D(r.options.name),_(r.options.overwrite)===!0);return}throw Error(`Unknown corps command: ${n??""}. Run 'seal-home help' for available commands.`)}async function pQ(n){let i=At(n,"appKey"),r=At(n,"appSecurity"),o=Un(n,"domain"),t=await Xv(i,r,o),e=await hv(t.domain,t.openapiToken).catch(()=>[]),u=e.reduce((l,$)=>l+$.roleDefs.length,0);K({domain:t.domain,corpId:t.corpId,name:t.corpName??t.corpId,roleCount:u,roleGroups:e.map((l)=>({id:l.id,name:l.name,roleDefs:l.roleDefs.map(($)=>({id:$.id,name:$.name,sourceType:$.sourceType}))}))})}async function QQ(n){let i=At(n,"appKey"),r=At(n,"appSecurity"),o=Un(n,"domain"),t=Un(n,"role")??Un(n,"roleDefId")??"admin",e=await Xv(i,r,o),u=await hv(e.domain,e.openapiToken),l,$;for(let b of u){for(let w of b.roleDefs)if(w.id===t||w.id===`${e.corpId}:${t}`){l=w.id,$=w.name;break}if(l)break}if(!l&&(t==="admin"||t==="主管理员"))for(let b of u){for(let w of b.roleDefs)if(w.id.endsWith(":admin")||w.name==="主管理员"){l=w.id,$=w.name;break}if(l)break}if(!l)for(let b of u){for(let w of b.roleDefs)if(w.name.toLowerCase().includes(t.toLowerCase())){l=w.id,$=w.name;break}if(l)break}if(!l)throw Error(`Role not found matching query: '${t}'. Run 'seal-home corps probe-hose' to view all available roles.`);let I=await z6(e.domain,e.openapiToken,l),g=await C6(e.domain,e.openapiToken,I.staffs);K({domain:e.domain,corpId:e.corpId,corpName:e.corpName??e.corpId,roleId:l,roleName:$,count:g.length,staffs:g.map((b)=>({id:b.id,name:b.name,cellphone:b.cellphone,active:b.active,authState:b.authState,userId:b.userId,email:b.email}))})}async function FQ(n){let i=Un(n,"name"),r=At(n,"appKey"),o=At(n,"appSecurity"),t=Un(n,"domain"),e=Un(n,"staffId")??Un(n,"proxyStaffBizId"),u=Un(n,"staffName"),l=Un(n,"staffPhone"),$=Un(n,"role")??"admin",I=n.force===!0,g=I||n.verify===!1?!1:!0,b=t,w=Un(n,"corpId")??Un(n,"corporationId"),f=i,c;if(!b||!w||!e){let q=await Xv(r,o,t);b=q.domain,w=w??q.corpId,f=f??q.corpName,c=q.openapiToken}let S=e;if(!S&&c&&b){let q=await hv(b,c).catch(()=>[]),x;for(let yn of q){for(let Wn of yn.roleDefs)if(Wn.id.endsWith(`:${$}`)||Wn.name===$||Wn.id===$){x=Wn.id;break}if(x)break}if(!x)x=q.find((yn)=>yn.roleDefs.some((Wn)=>Wn.id.endsWith(":admin")))?.roleDefs.find((yn)=>yn.id.endsWith(":admin"))?.id;if(x){let yn=await z6(b,c,x).catch(()=>({staffs:[]})),Wn=await C6(b,c,yn.staffs).catch(()=>[]);if(u||l){let On=Wn.filter((en)=>{if(u&&en.name!==u&&!en.name.includes(u))return!1;if(l&&(!en.cellphone||!en.cellphone.includes(l)))return!1;return!0});if(On.length===1&&On[0])S=On[0].id;else if(On.length>1)throw Error(`Multiple staff members matched '${u??l}': ${On.map((en)=>`${en.name}(${en.id})`).join(", ")}. Please specify exact staffId.`);else throw Error(`No staff member found matching '${u??l}' under role ${x}. Run 'seal-home corps hose-staffs' to view candidates.`)}else if(!I){let On=Wn.map((en)=>`${en.name} (${en.cellphone||"no-phone"}, id: ${en.id}, active: ${en.active})`).join(`
|
||
- `);throw Error(`Missing required parameter: staffId. Found ${Wn.length} candidate administrators:
|
||
- ${On}
|
||
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!S)if(!g&&e)S=e;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-home corps hose-staffs' to discover available administrators.");let k=Un(n,"id")??w,d=f??w,p=Un(n,"sealUrl")??`https://${w.toLowerCase()}.sealai.cc`,h={id:k,name:d,seal:{url:p,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:b,appKey:r,appSecurity:o,corpId:w,staffId:S},auth:{refreshTtl:300}};if(g)Gv(k),await ar(h);let j=n4();nN(j,{recursive:!0,mode:448});let L=tN(j,`${j4(k)}.json`);if(sL(L)&&n.overwrite!==!0)throw Error(`Enterprise config already exists: ${L}. Pass "overwrite": true to replace it.`);iN(L,`${JSON.stringify(h,null,2)}
|
||
`,{mode:384}),K({id:k,name:d,corpId:w,domain:b,staffId:S,verified:g,path:L})}async function KQ(n){let i=At(n,"token"),r=(Un(n,"sealUrl")??Un(n,"url")??"").replace(/\/+$/,"");if(!r)throw Error("Missing required JSON field: sealUrl");let o=QL(n,"expiresIn")??2592000,t=n.force===!0||n.verify===!1?!1:!0,e=t?await VQ(r,i):void 0;oN(n,{token:i,sealUrl:r,expiresIn:o,verify:t,remote:e})}async function BQ(n,i,r){let o=await jv(n),t=He(o.sealUrl,o.token),e=await Yi(t),u={user:e.user,tenant:e.tenant};Wv(o.corpId,u.tenant),oN({id:o.corpId,corpId:o.corpId,name:i,provider:"hosecloud",overwrite:r},{token:o.token,sealUrl:o.sealUrl,expiresIn:o.expiresIn,verify:!0,remote:u})}function oN(n,i){let{token:r,sealUrl:o,expiresIn:t,verify:e,remote:u}=i,l=u?.user,$=u?.tenant,I=Un(n,"tenantSlug")??Ot($?.tenantSlug),g=Un(n,"tenantId")??Ot($?.id),b=Un(n,"tenantName")??Ot($?.name),w=Un(n,"id")??I??g;if(!w)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let f=Un(n,"staffId")??Ot(l?.providerUserId)??Ot(l?.id)??"seal",c=Un(n,"provider")??Ot(l?.provider)??Ot($?.providerConfig?.provider),S=Un(n,"corpId")??I??g??w,k={id:w,name:Un(n,"name")??b??w,seal:{url:o,tenantSlug:I,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:r,sealUrl:o,expiresIn:t,staffId:f,corpId:S,tenantId:g,tenantSlug:I,tenantName:b,providerUserId:Ot(l?.providerUserId),provider:c},auth:{refreshTtl:300}},d=n4();nN(d,{recursive:!0,mode:448});let p=tN(d,`${j4(w)}.json`);if(sL(p)&&n.overwrite!==!0)throw Error(`Enterprise config already exists: ${p}. Pass "overwrite": true to replace it.`);iN(p,`${JSON.stringify(k,null,2)}
|
||
`,{mode:384}),K({id:w,name:k.name,tenantId:g,tenantSlug:I,verified:e,path:p})}async function VQ(n,i){let r=await TQ(`${n}/api/v1/auth/me`,{authorization:`Bearer ${i}`}),o=sv(r.data);return{user:sv(o.user??r.user),tenant:sv(o.tenant??r.tenant)}}async function TQ(n,i={}){let r=await fetch(n,{headers:i}),o=await r.text();if(!r.ok)throw Error(`${r.status} ${o}`);let t=JSON.parse(o);return sv(t)}function sv(n){return n&&typeof n==="object"&&!Array.isArray(n)?n:{}}function Ot(n){return typeof n==="string"&&n?n:void 0}async function eN(n,i){let r=await jv(n),o=He(r.sealUrl,r.token),t=await Yi(o);Wv(r.corpId,t.tenant);let e=await Cr(o,{note:i});K({tenant:{id:t.tenant.id,name:t.tenant.name,tenantSlug:t.tenant.tenantSlug,corpId:r.corpId},user:{id:t.user.id,name:t.user.name,providerUserId:t.user.providerUserId,isAdmin:t.user.isAdmin},delegation:e,expiresIn:r.expiresIn})}async function uN(n,i,r,o,t){if(n==="list"){await H("seal_delegation_list",r,o,{},J(t.options));return}if(n==="create"){let e=D(t.options.note)??(i?[i,...t.command.slice(2)].join(" "):void 0);await H("seal_delegation_create",r,o,{note:e},J(t.options));return}if(n==="revoke"){let e=i??D(t.options.tokenId);if(!e)throw Error("Usage: seal-home delegation revoke <tokenId>");await H("seal_delegation_revoke",r,o,{tokenId:e},J(t.options));return}throw Error(`Unknown delegation command: ${n??""}. Run 'seal-home help' for available commands.`)}import{readFileSync as qQ}from"node:fs";async function lN(n,i,r,o,t,e){let u=n==="hosecloud"||!n,l=n==="hosecloud"?i:n,$=n==="hosecloud"?r:i;if(!u&&n!=="hosecloud")throw Error(`Unknown deploy target: ${n??""}. Currently supported: hosecloud`);if(l==="requirements"){await H("seal_deploy_hosecloud_requirements",o,t,{},J(e.options));return}if(l==="list"){await H("seal_deploy_hosecloud_list",o,t,{},J(e.options));return}if(l==="get"){let I=$??D(e.options.signKey)??D(e.options["sign-key"]);if(!I)throw Error("Usage: seal-home deploy hosecloud get <sign-key>");await H("seal_deploy_hosecloud_get",o,t,{signKey:I},J(e.options));return}if(l==="status"){await H("seal_deploy_hosecloud_status",o,t,{},J(e.options));return}if(l==="configure"){let I=D(e.options.input),g=I?JSON.parse(qQ(I,"utf8")):ri(e.json);if(!g||Object.keys(g).length===0)throw Error("Usage: seal-home deploy hosecloud configure --json '{...}' or --input <file>");await H("seal_deploy_hosecloud_configure",o,t,g,J(e.options));return}if(l==="sync"){let I=$??D(e.options.signKey)??D(e.options["sign-key"]);if(!I)throw Error("Usage: seal-home deploy hosecloud sync <sign-key>");await H("seal_deploy_hosecloud_sync",o,t,{signKey:I},J(e.options));return}throw Error(`Unknown deploy hosecloud action: ${l??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as MQ}from"node:http";import{URL as EQ}from"node:url";var vN={openapi:"3.1.0",info:{title:"seal-home Wrapped API",version:"0.9.8",description:`Planned HTTP contract for the seal-home wrapped backend API.
|
||
|
||
These endpoints describe the intended stable API for frontend developers and agents once
|
||
the HTTP adapter is implemented.
|
||
They are not the raw downstream Seal endpoints. seal-home is responsible for enterprise
|
||
selection, source authentication, response compaction, and diagnostics-friendly fields.
|
||
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current session metadata.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/approval/context":{get:{tags:["Approval Knowledge"],operationId:"getApprovalContext",summary:"Get rules, documents, and style preferences together",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"documentLimit",in:"query",schema:{type:"integer",minimum:1}},{name:"latestRuleVersion",in:"query",schema:{type:"boolean"}},{name:"ruleVersionNumber",in:"query",schema:{type:"integer"}}],responses:{"200":{description:"Approval context.",content:{"application/json":{schema:{type:"object",required:["rules","documents","stylePreferences"],properties:{rules:{},documents:{},stylePreferences:{}}}}}}}}},"/v1/approval/search":{post:{tags:["Approval Knowledge"],operationId:"searchApprovalKnowledge",summary:"Search approval rules, documents, and preferences",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["keywords"],properties:{keywords:{type:"array",minItems:1,items:{type:"string"}},matchMode:{type:"string",enum:["any","all"]},areas:{type:"array",items:{type:"string",enum:["rules","documents","preferences"]}},maxResults:{type:"integer"}}}}}},responses:{"200":{description:"Search results with line context.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval/rules":{get:{tags:["Approval Knowledge"],operationId:"listApprovalRules",summary:"List current draft approval rules",responses:{"200":{description:"Draft rules.",content:{"application/json":{schema:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}}}}}}},post:{tags:["Approval Knowledge"],operationId:"createApprovalRule",summary:"Create draft approval rule",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}}}}},responses:{"200":{description:"Created rule.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}}}}}}}},"/v1/approval/rules/{ruleId}":{parameters:[{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."}],patch:{tags:["Approval Knowledge"],operationId:"updateApprovalRule",summary:"Update draft approval rule",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}}}}},responses:{"200":{description:"Updated rule.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}}}}}}},delete:{tags:["Approval Knowledge"],operationId:"deleteApprovalRule",summary:"Delete draft approval rule",responses:{"200":{description:"Deleted."}}}},"/v1/approval/rule-versions":{get:{tags:["Approval Knowledge"],operationId:"listApprovalRuleVersions",summary:"List published approval rule versions",responses:{"200":{description:"Published rule versions.",content:{"application/json":{schema:{type:"array",items:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}}}}},"/v1/approval/rule-versions/{versionId}":{parameters:[{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."}],get:{tags:["Approval Knowledge"],operationId:"getApprovalRuleVersion",summary:"Get published approval rule version",responses:{"200":{description:"Rule version.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}}}},"/v1/approval/rules/by-version":{get:{tags:["Approval Knowledge"],operationId:"getApprovalRuleByVersion",summary:"Get one wrapped rule from a published version",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"versionNumber",in:"query",schema:{type:"integer"}},{name:"versionId",in:"query",schema:{type:"string"}},{name:"latest",in:"query",schema:{type:"boolean"}},{name:"code",in:"query",schema:{type:"string"},description:"Display rule code such as '#0038'."},{name:"runtimeId",in:"query",schema:{type:"string"},description:"Runtime rule ID such as rule-205."},{name:"recordId",in:"query",schema:{type:"string"},description:"Infer versionNumber from an approval run."}],responses:{"200":{description:"One rule from a published version.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval/rule-versions/publish":{post:{tags:["Approval Knowledge"],operationId:"publishApprovalRuleVersion",summary:"Publish current draft rules",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}}}}},responses:{"200":{description:"Published version.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval/documents":{get:{tags:["Approval Knowledge"],operationId:"listApprovalDocuments",summary:"List approval knowledge documents",parameters:[{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},{name:"limit",in:"query",schema:{type:"integer",minimum:1,default:20}},{name:"scenario",in:"query",schema:{type:"array",items:{type:"string"}},style:"form",explode:!0}],responses:{"200":{description:"Documents.",content:{"application/json":{schema:{type:"object",required:["articles"],properties:{articles:{type:"array",items:{$ref:"#/components/schemas/ApprovalDocument"}},total:{type:"integer"}}}}}}}},post:{tags:["Approval Knowledge"],operationId:"createApprovalDocument",summary:"Create approval knowledge document",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["title","purpose","content"],properties:{title:{type:"string"},purpose:{type:"string"},content:{type:"string"},contentType:{type:"string"},status:{type:"string"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}}}}},responses:{"200":{description:"Created document.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{type:"string"},purpose:{type:"string"},content:{type:"string",description:"Usually Markdown."},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}}}}}}}},"/v1/approval/documents/{documentId}":{parameters:[{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."}],get:{tags:["Approval Knowledge"],operationId:"getApprovalDocument",summary:"Get approval knowledge document",responses:{"200":{description:"Document.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{type:"string"},purpose:{type:"string"},content:{type:"string",description:"Usually Markdown."},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}}}}}}},patch:{tags:["Approval Knowledge"],operationId:"updateApprovalDocument",summary:"Update approval knowledge document",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},purpose:{type:"string"},content:{type:"string"},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}}}}},responses:{"200":{description:"Updated document.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{type:"string"},purpose:{type:"string"},content:{type:"string",description:"Usually Markdown."},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}}}}}}}},"/v1/approval/style-preferences":{get:{tags:["Approval Knowledge"],operationId:"getApprovalStylePreferences",summary:"Get approval style preferences",responses:{"200":{description:"Style preferences.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{tone:{type:"string"},language:{type:"string"},detailLevel:{type:"string"},outputFormat:{type:"string"},examples:{type:"array",items:{type:"string"}},prohibitedPhrases:{type:"array",items:{type:"string"}},customInstructions:{type:"string"}}}}}}}},patch:{tags:["Approval Knowledge"],operationId:"updateApprovalStylePreferences",summary:"Update approval style preferences",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{tone:{type:"string"},language:{type:"string"},detailLevel:{type:"string"},outputFormat:{type:"string"},examples:{type:"array",items:{type:"string"}},prohibitedPhrases:{type:"array",items:{type:"string"}},customInstructions:{type:"string"}}}}}},responses:{"200":{description:"Updated style preferences.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{tone:{type:"string"},language:{type:"string"},detailLevel:{type:"string"},outputFormat:{type:"string"},examples:{type:"array",items:{type:"string"}},prohibitedPhrases:{type:"array",items:{type:"string"}},customInstructions:{type:"string"}}}}}}}}},"/v1/approval-runs":{get:{tags:["Approval Runs"],operationId:"searchApprovalRuns",summary:"Search wrapped approval run history",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},{name:"startDate",in:"query",schema:{type:"string"},description:"Creation-time lower bound in milliseconds."},{name:"endDate",in:"query",schema:{type:"string"},description:"Creation-time upper bound in milliseconds."},{name:"status",in:"query",schema:{type:"string"}},{name:"taskMode",in:"query",schema:{type:"string"}},{name:"manualApprovalStatus",in:"query",schema:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},{name:"sourceDocumentSN",in:"query",schema:{type:"string"},description:"Hose/易快报单号 or other external source document number."},{name:"sourceDocumentId",in:"query",schema:{type:"string"}},{name:"humanResult",in:"query",schema:{type:"string"},description:"Local human result contains filter, such as 驳回 or 通过."},{name:"query",in:"query",schema:{type:"string"},description:"Search across record ID, source document fields, document ID, and trace fields."},{name:"includeBridge",in:"query",schema:{type:"boolean",default:!1},description:"Include full Langfuse bridge rows."}],responses:{"200":{description:"Compact wrapped approval run list.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["records"],properties:{records:{type:"array",items:{$ref:"#/components/schemas/ApprovalRun"}},total:{type:"integer"},bridge:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}}}},"/v1/approval-runs/summary":{get:{tags:["Approval Runs"],operationId:"summarizeApprovalRuns",summary:"Summarize approval runs by local date",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"date",in:"query",schema:{type:"string",format:"date"}},{name:"timezone",in:"query",schema:{type:"string",default:"Asia/Shanghai"}},{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},{name:"query",in:"query",schema:{type:"string"}},{name:"humanResult",in:"query",schema:{type:"string"}}],responses:{"200":{description:"Date summary with counts and compact records.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{date:{type:"string"},timezone:{type:"string"},matched:{type:"integer"},statusCounts:{type:"object",additionalProperties:{type:"integer"}},taskModeCounts:{type:"object",additionalProperties:{type:"integer"}}}}}}}}}},"/v1/approval-runs/pick":{get:{tags:["Approval Runs"],operationId:"pickApprovalRuns",summary:"Pick likely approval runs by document number or trace key",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"query",in:"query",schema:{type:"string"}},{name:"sn",in:"query",schema:{type:"string"},description:"Source document number for direct lookup."},{name:"batch",in:"query",schema:{type:"string"},description:"Optional simulation batch ID."},{name:"latest",in:"query",schema:{type:"boolean"}},{name:"fields",in:"query",schema:{type:"string"},description:"Comma-separated response fields."},{name:"limit",in:"query",schema:{type:"integer",default:20}},{name:"maxScan",in:"query",schema:{type:"integer",default:1000}}],responses:{"200":{description:"Picked records and suggested next actions.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval-runs/bridge":{get:{tags:["Approval Runs"],operationId:"getApprovalRunLangfuseBridge",summary:"Resolve approval runs to Langfuse trace or session hints",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"recordId",in:"query",schema:{type:"string"}},{name:"sourceDocumentSN",in:"query",schema:{type:"string"}},{name:"sourceDocumentId",in:"query",schema:{type:"string"}},{name:"simulationBatchId",in:"query",schema:{type:"string"}}],responses:{"200":{description:"Trace/session bridge hints.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{count:{type:"integer"},records:{type:"array",items:{$ref:"#/components/schemas/ApprovalRun"}},bridge:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}}}},"/v1/approval-runs/url":{get:{tags:["Approval Runs"],operationId:"getApprovalRunUrl",summary:"Get enterprise assist URL and optional source document URL",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},{name:"recordId",in:"query",schema:{type:"string"}},{name:"sourceDocumentSN",in:"query",schema:{type:"string"}},{name:"sourceDocumentId",in:"query",schema:{type:"string"}}],responses:{"200":{description:"Enterprise and document URLs.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,properties:{enterpriseAssistUrl:{type:"string"},enterpriseUrl:{type:"string"},documentUrl:{type:"string"},recordId:{type:"string"},sourceDocumentSN:{type:"string"}}}}}}}}},"/v1/approval-runs/{recordId}":{parameters:[{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."}],get:{tags:["Approval Runs"],operationId:"getApprovalRun",summary:"Get wrapped approval run detail",parameters:[{name:"summary",in:"query",schema:{type:"boolean"}},{name:"fields",in:"query",schema:{type:"string"},description:"Comma-separated field paths such as metadata,document.fields,result.summary."}],responses:{"200":{description:"Approval run detail plus stable aliases and human result.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval-runs/{recordId}/cited-rules":{parameters:[{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."}],get:{tags:["Approval Runs"],operationId:"getApprovalRunCitedRules",summary:"Extract rules cited or matched by the AI result",responses:{"200":{description:"Cited rule summaries.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval-runs/{recordId}/document-summary":{parameters:[{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."}],get:{tags:["Approval Runs"],operationId:"getApprovalRunDocumentSummary",summary:"Get key document fields and compact AI/manual result",responses:{"200":{description:"Document summary.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval-runs/{recordId}/attachments":{parameters:[{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."}],get:{tags:["Approval Runs"],operationId:"getApprovalRunAttachments",summary:"List compact attachment metadata",parameters:[{name:"summary",in:"query",schema:{type:"boolean"}}],responses:{"200":{description:"Attachment metadata.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/approval-runs/{recordId}/result":{parameters:[{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."}],get:{tags:["Approval Runs"],operationId:"getApprovalRunResult",summary:"Get AI result, optionally as a compact summary",parameters:[{name:"summary",in:"query",schema:{type:"boolean"}}],responses:{"200":{description:"AI result or summary.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/create-batch":{post:{tags:["Simulation"],operationId:"createSimulationBatch",summary:"Create a simulation batch",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}},responses:{"200":{description:"Created batch id.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/create-material-pack-batch":{post:{tags:["Simulation"],operationId:"createMaterialPackBatch",summary:"Create a material pack simulation batch",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}},responses:{"200":{description:"Created batch id.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/batches":{get:{tags:["Simulation"],operationId:"listSimulationBatches",summary:"List simulation batches",parameters:[{name:"limit",in:"query",schema:{type:"integer"},description:"Max batches to return."}],responses:{"200":{description:"Simulation batches.",content:{"application/json":{schema:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}},"/v1/simulation/batch/{batchId}":{parameters:[{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}],get:{tags:["Simulation"],operationId:"getSimulationBatch",summary:"Get a simulation batch detail including echoed create params",responses:{"200":{description:"Simulation batch detail.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/batches/{batchId}/records":{parameters:[{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}],get:{tags:["Simulation"],operationId:"getSimulationBatchRecords",summary:"Get wrapped simulation batch records",parameters:[{name:"query",in:"query",schema:{type:"string"},description:"Optional local contains filter for record/document/trace identifiers."}],responses:{"200":{description:"Compact simulation records and bridge hints.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/templates":{get:{tags:["Simulation"],operationId:"listSimulationTemplates",summary:"List simulation test templates",responses:{"200":{description:"Simulation templates.",content:{"application/json":{schema:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}},"/v1/simulation/integration-status":{get:{tags:["Simulation"],operationId:"getSimulationIntegrationStatus",summary:"Get available source integration status for simulation",responses:{"200":{description:"Integration status.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}},"/v1/simulation/hosecloud-integrations":{get:{tags:["Simulation"],operationId:"listSimulationHosecloudIntegrations",summary:"List hosecloud source integrations available for simulation",responses:{"200":{description:"Hosecloud integrations.",content:{"application/json":{schema:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}}},"/v1/material-packages/upload":{post:{tags:["Simulation"],operationId:"uploadMaterialPackage",summary:"Upload a material package ZIP for simulation",requestBody:{required:!0,content:{"multipart/form-data":{schema:{type:"object",properties:{file:{type:"string",format:"binary"}}}}}},responses:{"200":{description:"Parsed material package with schema config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0}}}}}}}},components:{securitySchemes:{localSession:{type:"apiKey",in:"header",name:"X-Seal-Home-Session",description:"Optional local service session header for future HTTP deployments."}},parameters:{CorpId:{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-home approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{type:"string"},purpose:{type:"string"},content:{type:"string",description:"Usually Markdown."},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}},ApprovalDocumentInput:{type:"object",required:["title","purpose","content"],properties:{title:{type:"string"},purpose:{type:"string"},content:{type:"string"},contentType:{type:"string"},status:{type:"string"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}},ApprovalDocumentPatch:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},purpose:{type:"string"},content:{type:"string"},contentType:{type:"string"},status:{type:"string"},enabled:{type:"boolean"},scenarios:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}}}},ApprovalDocumentsResponse:{type:"object",required:["articles"],properties:{articles:{type:"array",items:{$ref:"#/components/schemas/ApprovalDocument"}},total:{type:"integer"}}},ApprovalStylePreferences:{type:"object",additionalProperties:!0,properties:{tone:{type:"string"},language:{type:"string"},detailLevel:{type:"string"},outputFormat:{type:"string"},examples:{type:"array",items:{type:"string"}},prohibitedPhrases:{type:"array",items:{type:"string"}},customInstructions:{type:"string"}}},ApprovalContext:{type:"object",required:["rules","documents","stylePreferences"],properties:{rules:{},documents:{},stylePreferences:{}}},ApprovalSearchRequest:{type:"object",required:["keywords"],properties:{keywords:{type:"array",minItems:1,items:{type:"string"}},matchMode:{type:"string",enum:["any","all"]},areas:{type:"array",items:{type:"string",enum:["rules","documents","preferences"]}},maxResults:{type:"integer"}}},ApprovalSearchResponse:{type:"object",additionalProperties:!0},ApprovalRun:{type:"object",additionalProperties:!0,required:["id"],properties:{id:{type:"string"},sourceDocumentSN:{type:"string",description:"External document number, often Hose/易快报单号."},sourceDocumentId:{type:"string"},status:{type:"string"},taskMode:{type:"string"},finalExecutionMode:{type:"string"},ruleSetVersionNumber:{type:"integer"},langfuseTraceId:{type:"string"},langfuseSessionFallback:{type:"string"}}},ApprovalRunsResponse:{type:"object",additionalProperties:!0,required:["records"],properties:{records:{type:"array",items:{$ref:"#/components/schemas/ApprovalRun"}},total:{type:"integer"},bridge:{type:"array",items:{type:"object",additionalProperties:!0}}}},ApprovalRunsSummary:{type:"object",additionalProperties:!0,properties:{date:{type:"string"},timezone:{type:"string"},matched:{type:"integer"},statusCounts:{type:"object",additionalProperties:{type:"integer"}},taskModeCounts:{type:"object",additionalProperties:{type:"integer"}}}},RunUrlResponse:{type:"object",additionalProperties:!0,properties:{enterpriseAssistUrl:{type:"string"},enterpriseUrl:{type:"string"},documentUrl:{type:"string"},recordId:{type:"string"},sourceDocumentSN:{type:"string"}}},BridgeResponse:{type:"object",additionalProperties:!0,properties:{count:{type:"integer"},records:{type:"array",items:{$ref:"#/components/schemas/ApprovalRun"}},bridge:{type:"array",items:{type:"object",additionalProperties:!0}}}}}}};function n$(){return vN}function $N(){return`<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||
<title>Seal Home API Docs (v${R})</title>
|
||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>\uD83E\uDDAD</text></svg>" />
|
||
<style>
|
||
body {
|
||
margin: 0;
|
||
padding: 0;
|
||
background-color: #0f172a;
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<script
|
||
id="api-reference"
|
||
data-url="/openapi.json"
|
||
data-configuration='{"theme":"purple","layout":"modern","showSidebar":true}'
|
||
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
|
||
></script>
|
||
</body>
|
||
</html>`}async function Hn(n,i,r,o){let t=n.handler;return t(i,r,{corp:o})}async function IN(n,i){if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),i.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),n.method==="OPTIONS"){i.writeHead(204),i.end();return}let r=n.headers.host||"localhost",o=n.headers["x-forwarded-proto"]||"http",t=new EQ(n.url||"/",`${o}://${r}`),e=t.pathname.replace(/\/+$/,"")||"/",u=(n.method||"GET").toUpperCase();try{if(u==="GET"&&e==="/"){Dn(i,200,{name:"seal-home",version:R,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(u==="GET"&&e==="/docs"){mQ(i,200,$N());return}if(u==="GET"&&(e==="/openapi.json"||e==="/openapi")){let l=n$();Dn(i,200,l);return}if(u==="GET"&&(e==="/health"||e==="/version")){Dn(i,200,{status:"ok",name:"seal-home",version:R,uptimeSeconds:Math.floor(process.uptime()),timestamp:new Date().toISOString()});return}if(u==="GET"&&e==="/api/tools"){Dn(i,200,{count:St.length,tools:St.map((l)=>({name:l.name,description:l.description}))});return}if(u==="POST"&&e==="/api/cli"){let l=await t$(n),$=typeof l?.command==="string"?l.command.trim():"";if(!$){i$(i,400,"Missing or empty 'command' field in request body");return}let I=P4($),g=I[0]==="seal-home"||I[0]?.endsWith("/seal-home")?I.slice(1):I,b=await qe(g),w=void 0;try{if(b.stdout.trim().startsWith("{")||b.stdout.trim().startsWith("["))w=JSON.parse(b.stdout)}catch{}Dn(i,b.isError?400:200,{success:!b.isError,stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode,data:w});return}if(u==="POST"&&e.startsWith("/api/tool/")){let l=e.slice(10).trim(),$=jn(l,{includeMcpAliases:!0});if(!$){i$(i,404,`Tool not found: '${l}'`);return}let I=await t$(n)||{},g=zn(n,t,I),b=Nn(g),w=await An(b),f={...I};delete f.corp;let c=await Hn($,w,f,b);Dn(i,200,c);return}if(e.startsWith("/v1/")){if(await ZQ(n,i,u,e,t))return}i$(i,404,`Cannot ${u} ${e}. Visit /docs for available endpoints.`)}catch(l){let $=l instanceof Error?l.message:String(l);i$(i,500,$)}}async function ZQ(n,i,r,o,t){let e=Object.fromEntries(t.searchParams.entries());if(r==="GET"&&o==="/v1/corps"){let u=hi(),l=bi();return Dn(i,200,{count:u.length,mode:l.stateful?"stateful":"stateless",defaultCorpId:l.defaultCorpId,corps:u.map(($)=>({id:$.id,name:$.name,sourceType:$.source.type,sealUrl:$.seal?.url}))}),!0}if(r==="GET"&&o==="/v1/whoami"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_whoami"),g=await Hn(I,$,{},l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/session"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_session_get"),g=await Hn(I,$,{},l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/summary"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_runs_summary"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/stats"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_runs_stats"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/pick"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_run_pick"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/url"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_run_url_get"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(o.startsWith("/v1/approval-runs/")){let u=o.slice(18).split("/"),l=u[0],$=u[1];if(l&&!["summary","pick","stats","url","bridge"].includes(l)){let I=zn(n,t,e),g=Nn(I),b=await An(g);if(!$){let w=jn("seal_approval_run_get"),f=await Hn(w,b,{recordId:l,...e},g);return Dn(i,200,f),!0}if($==="attachments"){let w=jn("seal_approval_run_attachments_get"),f=await Hn(w,b,{recordId:l,...e},g);return Dn(i,200,f),!0}if($==="cited-rules"){let w=jn("seal_approval_run_cited_rules_get"),f=await Hn(w,b,{recordId:l,...e},g);return Dn(i,200,f),!0}if($==="document-summary"){let w=jn("seal_approval_run_document_summary_get"),f=await Hn(w,b,{recordId:l,...e},g);return Dn(i,200,f),!0}if($==="result"){let w=jn("seal_approval_run_result_get"),f=await Hn(w,b,{recordId:l,...e},g);return Dn(i,200,f),!0}}}if(r==="GET"&&o==="/v1/approval-runs"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_runs_search"),g=await Hn(I,$,{...e,limit:e.limit?Number(e.limit):void 0,offset:e.offset?Number(e.offset):void 0,includeBridge:e.includeBridge==="true"},l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval/rules"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_approval_rules_list"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(r==="GET"&&o==="/v1/simulation/batches"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_simulation_batches_list"),g=await Hn(I,$,e,l);return Dn(i,200,g),!0}if(r==="POST"&&o==="/v1/simulation/create-batch"){let u=await t$(n)||{},l=zn(n,t,u),$=Nn(l),I=await An($),g=jn("seal_simulation_batch_create"),b=await Hn(g,I,u,$);return Dn(i,200,b),!0}if(r==="GET"&&o.startsWith("/v1/simulation/batch/")){let l=o.slice(21).split("/")[0];if(l){let $=zn(n,t,e),I=Nn($),g=await An(I),b=jn("seal_simulation_batch_get"),w=await Hn(b,g,{batchId:l},I);return Dn(i,200,w),!0}}if(r==="GET"&&o==="/v1/preferences"){let u=zn(n,t,e),l=Nn(u),$=await An(l),I=jn("seal_preference_get"),g=await Hn(I,$,{},l);return Dn(i,200,g),!0}if(r==="POST"&&o==="/v1/preferences/decision"){let u=await t$(n)||{},l=zn(n,t,u),$=Nn(l),I=await An($),g=jn("seal_preference_decision_update"),b=await Hn(g,I,u,$);return Dn(i,200,b),!0}return!1}function zn(n,i,r){let o=n.headers["x-seal-corp"];if(typeof o==="string"&&o.trim())return o.trim();let t=i.searchParams.get("corp");if(t?.trim())return t.trim();if(r&&typeof r.corp==="string"&&r.corp.trim())return r.corp.trim();return}async function t$(n){return new Promise((i,r)=>{let o="";n.on("data",(t)=>{if(o+=t,o.length>20971520)r(Error("Payload too large"))}),n.on("end",()=>{if(!o.trim()){i({});return}try{i(JSON.parse(o))}catch(t){r(Error(`Invalid JSON body: ${t instanceof Error?t.message:String(t)}`))}}),n.on("error",r)})}function Dn(n,i,r){let o=JSON.stringify(r,null,2);n.writeHead(i,{"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(o)}),n.end(o)}function mQ(n,i,r){n.writeHead(i,{"Content-Type":"text/html; charset=utf-8","Content-Length":Buffer.byteLength(r)}),n.end(r)}function i$(n,i,r,o){Dn(n,i,{error:!0,statusCode:i,message:r,...o!==void 0?{details:o}:{}})}async function gN(n={}){let i=n.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):8787),r=n.host??(process.env.HOST?process.env.HOST:"127.0.0.1"),o=MQ(async(t,e)=>{try{await IN(t,e)}catch(u){if(!e.headersSent)e.writeHead(500,{"Content-Type":"application/json"}),e.end(JSON.stringify({error:!0,message:u instanceof Error?u.message:String(u)}))}});return new Promise((t,e)=>{o.on("error",(u)=>{e(u)}),o.listen(i,r,()=>{if(!n.silent)console.error(`
|
||
\uD83D\uDE80 seal-home HTTP Server (v${R}) started`),console.error(` URL: http://${r}:${i}`),console.error(` Docs: http://${r}:${i}/docs`),console.error(` OpenAPI: http://${r}:${i}/openapi.json`),console.error(` CLI Exec: POST http://${r}:${i}/api/cli`),console.error(` REST API: http://${r}:${i}/v1/...
|
||
`);t(o)})})}async function bN(n){let i=ln(n.options.port)??ln(n.options.p),r=D(n.options.host)??D(n.options.h),o=await gN({port:i,host:r}),t=()=>{o.close(()=>{process.exit(0)})};process.on("SIGINT",t),process.on("SIGTERM",t),await new Promise(()=>{})}async function wN(n,i,r,o){if(n==="config"||n==="get"){await H("seal_llm_config_get",i,r,{},J(o.options));return}if(n==="providers"||n==="list"){await H("seal_llm_providers_list",i,r,{},J(o.options));return}throw Error(`Unknown llm command: ${n??""}. Run 'seal-home help' for available commands.`)}async function fN(n,i){if(n==="config"||n==="json"){Y4();return}await p4()}function Y4(){K({mcpServers:{"seal-home":{type:"stdio",command:"seal-home",args:["mcp"],env:{SEAL_HOME_MCP_ENABLED:"true"}}}})}function cN(n){let i=n$();K(i,{...J(n.options),allowFull:!0})}async function UN(n,i,r,o){if(n==="available"){await H("seal_permissions_available_list",i,r,{},J(o.options));return}if(n==="configs"||n==="list"){await H("seal_permissions_configs_list",i,r,{},J(o.options));return}throw Error(`Unknown permissions command: ${n??""}. Run 'seal-home help' for available commands.`)}import{readFileSync as DN}from"node:fs";async function SN(n,i,r,o,t,e,u){if(!n||n==="get"){await H("seal_preference_get",t,e,{},J(u.options));return}if(n==="decision"){if(i==="update"||!i){let l=D(u.options.input),$=l?JSON.parse(DN(l,"utf8")):ri(u.json);if(!$||Object.keys($).length===0)throw Error(`Usage: seal-home preference decision update --json '{"explicitApprove":"..."}'`);await H("seal_preference_decision_update",t,e,$,J(u.options));return}}if(n==="thinking-depth"||n==="thinkingDepth"){if(i==="set"){let l=D(u.options.default)??D(u.options.level)??o;if(l!=="medium"&&l!=="high")throw Error("Usage: seal-home preference thinking-depth set --default <medium|high>");await H("seal_preference_thinking_depth_set",t,e,{defaultLevel:l},J(u.options));return}if(i==="policies"){if(r==="list"||!r){await H("seal_preference_thinking_depth_policies_list",t,e,{},J(u.options));return}if(r==="upsert"){let l=D(u.options.input),$=l?JSON.parse(DN(l,"utf8")):ri(u.json);if(!$||!$.id||!$.name)throw Error(`Usage: seal-home preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await H("seal_preference_thinking_depth_policies_upsert",t,e,$,J(u.options));return}if(r==="remove"||r==="delete"){let l=o??D(u.options.id)??D(u.options.policyId);if(!l)throw Error("Usage: seal-home preference thinking-depth policies remove <policyId>");await H("seal_preference_thinking_depth_policies_remove",t,e,{policyId:l},J(u.options));return}}}throw Error(`Unknown preference action: ${n??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function AN(n={}){let i=hi(),r=bi(),o=zr(i,{stateful:r.stateful,defaultCorpId:r.defaultCorpId,corpId:n.corpId},Kt());console.log(`[probe] corp=${o.id} source=${o.source.type}`);let t=await ar(o);console.log("[probe] seal enterprise"),console.log(JSON.stringify(t,null,2));let e=await An(o),u=await _v(e,{documentLimit:20,stylePreferencesEndpoint:o.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:u.rules.rules.length,hasPendingRuleDeletes:u.rules.hasPendingDeletes,documents:u.documents.articles.length,documentsTotal:u.documents.total,stylePreferences:u.stylePreferences.ok?"ok":`error: ${u.stylePreferences.error}`},null,2))}async function ON(n,i,r){let o=i??D(r.options.corp)??(n&&n!=="--corp"?n:void 0);await AN({corpId:o})}async function kN(n,i,r,o,t){if(n==="count"){await H("seal_approval_rules_list",r,o,{countOnly:!0},J(t.options));return}if(n==="list"){if(_(t.options.count)){await H("seal_approval_rules_list",r,o,{countOnly:!0},J(t.options));return}let e=ln(t.options.limit),u=ln(t.options.offset);if(_(t.options.summary)){await H("seal_approval_rules_list",r,o,{fields:TL,limit:e,offset:u},J(t.options));return}let l=await xr("seal_approval_rules_list",r,o,{limit:e,offset:u});qL(l,_(t.options.full)===!0),K(l);return}if(n==="clear"){let e=_(t.options.yes)===!0,u=_(t.options.dryRun)??_(t.options["dry-run"])??!e;if(!e&&!u)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let l=await xr("seal_approval_rules_clear",r,o,{dryRun:u,recode:_(t.options.recode)});if(!e&&u&&l&&typeof l==="object"){K({...l,nextCommand:`seal-home rules clear --corp ${o.id} --yes`},J(t.options));return}K(l,J(t.options));return}if(n==="versions"){await H("seal_approval_rule_versions_list",r,o,{},J(t.options));return}if(n==="version"){let e=i??D(t.options.version);if(!e)throw Error("Usage: seal-home rules version <versionId|versionNumber|latest>");await H("seal_approval_rule_version_get",r,o,Ke(e),J(t.options));return}if(n==="get"){await H("seal_approval_rule_get",r,o,{...VL(D(t.options.version)),code:D(t.options.code),runtimeId:D(t.options.runtimeId)??D(t.options["runtime-id"]),recordId:D(t.options.recordId)??D(t.options["record-id"])},J(t.options));return}if(n==="search"){let e=i??D(t.options.query);if(!e)throw Error("Usage: seal-home rules search <keyword> [--version <versionId|versionNumber|latest>]");await H("seal_approval_search",r,o,{keywords:[e],areas:["rules"],maxResults:ln(t.options.maxResults),contextLines:ln(t.options.contextLines),refresh:_(t.options.refresh),snippetOnly:_(t.options.snippetOnly)??_(t.options["snippet-only"]),maxChars:ln(t.options.maxChars)??ln(t.options["max-chars"]),fields:Tn(t.options.fields),...KL(D(t.options.version))},J(t.options));return}throw Error(`Unknown rules command: ${n??""}. Run 'seal-home help' for available commands.`)}import{homedir as iF}from"node:os";import{join as tF}from"node:path";import{spawn as zQ,execFileSync as CQ}from"node:child_process";import{existsSync as RQ,mkdirSync as xQ,readFileSync as aQ,rmSync as r$,writeFileSync as Q4}from"node:fs";import{join as NN}from"node:path";async function Et(n,i,r={}){switch(n){case"run":await sQ(i);return;case"start":return dN(i);case"stop":return LN(i,r);case"restart":return LN(i,{quiet:!0}),dN(i);case"status":case void 0:return sr(i);default:throw Error("Usage: seal-home service <start|stop|restart|status>")}}function sr(n){let i=e$(n),r=F4(i),o=r?yN(r,n.appRoot):!1;if(r&&!o)r$(i,{force:!0});return{running:o,pid:o?r:void 0,version:n.version,appRoot:n.appRoot,stateDir:n.stateDir,pidFile:i,logFile:u$(n)}}async function sQ(n){let i=e$(n),r=u$(n);GN(n.stateDir),Q4(i,`${process.pid}
|
||
`,{mode:384}),o$(r,`running pid=${process.pid}`);let o=()=>{if(F4(i)===process.pid)r$(i,{force:!0});o$(r,`stopped pid=${process.pid}`)};await new Promise((t)=>{let e=!1,u=setInterval(()=>{},60000),l=()=>{if(e)return;e=!0,o(),clearInterval(u),process.off("SIGTERM",l),process.off("SIGINT",l),t()};process.once("SIGTERM",l),process.once("SIGINT",l)})}function dN(n){GN(n.stateDir);let i=sr(n);if(i.running)return i;let r=n.launcher??{command:process.execPath,args:[n.entryFile]},o=zQ(r.command,[...r.args??[],"service","run"],{cwd:n.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});o.unref();let t=e$(n);return Q4(t,`${o.pid}
|
||
`,{mode:384}),o$(u$(n),`started pid=${o.pid}`),{started:!0,...sr(n)}}function LN(n,i={}){let r=e$(n),o=F4(r);if(!o||!yN(o,n.appRoot))return r$(r,{force:!0}),i.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(o,"SIGTERM"),r$(r,{force:!0}),o$(u$(n),`stop requested pid=${o}`),i.quiet?void 0:{stopped:!0,pid:o}}function yN(n,i){if(!nF(n))return!1;try{let r=CQ("ps",["-p",String(n),"-o","command="],{encoding:"utf8"});return(r.includes(i)||r.includes("seal-home")||r.includes("src/cli.ts"))&&r.includes("service")&&r.includes("run")}catch{return!1}}function nF(n){try{return process.kill(n,0),!0}catch{return!1}}function e$(n){return NN(n.stateDir,"service.pid")}function u$(n){return NN(n.stateDir,"service.log")}function F4(n){if(!RQ(n))return;let i=Number(aQ(n,"utf8").trim());return Number.isInteger(i)&&i>0?i:void 0}function GN(n){xQ(n,{recursive:!0,mode:448})}function o$(n,i){Q4(n,`${new Date().toISOString()} ${i}
|
||
`,{flag:"a",mode:384})}var K4=tF(iF(),".config","seal-home");async function jN(n,i){let r=await Et(n,{appRoot:i.appRoot,entryFile:i.entryFile,stateDir:K4,version:R,launcher:i.launcher});if(r!==void 0)K(r)}import{existsSync as rF,readFileSync as WN}from"node:fs";async function JN(n,i,r,o,t){if(n==="batch-records"||n==="records"){let e=i??D(t.options.batchId)??D(t.options["batch-id"]);if(!e)throw Error("Usage: seal-home simulation batch-records <batchId>");await H("seal_simulation_batch_records_get",r,o,{batchId:e,query:D(t.options.query)},J(t.options));return}if(n==="create"||n==="run"){let e=D(t.options.mode)??D(t.options.sourceSystem)??D(t.options["source-system"])??"hosecloud",u=e==="material-pack"?"material_pack":e,l=D(t.options.schemaConfig)??D(t.options["schema-config"]),$=l?JSON.parse(WN(l,"utf8")):void 0,I=D(t.options.input),g=I?JSON.parse(WN(I,"utf8")):ri(t.json),b=D(t.options.packageId)??D(t.options["package-id"]),w=Tn(t.options.packageIds)??Tn(t.options["package-ids"])??(b?[b]:void 0),f=Tn(t.options.flowIds)??Tn(t.options["flow-ids"])??Tn(t.options.documentSn)??Tn(t.options["document-sn"]),c=D(t.options.signKey)??D(t.options["sign-key"])??D(t.options.integration);await H("seal_simulation_batch_create",r,o,{mode:u,sourceSystem:u,flowIds:f,documentSn:f,rejectNodeName:D(t.options.rejectNode)??D(t.options["reject-node"])??null,thinkingDepthOverride:D(t.options.thinkingDepth)??D(t.options["thinking-depth"]),skipInvoiceGeneration:_(t.options.skipInvoiceGeneration)??_(t.options["skip-invoice-generation"]),skipExpenseExtraction:_(t.options.skipExpenseExtraction)??_(t.options["skip-expense-extraction"]),disableAttachmentCache:_(t.options.disableAttachmentCache)??_(t.options["disable-attachment-cache"]),signKey:c,packageIds:w,packageId:b,templateId:D(t.options.templateId)??D(t.options["template-id"]),schemaConfig:$,requestIds:Tn(t.options.requestIds)??Tn(t.options["request-ids"]),workflowTypeId:D(t.options.workflowTypeId)??D(t.options["workflow-type-id"]),flowStatusList:Tn(t.options.flowStatusList)?.map(Number)??Tn(t.options["flow-status-list"])?.map(Number),businessCodes:Tn(t.options.businessCodes)??Tn(t.options["business-codes"]),documentType:D(t.options.documentType)??D(t.options["document-type"]),startTime:ln(t.options.startTime)??ln(t.options["start-time"]),endTime:ln(t.options.endTime)??ln(t.options["end-time"]),status:Tn(t.options.status),limit:ln(t.options.limit),rawParams:g},J(t.options));return}if(n==="wait"){let e=i??D(t.options.batchId)??D(t.options["batch-id"]);if(!e)throw Error("Usage: seal-home simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await H("seal_simulation_batch_wait",r,o,{batchId:e,timeout:D(t.options.timeout),pollInterval:D(t.options.pollInterval)??D(t.options["poll-interval"])},J(t.options));return}if(n==="clean"||n==="delete"){let e=i??D(t.options.batchId)??D(t.options["batch-id"]);if(!e)throw Error("Usage: seal-home simulation clean <batchId>");await H("seal_simulation_batch_clean",r,o,{batchId:e},J(t.options));return}if(n==="specifications"){let e=i??D(t.options.integration)??D(t.options.signKey)??D(t.options["sign-key"]);await H("seal_simulation_specifications_list",r,o,{signKey:e},J(t.options));return}if(n==="list"){await H("seal_simulation_batches_list",r,o,{limit:ln(t.options.limit)},J(t.options));return}if(n==="get"){let e=i??D(t.options.batchId)??D(t.options["batch-id"]);if(!e)throw Error("Usage: seal-home simulation get <batchId>");await H("seal_simulation_batch_get",r,o,{batchId:e},J(t.options));return}if(n==="templates"){await H("seal_simulation_templates_get",r,o,{},J(t.options));return}if(n==="integrations"){await H("seal_simulation_integrations_get",r,o,{},J(t.options));return}if(n==="package-upload"){let e=i??D(t.options.file);if(!e)throw Error("Usage: seal-home simulation package-upload <材料包.zip>");if(!rF(e))throw Error(`File not found: ${e}`);await H("seal_simulation_material_package_upload",r,o,{filePath:e},J(t.options));return}throw Error(`Unknown simulation command: ${n??""}. Run 'seal-home help' for available commands.`)}import{existsSync as mN}from"node:fs";import{join as l$}from"node:path";import{mkdirSync as TN,writeFileSync as cF}from"node:fs";import{homedir as UF}from"node:os";import{dirname as DF,join as qN}from"node:path";var HN=`---
|
||
name: seal-home
|
||
description: "v0.9.8: Use for Seal Home first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
|
||
metadata:
|
||
version: 0.9.8
|
||
short-description: Seal tenant and Hose approval automation (v0.9.8)
|
||
---
|
||
|
||
# Seal Home (v0.9.8)
|
||
|
||
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-home\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
||
|
||
\`\`\`bash
|
||
seal-home help
|
||
seal-home version
|
||
seal-home tools list
|
||
\`\`\`
|
||
|
||
## First Rules
|
||
|
||
- Treat CLI/MCP as the Agent's execution channel, not the user's interface. Translate natural-language intent into commands yourself; never ask the user to compose CLI syntax, JSON payloads, placeholder values, or internal IDs.
|
||
- Before asking for enterprise parameters, run \`seal-home corps list\`. If the target is already configured, resolve its human name to the returned \`id\` and pass that value as \`--corp\`; do not ask the user to know \`corpId\`.
|
||
- If no enterprise is configured, the user is installing for the first time, or the user provides credentials, an assistance link, or a browser-copied cURL, read \`references/enterprise-onboarding.md\` before asking questions or running setup commands.
|
||
- When the user provides a Hose/合思 \`thirdparty.html\` assistance link, use \`seal-home corps add-link <url> [--name ...]\`; the command verifies the tenant and records the temporary Seal session without echoing the link token.
|
||
- Keep enterprise identity origin separate from credential acquisition. A Hose/合思-sourced Seal tenant can be accessed with standard Hose app credentials, an assistance link, or a captured web session; receiving a Seal Bearer token does not by itself prove the tenant is Seal-native.
|
||
- Never ask a normal user for \`corpId\`, \`staffId\`, \`proxyStaffBizId\`, \`tenantId\`, or another discoverable internal ID. Discover it first. If discovery fails, explain what the field means, why it could not be discovered, and exactly where the user can find it.
|
||
- Prefer compact commands first: \`pick\`, \`--summary\`, \`--fields\`, \`attachments --summary\`, \`rules count\`, and \`rules list --summary\`.
|
||
- Parse JSON stdout. Do not scrape human text.
|
||
- Do not hand-edit enterprise configs for normal setup. Use \`seal-home corps ...\`.
|
||
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For repeat test-environment rule resets, prefer \`rules clear --dry-run\` followed by \`rules clear --yes\`.
|
||
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of \`description\`; preserve \`scope\`, \`strictness\`, and unrelated clauses unless the user explicitly approves otherwise.
|
||
- Resolve and lock the target enterprise \`corpId\` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
|
||
- For date questions, use explicit dates and \`--timezone Asia/Shanghai\`.
|
||
- If output may be large, use \`--summary\`, \`--fields\`, \`--count\`, or \`--output-file\`; use \`--full\` only when the user really needs full payloads.
|
||
- When returning ANY authorization, login, or delegation links (e.g. 合思授权链接, Seal授权链接/委托链接), ALWAYS provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
|
||
- For delegation links, always prefer \`seal-home delegation create\` over \`users delegation\` for link generation to ensure persistent token tracking.
|
||
- Never treat “Seal 协助/Seal 授权/委托” as a 合思授权入口. They are different links and must use different commands.
|
||
- In the default stateless mode, every enterprise command requires \`--corp <corpId>\`. In stateful mode, omitting \`--corp\` uses the configured default enterprise and is unsafe for an explicitly named enterprise.
|
||
- For an explicitly named enterprise, first resolve it with \`seal-home corps list\`, then pass its exact \`corpId\` to every command. After creation, verify the returned URL host matches that enterprise's Seal tenant; if the host is the current/default tenant or cannot be verified, do not present the link as the target enterprise's link.
|
||
|
||
## Route By Intent
|
||
|
||
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read \`references/enterprise-onboarding.md\`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
|
||
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run \`seal-home delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) AND a hyperlink.
|
||
- Packaged customer feedback → approval-rule remediation: read \`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
|
||
- 模拟测试发布闭环: \`seal-home simulation create --mode hosecloud --flow-ids ... --corp <corpId>\` (合思指定单号) 或 \`--mode material_pack --package-ids ... --schema-config file.json\` (材料包导入), 支持多源系统 \`--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>\`, \`simulation wait <batchId>\` 轮询等待完成, \`simulation clean <batchId>\` 清理数据, \`simulation specifications\` 列出单据模板, \`simulation list\`/\`get\`/\`batch-records\` 查看批次与记录。创建前确认目标环境为测试环境。
|
||
- HoseCloud 部署与同步发布: \`seal-home deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>\`.
|
||
- 审核决策偏好与思考深度: \`seal-home preference get --corp <corpId>\`, \`preference decision update --json '...' --corp <corpId>\`, \`preference thinking-depth set --default <medium|high> --corp <corpId>\`, \`preference thinking-depth policies <list|upsert|remove> --corp <corpId>\`.
|
||
- 审核大盘统计与去重分析: \`seal-home approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|id] --corp <corpId>\`, \`seal-home approval-runs count --corp <corpId>\`.
|
||
- User-facing 合思 authorization link (合思/易快报授权): \`seal-home auth hose-link --corp <corpId> --expire 7200\`; read \`references/hose-enterprise-auth.md\`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) AND a hyperlink.
|
||
- Delegation links management: \`seal-home delegation list --corp <corpId>\`, \`create [--note ...] --corp <corpId>\`, \`create --from-link <url> [--note ...]\`, \`revoke <tokenId> --corp <corpId>\`.
|
||
- User & Contacts Management (用户搜索、激活与一键代生成授权): \`seal-home users search [keyword] --corp <corpId>\`, \`users delegation <userIdOrPhone> --corp <corpId>\` (仅适用于 Seal 本地创建的账号 \`provider: local\`;对合思同步账号系统拒绝重置密码,需改用 \`auth hose-link\`), \`users activate <userId> --corp <corpId>\`, \`users create --name ... --phone ... --corp <corpId>\`, \`reset-password <userId> --corp <corpId>\`, \`get <userId> --corp <corpId>\`, \`delete <userId> --corp <corpId>\`.
|
||
- LLM Model Config & Providers: \`seal-home llm config --corp <corpId>\`, \`seal-home llm providers --corp <corpId>\`.
|
||
- System Permissions Config: \`seal-home permissions available --corp <corpId>\`, \`seal-home permissions configs --corp <corpId>\`.
|
||
- Billing & Feature Quotas: \`seal-home billing status --corp <corpId>\`, \`seal-home billing plans --corp <corpId>\`, \`seal-home billing features --corp <corpId>\`.
|
||
- Webhook 审批回调管理: \`seal-home webhook <list|get|add|update|delete> --corp <corpId>\`.
|
||
- HTTP REST API & Docs Server: \`seal-home http [--port 8787] [--host 127.0.0.1]\` (提供 \`/docs\` 交互文档、\`/openapi.json\`、\`POST /api/cli\` 与 \`/v1/*\` REST API)。
|
||
- Full CLI inventory: read \`references/cli.md\`.
|
||
|
||
## High-Value Commands
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest
|
||
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest --fields recordId,status,aiDecision,aiSummary
|
||
seal-home approval-runs get <recordId> --corp <corpId> --summary
|
||
seal-home approval-runs get <recordId> --corp <corpId> --fields metadata,document.fields,result.summary
|
||
seal-home approval-runs document-summary <recordId> --corp <corpId>
|
||
seal-home approval-runs cited-rules <recordId> --corp <corpId>
|
||
seal-home approval-runs attachments <recordId> --corp <corpId> --summary
|
||
seal-home approval-runs result <recordId> --corp <corpId> --summary
|
||
seal-home rules count --corp <corpId>
|
||
seal-home rules list --corp <corpId> --summary
|
||
seal-home rules clear --corp <corpId> --dry-run
|
||
seal-home rules clear --corp <corpId> --yes
|
||
seal-home rules get --corp <corpId> --version 16 --code '#0038'
|
||
seal-home rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
|
||
seal-home simulation create --corp <corpId> --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high]
|
||
seal-home simulation create --corp <corpId> --mode material_pack --package-ids <materialPackageId> [--schema-config file.json]
|
||
seal-home simulation package-upload <材料包.zip> --corp <corpId>
|
||
seal-home simulation list --corp <corpId>
|
||
seal-home simulation get <batchId> --corp <corpId>
|
||
seal-home simulation batch-records <batchId> --corp <corpId>
|
||
seal-home tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅","发票"],"areas":["rules"],"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
|
||
\`\`\`
|
||
|
||
## Important Fields
|
||
|
||
- \`sourceDocumentSN\`: external document number, often the easiest 合思/易快报 lookup key.
|
||
- \`sourceDocumentId\`: external source document ID.
|
||
- \`recordId\`: Seal approval run record ID.
|
||
- \`simulationBatchId\`: simulation batch identifier.
|
||
- \`status\`: run status.
|
||
- \`taskMode\` / \`finalExecutionMode\`: execution mode information.
|
||
- \`ruleSetVersionNumber\`: approval rule version used by a run.
|
||
- \`langfuseTraceId\`: direct Langfuse trace lookup key.
|
||
- \`langfuseSessionFallback\`: fallback session key, usually \`hosecloud-{sourceDocumentSN}\`.
|
||
|
||
## References
|
||
|
||
- \`references/enterprise-onboarding.md\`: 首次安装、零配置、合思来源与 Seal 原生来源的区分、标准密钥/协助链接/F12 cURL 接入、参数责任与安全边界。
|
||
- \`references/approval-run-lightweight.md\`: 单号定位、字段裁剪、摘要、引用规则、单据摘要、附件摘要。
|
||
- \`references/rule-lightweight.md\`: 规则 count/list summary、按版本/编号取单条规则、规则搜索裁剪。
|
||
- \`references/customer-feedback-rule-remediation.md\`: 微信/截图反馈包到企业定位、审批追踪、根因分类、最小规则 diff、确认、发布与验收的固定闭环。
|
||
- \`references/hose-enterprise-auth.md\`: Hose 企业配置、认证诊断、授权链接。
|
||
- \`references/hose-enterprise-init.md\`: 合思标准密钥的域名、企业与管理员自动发现,以及多候选管理员的安全选择。
|
||
- \`references/approval-attachment-trace.md\`: 附件/发票/OCR/图片争议的 Langfuse 追踪工作流。
|
||
- \`references/cli.md\`: 完整 CLI 命令清单。
|
||
|
||
## Safety
|
||
|
||
Rule, document, style preference, and publish actions mutate Seal configuration. Make the target enterprise explicit, show the intended payload, and verify after the write. Never send real \`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
|
||
`;var XN=`interface:
|
||
display_name: "Seal Home"
|
||
short_description: "Diagnose approval feedback and publish minimal rule fixes"
|
||
default_prompt: "Use $seal-home to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
|
||
`;var hN=`# Rule Lightweight Queries
|
||
|
||
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
|
||
|
||
## Count Rules
|
||
|
||
Use count when only scale or existence matters.
|
||
|
||
\`\`\`bash
|
||
seal-home rules count --corp <corpId>
|
||
\`\`\`
|
||
|
||
Expected shape:
|
||
|
||
\`\`\`json
|
||
{ "count": 191 }
|
||
\`\`\`
|
||
|
||
Tool-layer equivalent:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rules_list --corp <corpId> --json '{"countOnly":true}'
|
||
seal-home tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id"],"limit":0}'
|
||
\`\`\`
|
||
|
||
## List Rule Summaries
|
||
|
||
Use summaries for navigation and selection.
|
||
|
||
\`\`\`bash
|
||
seal-home rules list --corp <corpId> --summary
|
||
\`\`\`
|
||
|
||
Default summary should include only fields such as \`id\`, \`code\`, \`scope\`, \`strictness\`, \`status\`, and \`updatedAt\`. Do not pull \`description\` unless the user needs rule text.
|
||
|
||
Tool-layer equivalent:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id","code","scope","strictness","status","updatedAt"]}'
|
||
\`\`\`
|
||
|
||
## Clear Draft Rules Before Import
|
||
|
||
Use this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.
|
||
|
||
\`\`\`bash
|
||
seal-home rules clear --corp <corpId> --dry-run
|
||
seal-home rules clear --corp <corpId> --yes
|
||
\`\`\`
|
||
|
||
Expected shape:
|
||
|
||
\`\`\`json
|
||
{
|
||
"corpId": "xiezihao",
|
||
"dryRun": false,
|
||
"beforeCount": 49,
|
||
"deleted": 49,
|
||
"afterCount": 0
|
||
}
|
||
\`\`\`
|
||
|
||
Tool-layer equivalent:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":true}'
|
||
seal-home tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":false}'
|
||
\`\`\`
|
||
|
||
## Get One Historical Rule
|
||
|
||
Use this when a run used a historical rule version and current rules may differ.
|
||
|
||
\`\`\`bash
|
||
seal-home rules get --corp <corpId> --version 16 --code '#0038'
|
||
seal-home rules get --corp <corpId> --version latest --code '#0038'
|
||
\`\`\`
|
||
|
||
If the user starts from a run and a runtime ID such as \`rule-205\`, resolve against that run:
|
||
|
||
\`\`\`bash
|
||
seal-home rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
|
||
\`\`\`
|
||
|
||
Return the single rule text plus \`scope\`, \`strictness\`, \`status\`, \`versionNumber\`, and version metadata. Avoid commands that dump a whole rule version unless the user asks for the full version.
|
||
|
||
## Search Approval Knowledge Compactly
|
||
|
||
Prefer scoped and trimmed search:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"matchMode":"any","maxResults":20,"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
|
||
\`\`\`
|
||
|
||
When investigating historical behavior, search the matching rule version if the API supports it:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","versionNumber":16,"snippetOnly":true,"maxChars":500}'
|
||
\`\`\`
|
||
|
||
Use current search only when the question is about current draft/current knowledge, not why a historical run behaved a certain way.
|
||
|
||
## Output Discipline
|
||
|
||
If a rule command would return many descriptions or more than about 20 rules, use \`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
|
||
`;var PN=`# Approval Bad Case Catalog
|
||
|
||
Use this file only as a comparison catalog after inspecting the current trace. Do not treat any case below as a default diagnosis.
|
||
|
||
## Case A: Receipt-Like Attachments Labeled As Invoices
|
||
|
||
Symptom:
|
||
|
||
- UI finding said attachments contained fixed-amount invoices that were not uploaded to the invoice field.
|
||
- Customer said the 160 and 90 slips were receipts, not invoices.
|
||
|
||
Failure pattern:
|
||
|
||
- Raw attachment objects and invoice-list objects had similar names/content but different IDs.
|
||
- \`image_understanding\` first introduced loose or wrong labels such as "发票(或收据)" and "定额发票".
|
||
- \`document_parsing\` inherited those labels.
|
||
- \`approval_review\` converted the inherited labels into a rule finding.
|
||
|
||
Checklist:
|
||
|
||
- Compare raw attachment IDs and invoice-list IDs before making a claim.
|
||
- Inspect the original image for formal invoice elements.
|
||
- If the image lacks invoice title, tax supervision seal, invoice code/number, and tax fields, the customer's receipt interpretation may be reasonable.
|
||
|
||
## Case B: Payment Amount Passed Earlier, Then Excluded Later
|
||
|
||
Symptom:
|
||
|
||
- UI finding said payment screenshots totaled only 1550 (\`650+900\`) against reimbursement amount 3400.
|
||
- Customer said the 1850 screenshot was also a payment-support screenshot and should have been included.
|
||
|
||
Failure pattern:
|
||
|
||
- The same six images appeared twice: under fee-detail attachments (\`file-1\` to \`file-6\`) and form-level attachments (\`file-7\` to \`file-12\`).
|
||
- \`image_understanding\` did not lose the 1850 amount; it extracted \`1850.00\`.
|
||
- \`pre_analysis\` explicitly passed 1850 as a payment-screenshot amount candidate in a review point: "付款截图金额(1850.00元)".
|
||
- \`document_parsing\` later reclassified \`1850.jpg\` as "收款凭证,非付款截图", overriding the review-point premise.
|
||
- Duplicate \`900.jpg\` entries produced inconsistent parser conclusions; final review included 900 but excluded 1850.
|
||
|
||
Checklist:
|
||
|
||
- If an amount is missing from the final total, check whether it was recognized in \`image_understanding\`.
|
||
- If recognized, check whether \`pre_analysis\` passed it in \`attachmentInstructions.reviewPoints\`.
|
||
- If passed, check whether \`document_parsing\` ignored or reclassified it.
|
||
- If the same image appears under multiple \`fileId\`s, compare duplicate conclusions before trusting final aggregation.
|
||
|
||
Important nuance:
|
||
|
||
- This is a bad-case pattern, not a general rule that every amount-total dispute is caused by \`pre_analysis\`.
|
||
- Use it when the current trace shows recognized amounts being excluded downstream or duplicate attachments producing inconsistent conclusions.
|
||
`;var YN=`# Seal Home CLI Reference
|
||
|
||
Run from any directory after installing the global CLI:
|
||
|
||
\`\`\`bash
|
||
seal-home <command>
|
||
\`\`\`
|
||
|
||
Enterprise config lookup:
|
||
|
||
- If \`SEAL_HOME_ENTERPRISES_DIR\` is set, only that directory is loaded.
|
||
- Otherwise \`./enterprises\` and \`~/.config/seal-home/enterprises\` are merged.
|
||
- User-level configs override same-ID local configs.
|
||
|
||
Enterprise selection is stateless by default. Commands that access an enterprise require
|
||
\`--corp <corpId>\` unless stateful mode is explicitly enabled:
|
||
|
||
\`\`\`bash
|
||
seal-home config mode stateful --corp <corpId>
|
||
seal-home corps switch <corpId>
|
||
seal-home config mode stateless
|
||
\`\`\`
|
||
|
||
The global mode is stored in \`~/.config/seal-home/config.json\`; set \`SEAL_HOME_CONFIG_FILE\` to
|
||
override that path. The legacy \`current-corp\` file is not read.
|
||
|
||
## Top-Level Commands
|
||
|
||
\`\`\`bash
|
||
seal-home version
|
||
seal-home config paths
|
||
seal-home config get
|
||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||
seal-home service <start|stop|restart|status>
|
||
seal-home http [--port 8787] [--host 127.0.0.1]
|
||
seal-home serve [--port 8787]
|
||
seal-home update
|
||
seal-home tools list
|
||
seal-home corps list [--corp <corpId>]
|
||
seal-home corps current [--corp <corpId>]
|
||
seal-home corps switch <corpId>
|
||
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
|
||
seal-home corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
|
||
seal-home corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
|
||
seal-home auth diagnose [--corp <corpId>]
|
||
seal-home auth hose-link [--corp <corpId>] [--expire 7200]
|
||
seal-home delegation list [--corp <corpId>]
|
||
seal-home delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
|
||
seal-home delegation revoke <tokenId> [--corp <corpId>]
|
||
seal-home users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
|
||
seal-home users reset-password <userId> [--corp <corpId>]
|
||
seal-home users get <userId> [--corp <corpId>]
|
||
seal-home users delete <userId> [--corp <corpId>]
|
||
seal-home llm config [--corp <corpId>]
|
||
seal-home llm providers [--corp <corpId>]
|
||
seal-home permissions available [--corp <corpId>]
|
||
seal-home permissions configs [--corp <corpId>]
|
||
seal-home billing status [--corp <corpId>]
|
||
seal-home billing plans [--corp <corpId>]
|
||
seal-home billing features [--corp <corpId>]
|
||
seal-home webhook list [--query <text>] [--show-secret] [--corp <corpId>]
|
||
seal-home webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
|
||
seal-home webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
|
||
seal-home webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
|
||
seal-home webhook delete <idOrName> --yes [--corp <corpId>]
|
||
seal-home deploy hosecloud requirements [--corp <corpId>]
|
||
seal-home deploy hosecloud list [--corp <corpId>]
|
||
seal-home deploy hosecloud get <sign-key> [--corp <corpId>]
|
||
seal-home deploy hosecloud status [--corp <corpId>]
|
||
seal-home deploy hosecloud configure --json '{...}' [--corp <corpId>]
|
||
seal-home deploy hosecloud sync <sign-key> [--corp <corpId>]
|
||
seal-home preference get [--corp <corpId>]
|
||
seal-home preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
|
||
seal-home preference thinking-depth set --default <medium|high> [--corp <corpId>]
|
||
seal-home preference thinking-depth policies list [--corp <corpId>]
|
||
seal-home preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]
|
||
seal-home preference thinking-depth policies remove <policyId> [--corp <corpId>]
|
||
seal-home source config [--corp <corpId>]
|
||
seal-home tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
|
||
seal-home approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
|
||
seal-home approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]
|
||
seal-home approval-runs count --corp <corpId> [--status APPROVED]
|
||
seal-home approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]
|
||
seal-home approval-runs get <recordId> --corp <corpId> [--fields metadata|document.fields,result.summary] [--output-file file.json]
|
||
seal-home approval-runs attachments <recordId> --corp <corpId>
|
||
seal-home approval-runs result <recordId> --corp <corpId> [--summary]
|
||
seal-home approval-runs url --corp <corpId>
|
||
seal-home approval-runs url <recordId> --corp <corpId>
|
||
seal-home approval-runs url --sourceDocumentSN <sourceDocumentSN> --corp <corpId>
|
||
seal-home approval-runs bridge --corp <corpId> [--sourceDocumentSN <sourceDocumentSN>]
|
||
seal-home simulation batch-records <batchId> --corp <corpId>
|
||
seal-home simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] --corp <corpId>
|
||
seal-home simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] --corp <corpId>
|
||
seal-home simulation create --source-system weaver --request-ids "req-01,req-02" --corp <corpId>
|
||
seal-home simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] --corp <corpId>
|
||
seal-home simulation clean <batchId> --corp <corpId>
|
||
seal-home simulation specifications [--integration <sign-key>] --corp <corpId>
|
||
seal-home simulation list [--limit 50] --corp <corpId>
|
||
seal-home simulation get <batchId> --corp <corpId>
|
||
seal-home simulation templates --corp <corpId>
|
||
seal-home simulation integrations --corp <corpId>
|
||
seal-home simulation package-upload <材料包.zip> --corp <corpId>
|
||
\`\`\`
|
||
|
||
## Fine-Grained Tools
|
||
|
||
\`seal-home version\` returns:
|
||
|
||
\`\`\`json
|
||
{
|
||
"name": "seal-home",
|
||
"version": "<package version>"
|
||
}
|
||
\`\`\`
|
||
|
||
\`seal-home service status\` returns the PID, version, state directory, PID file, and log file for the optional local background process.
|
||
|
||
\`seal-home update\` updates the git checkout, runs \`bun install\`, and restarts the local service if it was running.
|
||
|
||
Identity and session:
|
||
|
||
- \`seal-home auth diagnose --corp <corpId>\`
|
||
- \`seal_whoami\`
|
||
- \`seal_session_get\`
|
||
|
||
Approval rule maintenance:
|
||
|
||
- \`seal-home rules count [--corp <corpId>]\`
|
||
- \`seal-home rules list --summary [--corp <corpId>]\`
|
||
- \`seal-home rules clear [--corp <corpId>] [--dry-run|--yes]\`
|
||
- \`seal_approval_rules_list\`
|
||
- \`seal_approval_rules_clear\`
|
||
- \`seal_approval_rule_create\`
|
||
- \`seal_approval_rule_update\`
|
||
- \`seal_approval_rule_delete\`
|
||
- \`seal_approval_rule_versions_list\`
|
||
- \`seal_approval_rule_version_publish\`
|
||
|
||
Approval run lightweight queries:
|
||
|
||
- \`seal-home approval-runs get <recordId> --corp <corpId> --fields metadata\`
|
||
- \`seal-home approval-runs get <recordId> --corp <corpId> --summary\`
|
||
- \`seal-home approval-runs pick --corp <corpId> --sn <单号> --batch <batchId> --latest\`
|
||
- \`seal-home approval-runs document-summary <recordId> --corp <corpId>\`
|
||
- \`seal-home approval-runs cited-rules <recordId> --corp <corpId>\`
|
||
- \`seal-home approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\`
|
||
- \`seal-home approval-runs attachments <recordId> --corp <corpId> --summary\`
|
||
- \`seal-home approval-runs result <recordId> --corp <corpId> --summary\`
|
||
- \`seal_approval_run_get\` with \`fields\`
|
||
- \`seal_approval_run_pick\`
|
||
- \`seal_approval_run_cited_rules_get\`
|
||
- \`seal_approval_run_document_summary_get\`
|
||
- \`seal_approval_run_attachments_get\`
|
||
- \`seal_approval_run_result_get\` with \`{"summary":true}\`
|
||
|
||
Approval knowledge documents:
|
||
|
||
- \`seal_approval_documents_list\`
|
||
- \`seal_approval_document_get\`
|
||
- \`seal_approval_document_create\`
|
||
- \`seal_approval_document_update\`
|
||
|
||
Approval search and context:
|
||
|
||
- \`seal_approval_search\`
|
||
- \`seal_approval_context_get\`
|
||
- \`seal-home rules get --corp <corpId> --version <number> --code '#0038'\`
|
||
- \`seal-home rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205\`
|
||
|
||
Style preferences:
|
||
|
||
- \`seal_approval_style_preferences_get\`
|
||
- \`seal_approval_style_preferences_update\`
|
||
|
||
Webhook integrations:
|
||
|
||
- \`seal-home webhook list [--query <text>] [--show-secret] [--corp <corpId>]\`
|
||
- \`seal-home webhook get|find <idOrName> [--show-secret] [--corp <corpId>]\`
|
||
- \`seal-home webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]\`
|
||
- \`seal-home webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]\`
|
||
- \`seal-home webhook delete <idOrName> --yes [--corp <corpId>]\`
|
||
- \`seal_webhook_list\`
|
||
- \`seal_webhook_get\`
|
||
- \`seal_webhook_add\`
|
||
- \`seal_webhook_update\`
|
||
- \`seal_webhook_delete\`
|
||
|
||
Webhook writes read the current AI approval config and POST the merged full config back to \`api/v1/agent/ai-approval/config\`, preserving non-Webhook integrations. List/get mask \`secret\` by default; add returns the generated secret once.
|
||
|
||
Approval runs, simulations, and Langfuse bridge:
|
||
|
||
- \`seal_approval_runs_search\`
|
||
- \`seal_approval_runs_summary\`
|
||
- \`seal_simulation_batch_records_get\`
|
||
- \`seal_simulation_batch_create\`
|
||
- \`seal_simulation_batches_list\`
|
||
- \`seal_simulation_batch_get\`
|
||
- \`seal_simulation_templates_get\`
|
||
- \`seal_simulation_integrations_get\`
|
||
- \`seal_approval_run_langfuse_bridge_get\`
|
||
|
||
## Common Examples
|
||
|
||
Add and verify a Hose enterprise:
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
|
||
seal-home auth diagnose --corp <corpId>
|
||
\`\`\`
|
||
|
||
Force-write a Hose config without verification:
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId","force":true}'
|
||
\`\`\`
|
||
|
||
Diagnose auth failures:
|
||
|
||
\`\`\`bash
|
||
seal-home auth diagnose --corp <corpId>
|
||
\`\`\`
|
||
|
||
The diagnostic stages are \`hose.openapi\`, \`hose.provisional\`, \`seal.sso\`, and \`seal.whoami\`. Tokens are omitted from output.
|
||
|
||
Search approval content:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"matchMode":"any","maxResults":20}'
|
||
\`\`\`
|
||
|
||
Get aggregated approval context:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_context_get --corp <corpId> --json '{"documentLimit":20}'
|
||
\`\`\`
|
||
|
||
Create a draft approval rule:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rule_create --corp <corpId> --json '{"description":"规则描述","scope":"适用场景","strictness":"SHOULD_FOLLOW"}'
|
||
\`\`\`
|
||
|
||
Update an approval document:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_document_update --corp <corpId> --json '{"documentId":"doc-id","content":"Markdown 内容"}'
|
||
\`\`\`
|
||
|
||
Summarize one local date:
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs summary --corp <corpId> --date 2026-06-09 --timezone Asia/Shanghai --limit 100
|
||
\`\`\`
|
||
|
||
Find a run and include Langfuse bridge rows:
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs search --corp <corpId> --query <sourceDocumentSN> --limit 20 --includeBridge true
|
||
\`\`\`
|
||
|
||
Resolve Langfuse trace/session hints:
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs bridge --corp <corpId> --sourceDocumentSN <sourceDocumentSN>
|
||
\`\`\`
|
||
|
||
模拟测试批次(模拟发布闭环)创建与查询:
|
||
|
||
\`\`\`bash
|
||
# 合思指定单号: 创建批次(响应只含 batchId)
|
||
seal-home simulation create --mode hosecloud --flow-ids "B26017701,B26022501" --reject-node 财务 --thinking-depth medium --skip-invoice-generation --corp <corpId>
|
||
# 材料包导入: 先上传材料包 ZIP(服务端解析并返回 schemaConfig), 再用返回的 id 发起
|
||
seal-home simulation package-upload 测试材料包.zip --corp <corpId>
|
||
seal-home simulation create --mode material_pack --package-ids <materialPackageId> --template-id conference_reimbursement_v1 --schema-config schema.json --corp <corpId>
|
||
# 预留: 其他模式参数通过 --json 透传(如时间范围 startTime/endTime)
|
||
seal-home simulation create --mode hosecloud --flow-ids "B26017701" --json '{"startTime":0,"endTime":0}' --corp <corpId>
|
||
# 创建后轮询批次状态与记录
|
||
seal-home simulation list --limit 50 --corp <corpId>
|
||
seal-home simulation get <batchId> --corp <corpId>
|
||
seal-home simulation batch-records <batchId> --corp <corpId>
|
||
seal-home simulation templates --corp <corpId>
|
||
seal-home simulation integrations --corp <corpId>
|
||
\`\`\`
|
||
|
||
## Write Operation Payloads
|
||
|
||
Create a rule:
|
||
|
||
\`\`\`json
|
||
{
|
||
"description": "规则描述",
|
||
"scope": "适用场景",
|
||
"strictness": "MUST_FOLLOW | SHOULD_FOLLOW | SUGGESTION"
|
||
}
|
||
\`\`\`
|
||
|
||
Update a rule:
|
||
|
||
\`\`\`json
|
||
{
|
||
"ruleId": "rule-id",
|
||
"description": "可选",
|
||
"scope": "可选",
|
||
"strictness": "SHOULD_FOLLOW"
|
||
}
|
||
\`\`\`
|
||
|
||
Publish a rule version:
|
||
|
||
\`\`\`json
|
||
{
|
||
"versionName": "版本名称"
|
||
}
|
||
\`\`\`
|
||
|
||
Create a document:
|
||
|
||
\`\`\`json
|
||
{
|
||
"title": "标题",
|
||
"purpose": "用途",
|
||
"content": "Markdown 内容",
|
||
"contentType": "text/markdown",
|
||
"status": "可选",
|
||
"scenarios": ["场景"],
|
||
"tags": ["标签"]
|
||
}
|
||
\`\`\`
|
||
|
||
Update a document:
|
||
|
||
\`\`\`json
|
||
{
|
||
"documentId": "doc-id",
|
||
"title": "可选",
|
||
"purpose": "可选",
|
||
"content": "可选",
|
||
"enabled": true,
|
||
"scenarios": ["可选"],
|
||
"tags": ["可选"]
|
||
}
|
||
\`\`\`
|
||
|
||
Update style preferences:
|
||
|
||
\`\`\`json
|
||
{
|
||
"tone": "可选",
|
||
"language": "可选",
|
||
"detailLevel": "可选",
|
||
"outputFormat": "可选",
|
||
"examples": ["可选"],
|
||
"prohibitedPhrases": ["可选"],
|
||
"customInstructions": "可选"
|
||
}
|
||
\`\`\`
|
||
|
||
## Failure Handling
|
||
|
||
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use \`seal-home service restart\` after updates so the optional local service picks up new code.
|
||
- If no run is found by \`sourceDocumentSN\`, retry with \`sourceDocumentId\` or a broader \`query\`.
|
||
- If date-based summaries look wrong, pass \`--timezone Asia/Shanghai\` and an explicit \`--date\`.
|
||
- If \`langfuseTraceId\` is missing, use \`langfuseSessionFallback\`.
|
||
- If a write operation fails, report the raw JSON error and do not retry with guessed payloads.
|
||
`;var pN="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest\nseal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest\nseal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-home approval-runs get <recordId> --corp <corpId> --summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-home approval-runs get <recordId> --corp <corpId> --fields metadata\nseal-home approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\nseal-home approval-runs get <recordId> --corp <corpId> --fields result.summary,result.decision,result.riskPoints\nseal-home approval-runs get <recordId> --corp <corpId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-home approval-runs document-summary <recordId> --corp <corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-home approval-runs cited-rules <recordId> --corp <corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rules get --record-id <recordId> --runtime-id rule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\nseal-home approval-runs attachments <recordId> --corp <corpId> --summary\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-home approval-runs result <recordId> --corp <corpId> --summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Output Discipline\n\nIf a command warns that output is large, do not retry with `--full` reflexively. Narrow with `--summary`, `--fields`, or `--output-file` first.\n";var QN=`# Approval Attachment Trace Investigation
|
||
|
||
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
|
||
|
||
The goal is to locate where an imprecise claim first entered the pipeline. Do not jump directly from the final approval result to a rule change. Many issues start earlier in the attachment understanding or attachment review stages.
|
||
|
||
## Mental Model
|
||
|
||
Approval traces commonly contain these stages:
|
||
|
||
1. Source document rendering
|
||
- Seal converts the approval document into the Markdown-like "AI saw" document.
|
||
- This may include both structured invoice fields and raw attachment fields.
|
||
2. Rule matching
|
||
- Selects applicable rule scopes such as "存在发票或收据时" or "存在发票时".
|
||
- This stage is not the final source of attachment type judgments; it works from the rendered document.
|
||
3. Image understanding
|
||
- Vision model reads each image attachment and writes \`document_content\`.
|
||
- This is often where loose labels such as "发票(或收据)", "定额发票", "销售单", or "支付凭证" first appear.
|
||
4. Pre-analysis
|
||
- Generates \`attachmentInstructions\` and \`reviewPoints\` for later per-attachment review.
|
||
- This stage can matter when a later attachment review seems to ignore or override values already present in the generated review points.
|
||
5. Document parsing / attachment review
|
||
- A text model checks review points against the image-understanding text.
|
||
- If the review point already says "该附件(定额发票)", it usually inherited that label from the previous stage instead of independently classifying the original image.
|
||
- Check whether this stage uses values passed in the review point, or reclassifies the attachment and discards them.
|
||
6. Final approval review
|
||
- Produces \`rulesResult\`, summaries, and UI findings.
|
||
- Final findings can amplify earlier labels into business conclusions, for example "附件中存在定额发票未上传至发票栏位".
|
||
|
||
## Commands
|
||
|
||
Start from the Seal run and Langfuse trace.
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs search --corp <corpId> --query <sourceDocumentSN> --limit 50
|
||
seal-home approval-runs get <recordId> --corp <corpId> > /tmp/seal-run.json
|
||
seal-home approval-runs bridge --corp <corpId> --sourceDocumentSN <sourceDocumentSN>
|
||
\`\`\`
|
||
|
||
Refresh and inspect the Langfuse trace.
|
||
|
||
\`\`\`bash
|
||
langfuse-home call langfuse_trace_cache_refresh --json '{"traceId":"<traceId>"}'
|
||
langfuse-home call langfuse_trace_url_get --json '{"traceId":"<traceId>"}'
|
||
langfuse-home call langfuse_trace_outline_get --json '{"traceId":"<traceId>","includeInput":true,"includeOutput":true,"maxPreviewChars":800}'
|
||
\`\`\`
|
||
|
||
If \`langfuse_trace_qrep_search\` does not find Chinese terms reliably, grep the cached JSON directly.
|
||
|
||
\`\`\`bash
|
||
rg -n "发票未上传至发票栏位|附件中存在定额发票|检查该附件(定额发票)|<file-name-or-fileId>" \\
|
||
.cache/langfuse/traces/default/<traceId>.json
|
||
\`\`\`
|
||
|
||
Read focused IO for the relevant observations.
|
||
|
||
\`\`\`bash
|
||
langfuse-home call langfuse_observation_io_get --json '{"traceId":"<traceId>","observationId":"<observationId>","maxChars":30000}'
|
||
\`\`\`
|
||
|
||
## Separate Object IDs Before Judging
|
||
|
||
Never assume same-looking file names are the same object.
|
||
|
||
In Seal run detail, invoice-list entries and raw attachment entries can be separate objects:
|
||
|
||
- \`invoiceForm\` / \`发票列表\` entries often have source invoice IDs, invoice numbers, OCR-derived file names, \`verifyResult\`, \`fileInfo.fileType=invoice\`, and invoice metadata.
|
||
- \`attachments\` / \`附件\` entries often have UI file IDs such as \`file-7\`, Hose file IDs inside \`token\`, \`category=file\`, \`mimeType=image/jpeg\`, and their own OSS path.
|
||
|
||
Use \`jq\` to list them side by side.
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="invoiceForm") | .value[] |
|
||
["invoiceForm", .sourceInvoiceId, .invoice.invoiceNumber, .invoice.fileInfo.fileName, .invoice.fileInfo.fileType, .invoice.fileInfo.ossPath, (.invoice.verifyResult.rawData | fromjson? | .form.sourceEntityId // "")] | @tsv
|
||
' /tmp/seal-run.json
|
||
\`\`\`
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="attachments") | .value[] |
|
||
["attachments", .fileId, .name, .category, .mimeType, .ossPath, .token] | @tsv
|
||
' /tmp/seal-run.json
|
||
\`\`\`
|
||
|
||
When explaining the result, say precisely whether the disputed item is:
|
||
|
||
- a structured invoice-list object,
|
||
- a raw attachment object,
|
||
- or two distinct objects with similar file names/content.
|
||
|
||
## Find Where A Bad Label First Appeared
|
||
|
||
Search for the UI finding text and the disputed label.
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
def walkobs(o): o, ((o.children // [])[] | walkobs(.));
|
||
.trace.observations[] | walkobs(.)
|
||
| select(((.input|tostring)+"\\n"+(.output|tostring))
|
||
| contains("发票未上传至发票栏位")
|
||
or contains("附件中存在定额发票")
|
||
or contains("检查该附件(定额发票)"))
|
||
| [.id,.name,.type,.startTime,((.output|tostring)|gsub("\\n";" ")|.[0:500])] | @tsv
|
||
' .cache/langfuse/traces/default/<traceId>.json
|
||
\`\`\`
|
||
|
||
Then inspect the earliest matching observation. Typical interpretation:
|
||
|
||
- \`image_understanding:ai.streamText\`: the vision stage first assigned the type label.
|
||
- \`pre_analysis:ai.streamText\`: the instruction-generation stage turned matched rules and parsed attachments into per-file \`reviewPoints\`; this is where attachment-side values or labels can be copied into prompts.
|
||
- \`document_parsing:ai.streamText\`: the attachment review inherited the label in its review point or document content.
|
||
- \`approval_review:ai.streamText\`: the final model converted inherited labels into a rule finding.
|
||
|
||
## Check Pre-Analysis For Amount-Total Disputes
|
||
|
||
When the customer says the AI "did not recognize the correct amount", "missed one payment screenshot", or "the total should be X", start with the normal trace: source document, image understanding, attachment review, and final review. Inspect \`pre_analysis\` when the evidence suggests the disputed amount was recognized earlier but later ignored, or when final review is aggregating inconsistent per-attachment conclusions. Treat this as a possible failure mode, not as the default cause.
|
||
|
||
Find the node:
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
def walkobs(x; depth): (x + {depth: depth}), ((x.children? // [])[] | walkobs(.; depth+1));
|
||
.trace.observations[] | walkobs(.; 0)
|
||
| select(.name? | test("pre_analysis"))
|
||
| [.startTime,.id,.name,.type,.parentObservationId,((.input|tostring|length)//0),((.output|tostring|length)//0)] | @tsv
|
||
' .cache/langfuse/traces/default/<traceId>.json
|
||
\`\`\`
|
||
|
||
Then inspect its output for the disputed file and rule:
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
def walkobs(x): x, ((x.children? // [])[] | walkobs(.));
|
||
.trace.observations[] | walkobs(.)
|
||
| select(.name? == "pre_analysis:ai.streamText")
|
||
| .output
|
||
' .cache/langfuse/traces/default/<traceId>.json | rg -n "fileId|fileName|<file-name>|付款截图金额|收款金额|金额合计"
|
||
\`\`\`
|
||
|
||
Look for these failure patterns:
|
||
|
||
- A global aggregate requirement was split into per-attachment review points, for example each attachment is asked whether its amount plus "other attachments" reaches the reimbursement amount.
|
||
- The pre-analysis prompt says not to write attachment OCR/image-understanding candidate values into review points, but the output still includes values such as "付款截图金额(1850.00元)" or labels such as "收款凭证".
|
||
- The same physical image appears twice because it exists under both form-level attachments and fee-detail attachments, producing duplicate \`fileId\`s and potentially inconsistent later judgments.
|
||
- \`pre_analysis\` passes a value down, but \`document_parsing\` reclassifies the file and ignores that value, for example a review point says "付款截图金额(1850.00元)" while the parser answer says "收款凭证,非付款截图".
|
||
|
||
For these cases, the amount may not be lost in OCR or image understanding. It may be lost when a later attachment-review node overrides the pre-analysis task premise, or when final approval review aggregates inconsistent per-file conclusions. For concrete examples, see \`approval-bad-cases.md\`.
|
||
|
||
## Check Images When The Dispute Is Visual
|
||
|
||
If the issue depends on whether an image is a receipt or invoice, inspect the raw image. Do not rely only on the model's textual description.
|
||
|
||
Extract raw attachment signed URLs from \`/tmp/seal-run.json\` and download the disputed files.
|
||
|
||
\`\`\`bash
|
||
jq -r '
|
||
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="attachments") | .value[] |
|
||
select(.fileId=="file-7" or .fileId=="file-9") |
|
||
[.fileId,.name,.ossSignedUrl] | @tsv
|
||
' /tmp/seal-run.json
|
||
\`\`\`
|
||
|
||
Look for invoice-specific elements:
|
||
|
||
- "发票" text in the title
|
||
- invoice code / invoice number
|
||
- tax bureau supervision seal
|
||
- tax invoice QR/code metadata
|
||
- buyer/seller tax information
|
||
- taxable amount / tax rate / tax amount fields
|
||
|
||
If those are absent and the document is a store-stamped handwritten slip, it is safer to call it a receipt or sales voucher, not a formal invoice.
|
||
|
||
## Reporting Pattern
|
||
|
||
When answering the user, separate:
|
||
|
||
- What the final UI finding says.
|
||
- The first pipeline stage where the disputed claim appeared.
|
||
- Whether the disputed file is a raw attachment or a structured invoice-list object.
|
||
- Whether the raw image supports the claim.
|
||
- Whether the final decision still stands for other independent reasons.
|
||
|
||
Example wording:
|
||
|
||
\`\`\`text
|
||
The UI finding was produced in final approval review, but the imprecise label started earlier:
|
||
image_understanding labeled file-9 as "定额发票"; document_parsing then inherited that as "该附件(定额发票)"; approval_review converted it into the rule-3 finding.
|
||
|
||
The raw attachment object itself is not structurally marked as invoice; it is category=file, mimeType=image/jpeg. The image lacks formal invoice elements, so the customer's receipt interpretation is reasonable.
|
||
\`\`\`
|
||
|
||
## Case Note: Receipt-Like Attachments Labeled As Invoices
|
||
|
||
This case involved a UI finding:
|
||
|
||
\`\`\`text
|
||
发票未上传至发票栏位:附件中存在定额发票(金额160元、90元),但未上传至发票栏位。
|
||
\`\`\`
|
||
|
||
Important correction:
|
||
|
||
- \`file-7\` and \`file-9\` were raw attachment objects, not the same objects as the invoice-list entries.
|
||
- The invoice list had separate IDs (\`ID01P95oy1RWbB\`, \`ID01P95oy22hnV\`).
|
||
- The raw attachments had separate file IDs (\`file-7\` / Hose \`ID01P95CwuNGLJ\`, and \`file-9\` / Hose \`ID01P95RUC9T79\`).
|
||
|
||
Root of imprecision:
|
||
|
||
- \`file-7\` was first described by \`image_understanding\` as "发票(或收据)", then later attachment review used "定额发票".
|
||
- \`file-9\` was directly described by \`image_understanding\` as "定额发票".
|
||
- Final \`approval_review\` turned those inherited labels into the rule-3 UI warning.
|
||
|
||
Manual image check:
|
||
|
||
- The 160 and 90 slips looked like store-stamped handwritten receipts/sales vouchers.
|
||
- They lacked obvious formal invoice elements.
|
||
- The customer's objection that they were receipts rather than invoices was reasonable.
|
||
|
||
However, the final rejection also had an independent rule-37 reason: payment screenshots totaled 699.48 while reimbursement was 700.00.
|
||
`;var FN=`# Customer Feedback Rule Remediation
|
||
|
||
Use this low-freedom workflow when the user provides packaged customer feedback from WeChat, screenshots, rejection notifications, a document number, or expected business behavior and wants diagnosis or an approval-rule change.
|
||
|
||
## Workflow states
|
||
|
||
Follow these states in order:
|
||
|
||
1. \`EVIDENCE_RECEIVED\`
|
||
2. \`TENANT_RESOLVED\`
|
||
3. \`RUN_RESOLVED\`
|
||
4. \`CAUSE_CLASSIFIED\`
|
||
5. \`PATCH_PROPOSED\`
|
||
6. \`PATCH_CONFIRMED\`
|
||
7. \`DRAFT_UPDATED\`
|
||
8. \`VERSION_PUBLISHED\`
|
||
9. \`VERSION_VERIFIED\`
|
||
|
||
Stop at \`PATCH_PROPOSED\` unless the user explicitly approves the exact change and publication. A request to analyze, explain, or propose does not authorize a rule update or publish.
|
||
|
||
## 1. Normalize the evidence package
|
||
|
||
Extract only facts supported by the supplied package:
|
||
|
||
- Customer or enterprise hints
|
||
- Source document number
|
||
- Submitter and document template when visible
|
||
- AI rejection or disputed finding
|
||
- Customer-stated business behavior
|
||
- Screenshots, invoices, or attachments relevant to the dispute
|
||
- Requested action: analysis, proposal, update, or publish
|
||
|
||
Treat chat text as the customer's expected behavior, not proof of the current Seal rule or tenant identity.
|
||
|
||
## 2. Resolve and lock the enterprise
|
||
|
||
List configured enterprises first:
|
||
|
||
\`\`\`bash
|
||
seal-home corps list
|
||
\`\`\`
|
||
|
||
If the enterprise is named, resolve its exact \`corpId\`. If the enterprise is unclear but a source document number exists, run compact \`approval-runs pick\` queries across configured tenants and select the tenant that actually contains the document.
|
||
|
||
After resolution, pass the exact \`--corp <corpId>\` to every command. Do not rely on the current/default tenant.
|
||
|
||
Report the enterprise name, \`corpId\`, and how it was resolved.
|
||
|
||
## 3. Resolve the approval run
|
||
|
||
Start compactly:
|
||
|
||
\`\`\`bash
|
||
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest
|
||
seal-home approval-runs get <recordId> --summary --corp <corpId>
|
||
seal-home approval-runs document-summary <recordId> --corp <corpId>
|
||
seal-home approval-runs result <recordId> --summary --corp <corpId>
|
||
seal-home approval-runs cited-rules <recordId> --corp <corpId>
|
||
\`\`\`
|
||
|
||
Read attachment summaries only when the dispute depends on invoices, receipts, OCR, file type, or upload position. Use the run's historical \`ruleSetVersionNumber\`; do not explain a historical decision from the current draft alone.
|
||
|
||
## 4. Classify the cause
|
||
|
||
Classify the issue before proposing a change:
|
||
|
||
- \`SOURCE_DATA\`: source fields are wrong or incomplete.
|
||
- \`ATTACHMENT_UNDERSTANDING\`: OCR, vision, or attachment classification introduced the disputed fact.
|
||
- \`RULE_DEFINITION\`: the rule is missing, ambiguous, contradictory, or too broad.
|
||
- \`MODEL_INTERPRETATION\`: the supplied rule covers the case, but the model invented or misapplied a requirement.
|
||
- \`SYSTEM_LOGIC\`: deterministic preprocessing, grouping, or aggregation produced the wrong review unit or values.
|
||
|
||
When the editable boundary is rules only, say whether a rule-only mitigation can block the observed false positive and state any residual system limitation.
|
||
|
||
## 5. Trace only when needed
|
||
|
||
Use the Langfuse workflow from \`approval-attachment-trace.md\` when:
|
||
|
||
- The final decision contradicts the supplied rule.
|
||
- Cited rules are missing or incomplete.
|
||
- A disputed requirement may have entered during pre-analysis.
|
||
- The finding depends on attachment understanding.
|
||
|
||
Identify the final UI finding, the earliest stage where the disputed claim appeared, the exact rule supplied to final review, and whether final review followed or contradicted it.
|
||
|
||
## 6. Design the minimal rule patch
|
||
|
||
Fetch and compare:
|
||
|
||
- The historical rule version used by the disputed run.
|
||
- The latest published version.
|
||
- The current draft rule, including its stable rule ID.
|
||
|
||
Apply these defaults:
|
||
|
||
1. Preserve \`scope\`.
|
||
2. Preserve \`strictness\`.
|
||
3. Preserve every unrelated description clause.
|
||
4. Change only the narrowest sentence needed to block the reproduced false positive.
|
||
5. Put an exception or negative constraint next to the clause that was misinterpreted.
|
||
6. If the rule already states a positive allowance but the model still rejects it, add a narrow \`不得因……驳回或建议复核\` constraint covering the actual failure mode.
|
||
7. Do not add new business requirements, broad examples, or unrelated exceptions without explicit user direction.
|
||
|
||
Show a description-only unified diff by default:
|
||
|
||
\`\`\`diff
|
||
unchanged text
|
||
+minimal added or changed sentence
|
||
unchanged text
|
||
\`\`\`
|
||
|
||
State the target enterprise, target rule ID, changed fields, preserved fields, expected behavior, and residual limitation.
|
||
|
||
## 7. Mutation gate and concurrency check
|
||
|
||
Do not update until the user explicitly approves the exact diff.
|
||
|
||
Immediately before updating:
|
||
|
||
1. Fetch the current draft rule again.
|
||
2. Confirm its rule ID, description, scope, strictness, and status.
|
||
3. Compare the current description with the reviewed \`before\` text.
|
||
4. Stop if the rule changed concurrently or more than one rule matches the target.
|
||
|
||
## 8. Update and verify the draft
|
||
|
||
Send only approved fields. For a description-only change:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rule_update --corp <corpId> \\
|
||
--json '{"ruleId":"<ruleId>","description":"<confirmed description>"}'
|
||
\`\`\`
|
||
|
||
Do not send \`scope\` or \`strictness\` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
|
||
|
||
## 9. Publish and verify
|
||
|
||
Publish only when explicitly authorized:
|
||
|
||
\`\`\`bash
|
||
seal-home tool seal_approval_rule_version_publish --corp <corpId> \\
|
||
--json '{"versionName":"<specific business change>"}'
|
||
\`\`\`
|
||
|
||
Verify after publishing:
|
||
|
||
- The new version is latest.
|
||
- Version number and version name are correct.
|
||
- Rule count is unchanged unless intentionally modified.
|
||
- The target rule contains the exact confirmed description.
|
||
- The target rule's \`scope\` and \`strictness\` are unchanged.
|
||
|
||
Do not automatically rerun or resubmit the customer's production document. Run a simulation or regression only when separately requested and authorized.
|
||
|
||
## Final response contract
|
||
|
||
Return a compact report containing:
|
||
|
||
- Enterprise and source document number
|
||
- Root-cause classification
|
||
- Target rule and exact changed text
|
||
- New version number and version name, if published
|
||
- Verification result
|
||
- Whether a regression rerun was performed
|
||
`;var KN=`# Enterprise Onboarding
|
||
|
||
Read this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.
|
||
|
||
## Start With Discovery
|
||
|
||
Run this before asking for setup parameters:
|
||
|
||
\`\`\`bash
|
||
seal-home version
|
||
seal-home corps list
|
||
\`\`\`
|
||
|
||
- If the target enterprise is listed, match the user's human enterprise name to its returned \`id\` and use that value as \`--corp\` on every command. Do not ask the user for \`corpId\`.
|
||
- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.
|
||
- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”
|
||
|
||
Do not open with a JSON template or a list of internal fields.
|
||
|
||
All command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.
|
||
|
||
## Keep Two Concepts Separate
|
||
|
||
Classify both the enterprise identity origin and how the current credential was acquired:
|
||
|
||
| Enterprise identity origin | Credential material the user may have | Meaning |
|
||
| --- | --- | --- |
|
||
| Hose/合思-sourced Seal tenant | Hose \`appKey\` + \`appSecurity\` | Stable, refreshable standard integration |
|
||
| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |
|
||
| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |
|
||
| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |
|
||
| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |
|
||
|
||
Credential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When \`whoami\` returns provider metadata, preserve it and use it to describe the tenant accurately.
|
||
|
||
## Parameter Ownership
|
||
|
||
Ask the user only for information that cannot be discovered safely:
|
||
|
||
| Field | Owner and behavior |
|
||
| --- | --- |
|
||
| \`appKey\`, \`appSecurity\` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |
|
||
| \`domain\` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |
|
||
| Enterprise name and \`corpId\` | Discover from the credential response or Seal \`whoami\`. Do not ask the user to invent or locate them first. |
|
||
| Administrator and \`staffId\` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |
|
||
| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal \`whoami\`. |
|
||
| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |
|
||
|
||
## Route 1: Standard Hose Credentials
|
||
|
||
This is the preferred durable route for a Hose-sourced tenant. Read \`hose-enterprise-init.md\`, then use:
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{"appKey":"...","appSecurity":"..."}'
|
||
\`\`\`
|
||
|
||
The CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with \`staffName\`, \`staffPhone\`, or the selected \`staffId\` internally. After creation, run:
|
||
|
||
\`\`\`bash
|
||
seal-home auth diagnose --corp <discovered-id>
|
||
\`\`\`
|
||
|
||
Do not ask for \`domain\`, \`corpId\`, or \`proxyStaffBizId\` up front. For a dedicated/private Hose deployment, add \`domain\` only after standard probing reports that it cannot find the enterprise.
|
||
|
||
## Route 2: Incoming Assistance Link
|
||
|
||
First distinguish the link by its host and purpose:
|
||
|
||
- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.
|
||
- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.
|
||
- \`seal-home auth hose-link\` and \`seal-home delegation create\` generate links for an enterprise that is already configured. \`seal-home corps add-link <url>\` imports a received Hose/合思 \`thirdparty.html\` assistance link and verifies the resulting Seal tenant.
|
||
|
||
Use the direct import route when the incoming link is an HTTPS \`thirdparty.html\` URL from a supported \`ekuaibao.com\` or \`hosecloud.com\` domain:
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-link "https://wx2.ekuaibao.com/web/thirdparty.html?accessToken=<temporary-token>&ekbCorpId=<corpId>&pageType=home" [--name "企业名称"]
|
||
\`\`\`
|
||
|
||
The command parses \`accessToken\` and \`ekbCorpId\`, exchanges the temporary Hose token at the target Seal tenant, verifies \`/api/v1/auth/me\`, and stores only the normalized short-lived Seal session. It never prints or persists the original URL. Use \`--overwrite\` only when intentionally replacing an existing enterprise config. To create a Seal delegation link without persisting the session, use \`seal-home delegation create --from-link <url> [--note ...]\`.
|
||
|
||
Assistance links are credentials. Do not follow a link merely to inspect it when the user's request was only explanatory, and never publish, log, or commit it.
|
||
|
||
## Route 3: Browser F12 cURL
|
||
|
||
When the user needs capture instructions, give these concrete steps:
|
||
|
||
1. Open the already signed-in Hose or Seal page.
|
||
2. Open browser developer tools: \`F12\` on many keyboards, or \`Option+Command+I\` on macOS.
|
||
3. Open **Network**, then select **Fetch/XHR**.
|
||
4. Refresh the page or perform one ordinary read-only business action.
|
||
5. Choose a successful business API request from the relevant tenant, not analytics, static assets, upload, delete, publish, or logout requests.
|
||
6. Right-click it and choose **Copy → Copy as cURL**.
|
||
7. Send that complete cURL only to the local trusted Agent handling setup.
|
||
|
||
When receiving cURL:
|
||
|
||
1. Treat the entire cURL as a secret. Do not echo it, execute it blindly, paste it into another service, or store it in repository files.
|
||
2. Parse it as data. Extract the request host, path, \`Authorization\` header, cookies, and provider/tenant hints. Ignore the request body unless it is required to identify the tenant.
|
||
3. Classify whether the captured request is to Hose or Seal. A Seal request with \`Authorization: Bearer ...\` can supply \`sealUrl\` and a session token even when the user's identity origin is Hose.
|
||
4. Verify with the narrowest read-only identity endpoint available. For a Seal Bearer session, verify \`/api/v1/auth/me\` through \`seal-home corps add-seal\`; use returned provider metadata to retain the actual origin.
|
||
5. Persist only the normalized minimum configuration needed by seal-home. Do not preserve the raw cURL, unrelated headers, request body, cookies, or signed URL.
|
||
|
||
For a verified Seal Bearer captured from cURL, the existing CLI route is:
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-seal --json '{"sealUrl":"https://target-tenant.example","token":"<bearer>"}'
|
||
\`\`\`
|
||
|
||
The current CLI has no raw-cURL import command and \`add-seal\` requires a Bearer token. If the captured request contains only cookies or an authentication shape the CLI cannot verify, do not improvise a token. Ask the user to copy another successful Seal Fetch/XHR request that contains the Bearer header, or explain the current limitation.
|
||
|
||
## Verify and Hand Off
|
||
|
||
After adding an enterprise:
|
||
|
||
\`\`\`bash
|
||
seal-home corps list
|
||
seal-home corps current --corp <discovered-id>
|
||
seal-home auth diagnose --corp <discovered-id> # Hose source
|
||
\`\`\`
|
||
|
||
Report the human enterprise name, identity provider, credential method, and whether verification succeeded. Do not expose internal IDs unless they help with troubleshooting. Do not perform approval, rule, document, simulation, publishing, or other business mutations just because onboarding succeeded; continue only with the user's requested task and its normal confirmation rules.
|
||
|
||
If a temporary assistance-link or browser session expires, explain that it must be renewed or recaptured. Recommend standard Hose app credentials when the user needs durable unattended access.
|
||
`;var BN=`# Hose Enterprise Auth
|
||
|
||
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
|
||
|
||
## Add or switch an enterprise
|
||
|
||
Use the CLI for normal enterprise setup. Do not inspect source code or hand-edit \`~/.config/seal-home/enterprises/*.json\` unless the CLI fails or the user explicitly asks for low-level config debugging.
|
||
|
||
For first-time setup or when the user has an assistance link or browser cURL instead of standard application credentials, read \`enterprise-onboarding.md\` first. This reference's \`add-hose\` route is specifically for durable Hose OpenAPI credentials.
|
||
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{"appKey":"...","appSecurity":"..."}'
|
||
seal-home corps list
|
||
seal-home corps current --corp <corpId>
|
||
seal-home corps switch <corpId>
|
||
\`\`\`
|
||
|
||
\`corps add-hose\` probes standard domains and discovers the enterprise automatically. If it returns multiple administrator candidates, present their names and masked phones for the user to choose, then retry with \`staffName\`, \`staffPhone\`, or the selected \`staffId\`. Do not ask for \`domain\`, \`corpId\`, \`staffId\`, or \`proxyStaffBizId\` before discovery. Ask for a dedicated/private-cloud \`domain\` only after standard probing fails.
|
||
|
||
The command verifies by default and writes the enterprise config. If the user says not to operate business logic, stop at \`corps\` and auth/config commands; do not run approval, rule, document, simulation, or approval-run commands.
|
||
|
||
## Diagnose authentication
|
||
|
||
\`\`\`bash
|
||
seal-home auth diagnose --corp <corpId>
|
||
\`\`\`
|
||
|
||
Read the JSON \`stages\` in order:
|
||
|
||
- \`hose.openapi\`: appKey/appSecurity can get a Hose OpenAPI token and corporation ID.
|
||
- \`hose.provisional\`: \`proxyStaffBizId\`/staff ID can get a provisional auth URL.
|
||
- \`seal.sso\`: Seal accepts the Hose provisional token and returns a bearer session.
|
||
- \`seal.whoami\`: the Seal bearer can read current user and tenant.
|
||
|
||
Do not expect tokens in the output; the command intentionally redacts or omits them.
|
||
|
||
## Get a Hose authorization link
|
||
|
||
When the user asks for a 合思/易快报授权链接、登录链接、入口链接, or says "来一个授权链接" for a Hose sourced enterprise, return the Hose provisional/CloseAPI URL from \`getProvisionalAuth\`'s \`value.message\`.
|
||
|
||
Flow:
|
||
|
||
1. Obtain an OpenAPI token with appKey/appSecurity:
|
||
|
||
\`\`\`text
|
||
POST /api/openapi/v1/auth/getAccessToken
|
||
body: {"appKey":"...","appSecurity":"..."}
|
||
\`\`\`
|
||
|
||
2. Call provisional auth:
|
||
|
||
\`\`\`text
|
||
POST /api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=<openapi-token>
|
||
body: {"uid":"corpId:staffId","pageType":"home","expireDate":7200}
|
||
\`\`\`
|
||
|
||
3. Return the exact \`value.message\` URL.
|
||
|
||
Important:
|
||
|
||
- Do not return the Seal tenant URL such as \`https://<tenant>.sealai.cc\`; that is not the Hose authorization link.
|
||
- Do not manually assemble \`thirdparty.html\` with a global/OpenAPI token.
|
||
- \`seal-home auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
|
||
- **Formatting Requirement**: When returning a Hose authorization link to the user, ALWAYS provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
|
||
- If the CLI later provides a dedicated command for this, prefer that command.
|
||
`;var VN=`# Hose Enterprise Initialization & Automated Discovery
|
||
|
||
Use this reference for automated Hose/合思 enterprise onboarding, multi-domain probing (including dedicated private cloud domains like 美年大健康), OpenAPI role and staff discovery, and non-TUI safe administrator selection.
|
||
|
||
---
|
||
|
||
## 1. Domain Tiering & Probing Strategy
|
||
|
||
合思在不同公有云和专有云平台部署了不同的服务端域名。系统采用 **三级域名决策模型**:
|
||
|
||
\`\`\`mermaid
|
||
flowchart TD
|
||
A["输入参数: appKey, appSecurity, [domain]"] --> B{"是否显式提供了 domain?<br/>(如美年大健康等专有云/独立部署域名)"}
|
||
B -->|是 (专属域名优先)| C["直接针对该 domain 验证"]
|
||
B -->|否 (未指定)| D["并发探测 6 大标准公共 SaaS 域名"]
|
||
D --> E{"是否有且仅有 1 个域名验证成功?"}
|
||
E -->|是| F["自动锁定该域名为目标 domain"]
|
||
E -->|否 (全部返回 403 / 失败)| G["❌ 友好降级提示:<br/>'在标准合思 SaaS 环境中未检测到有效凭证。<br/>若是专属域名或私有化部署环境(如美年大健康),请显式提供企业专属 domain。'"]
|
||
\`\`\`
|
||
|
||
### 预置 6 大标准公共 SaaS 域名池(仅作缺省探测使用):
|
||
1. \`https://app.ekuaibao.com\` (合思独立版 / 标准版)
|
||
2. \`https://dd2.hosecloud.com\` (钉钉版)
|
||
3. \`https://wx2.ekuaibao.com\` (企业微信版)
|
||
4. \`https://kdcloud2.ekuaibao.com\` (云之家版)
|
||
5. \`https://ddenterprise.ekuaibao.com\` (钉钉企业自建应用)
|
||
6. \`https://feishu.ekuaibao.com\` (飞书版)
|
||
|
||
---
|
||
|
||
## 2. 核心 OpenAPI 接口契约
|
||
|
||
| 阶段 | 接口用途 | Method & URL 规范 | 关键参数 | 注意事项 |
|
||
| :---: | :--- | :--- | :--- | :--- |
|
||
| **1** | 获取开放凭证 | \`POST {domain}/api/openapi/v1/auth/getAccessToken\` | \`appKey\`, \`appSecurity\` | 确定有效 \`domain\`、\`corpId\` 与 \`accessToken\` |
|
||
| **2** | 查询角色组与角色 | \`GET {domain}/api/openapi/v1/roleDefGroups?accessToken=...\` | \`accessToken\` | 获取企业全部角色分组及 RoleDefId |
|
||
| **3** | 查询角色成员 ID 列表 | \`GET {domain}/api/openapi/v1/roledefs/\${roledefId}?accessToken=...&staffBy=id\` | \`accessToken\`, \`roledefId\` | **URL 中必须带有字面量 \`$\` 字符**(如 \`/roledefs/$ID01...:admin\`) |
|
||
| **4** | 批量查询人员详情 | \`POST {domain}/api/openapi/v1/staffs/getStaffIds?accessToken=...\` | \`{"type": "STAFFID", "conditionIds": [...]}\` | 批量单次上限 100,返回姓名、手机号、是否激活(\`authState\`)、第三方 ID |
|
||
| **5** | 生成临时免密凭据 | \`POST {domain}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=...\` | \`{"uid": "{corpId}:{staffId}", "pageType": "home", "expireDate": 7200}\` | 用于 Seal SSO 换取 Session 会话 |
|
||
|
||
---
|
||
|
||
## 3. CLI 探测与人员发现命令
|
||
|
||
### 1) 企业探测与角色发现 (\`corps probe-hose\`)
|
||
\`\`\`bash
|
||
seal-home corps probe-hose --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "...",
|
||
"domain": "https://custom.ekuaibao.com" # 可选,未传时自动探测 6 域名
|
||
}'
|
||
\`\`\`
|
||
* **输出**:自动探测匹配的 \`domain\`、企业 ID \`corpId\`、企业名称 \`name\`、角色总数以及完整的角色分组列表。
|
||
|
||
### 2) 按角色查询候选员工 (\`corps hose-staffs\`)
|
||
\`\`\`bash
|
||
# 默认查询主管理员角色 (admin)
|
||
seal-home corps hose-staffs --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "...",
|
||
"role": "admin"
|
||
}'
|
||
|
||
# 查询指定业务角色 (如 "财务主管"、"采购申请权限" 或具体 roleDefId)
|
||
seal-home corps hose-staffs --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "...",
|
||
"role": "财务主管"
|
||
}'
|
||
\`\`\`
|
||
* **输出**:返回匹配角色下所有人员的详情列表,包含 \`id\` (\`corpId:staffId\`)、\`name\`、\`cellphone\`、\`active\`(是否在职)、\`authState\`(是否激活)。
|
||
|
||
---
|
||
|
||
## 4. 安全选人与防静默绑定规范 (Anti-Silent Guard)
|
||
|
||
为了防止越权及未授权账号绑定,系统实施**严格的人员选定与安全确认机制**:
|
||
|
||
1. **若用户在初始指令中已指名(姓名或手机号)**:
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "...",
|
||
"staffName": "于光泽"
|
||
}'
|
||
\`\`\`
|
||
* 系统通过角色人员列表匹配:若**唯一匹配且 \`active == true\`**,直接绑定该 \`staffId\` 完成接入。
|
||
2. **若用户未指定且存在多位候选管理员**:
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "..."
|
||
}'
|
||
\`\`\`
|
||
* 系统**严禁静默默认挑选第一个管理员**;
|
||
* 命令会以错误形式退出,并列出所有候选管理员详情(姓名、手机号、ID、激活状态);
|
||
* Agent 应将候选人列表以结构化形式呈现给用户确认,待用户选定后,传入 \`staffId\` 或 \`staffName\` 再次执行。
|
||
3. **若已知目标人员 ID**:
|
||
\`\`\`bash
|
||
seal-home corps add-hose --json '{
|
||
"appKey": "...",
|
||
"appSecurity": "...",
|
||
"staffId": "ID01OZVhtzekb5:ID01K9vHULqNj1"
|
||
}'
|
||
\`\`\`
|
||
* 直接使用指定 ID 完成接入并进行连通性验证。
|
||
`;var _N={"SKILL.md":HN,"agents/openai.yaml":XN,"references/rule-lightweight.md":hN,"references/approval-bad-cases.md":PN,"references/cli.md":YN,"references/approval-run-lightweight.md":pN,"references/approval-attachment-trace.md":QN,"references/customer-feedback-rule-remediation.md":FN,"references/enterprise-onboarding.md":KN,"references/hose-enterprise-auth.md":BN,"references/hose-enterprise-init.md":VN};function EN(){return _N["SKILL.md"]||""}function _e(){return qN(UF(),".agents","skills","seal-home")}function B4(n=_e()){TN(n,{recursive:!0});let i=[];for(let[r,o]of Object.entries(_N)){let t=qN(n,r);TN(DF(t),{recursive:!0}),cF(t,o,"utf8"),i.push(r)}return{targetDir:n,files:i}}function ZN(){let n=_e();return B4(n),{synced:!0,targetDir:n}}function MN(n,i,r){if(n==="dump"||n==="cat"||n==="show"){process.stdout.write(`${EN()}
|
||
`);return}if(n==="install"||n==="init"||n==="sync"){let o=_(r.options.local)||_(r.options.workspace),t=D(r.options.dir)??D(r.options.target)??i,e=t?t:o?l$(process.cwd(),".agents","skills","seal-home"):_e(),u=B4(e);K({installed:!0,targetDir:u.targetDir,fileCount:u.files.length,files:u.files});return}if(n==="status"||n==="get"||!n){let o=_e(),t=l$(process.cwd(),".agents","skills","seal-home");K({global:{dir:o,installed:mN(l$(o,"SKILL.md"))},local:{dir:t,installed:mN(l$(t,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${n}. Run 'seal-home help' for available commands.`)}async function zN(n,i){if(n==="config"){K(await ar(i));return}throw Error(`Unknown source command: ${n??""}. Run 'seal-home help' for available commands.`)}async function CN(n,i,r,o){if(!n)throw Error("Usage: seal-home tool <toolName> [--json '{...}']");await H(n,i,r,ri(o.json),J(o.options))}function RN(){K(St.map((n)=>({name:n.name,description:n.description})))}import{chmodSync as SF,mkdirSync as AF,renameSync as V4,rmSync as OF,unlinkSync as iy,writeFileSync as xN}from"node:fs";import{dirname as kF,join as aN}from"node:path";import{spawnSync as Zt}from"node:child_process";function v$(n=process.execPath,i=import.meta.url){if(i.includes("/$bunfs/")||i.includes("\\$bunfs\\"))return!0;let r=n.toLowerCase().replace(/\\/g,"/");return!r.endsWith("/bun")&&!r.endsWith("/bun.exe")}var ty="yunyingk/seal-home";var dF="SEAL_HOME_GITHUB_REPO";async function ry(n,i={}){let r={appRoot:n.appRoot,entryFile:n.entryFile,stateDir:K4,version:R,launcher:n.launcher},o=i.repo||process.env[dF]?.trim()||ty,t=i.targetVersion?.trim(),e=t&&t.toLowerCase()!=="latest"?t:void 0;if(e){let j=e.replace(/^v/,""),L=oy(j,R);if(L<0){K({updated:!1,currentVersion:R,targetVersion:j,mode:v$()?"binary":"source",message:`Cannot downgrade seal-home from v${R} to older version v${j}. Updates must be forward-only.`});return}if(L===0&&!i.force){K({updated:!1,currentVersion:R,targetVersion:j,mode:v$()?"binary":"source",message:`seal-home is already at version v${R}. Use --force to reinstall.`});return}}if(i.changelogOnly){let j=await T4(o,i.limit??10);K({currentVersion:R,totalQueried:j.length,releases:j.map((L)=>({version:L.version,tagName:L.tagName,publishedAt:L.publishedAt,author:L.author,releaseNotes:L.notes,releaseUrl:L.htmlUrl,isCurrent:L.version===R,isNewer:Ee(L.version,R)}))});return}if(!v$()){if(i.checkOnly){let L=await T4(o,30),q=L[0],x=q?.version??R,yn=L.find((en)=>en.version===R),Wn=Ee(x,R),On=L.filter((en)=>Ee(en.version,R));K({updated:!1,updateAvailable:Wn,currentVersion:R,currentVersionPublishedAt:yn?.publishedAt,latestVersion:x,latestVersionPublishedAt:q?.publishedAt,behindCount:On.length,pendingReleases:On.map((en)=>({version:en.version,tagName:en.tagName,publishedAt:en.publishedAt,author:en.author,releaseNotes:en.notes,releaseUrl:en.htmlUrl})),releaseNotes:q?.notes??"",releaseUrl:q?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-home update' to git pull & bun install."});return}let j=sr(r).running;if(j)await Et("stop",r);try{ny("git",["-C",n.appRoot,"pull","--ff-only"])}catch(L){console.error(`git pull skipped: ${L instanceof Error?L.message:String(L)}`)}if(ny("bun",["install"],{cwd:n.appRoot}),j)await Et("start",r);K({updated:!0,serviceRestarted:j,version:R,mode:"source"});return}let u=LF(),l=NF(),$=await T4(o,30),I=e?$.find((j)=>j.version===e||j.tagName===e||j.tagName===`v${e}`)??await sN(o,e):$[0]??await sN(o);if(!I){K({updated:!1,currentVersion:R,mode:"binary",message:`Failed to query releases from GitHub repository '${o}'`});return}let g=I.version,b=$.find((j)=>j.version===R),w=Ee(g,R),f=w||Boolean(i.force),c=$.filter((j)=>Ee(j.version,R));if(i.checkOnly){K({updated:!1,updateAvailable:w,currentVersion:R,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,behindCount:c.length,pendingReleases:c.map((j)=>({version:j.version,tagName:j.tagName,publishedAt:j.publishedAt,author:j.author,releaseNotes:j.notes,releaseUrl:j.htmlUrl})),releaseNotes:I.notes,releaseUrl:I.htmlUrl,mode:"binary"});return}if(!f){K({updated:!1,currentVersion:R,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,mode:"binary",message:`seal-home is already up to date (v${R})`});return}let S=yF(I.assets,u,l);if(!S)throw Error(`No compatible binary found for ${u}-${l} in release v${g}. Available assets: ${I.assets.map((j)=>j.name).join(", ")}`);let k=sr(r).running;if(k)await Et("stop",r);let d=process.execPath,p=kF(d),h=aN(p,`.tmp-update-${Date.now()}`);AF(h,{recursive:!0});try{let j=aN(h,S.name);await GF(S.downloadUrl,j,I.tagName,S.name);let L=j;if(S.name.endsWith(".tar.gz")||S.name.endsWith(".tgz"))L=jF(j,h,u);else if(S.name.endsWith(".zip"))L=WF(j,h,u);if(SF(L,493),process.platform==="darwin")try{Zt("/usr/bin/codesign",["--remove-signature",L],{stdio:"ignore"}),Zt("/usr/bin/codesign",["--force","--sign","-",L],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let x=`${d}.old.${Date.now()}`;try{V4(d,x)}catch{}V4(L,d)}else V4(L,d);if(k)await Et("start",r);let q=ZN();K({updated:!0,fromVersion:R,toVersion:g,serviceRestarted:k,skillSynced:q.synced?q.targetDir:!1,mode:"binary"})}finally{try{OF(h,{recursive:!0,force:!0})}catch{}}}function LF(){if(process.platform==="darwin")return"darwin";if(process.platform==="win32")return"windows";return"linux"}function NF(){return process.arch==="arm64"?"arm64":"x64"}async function T4(n,i=20){let r=process.env.GITHUB_TOKEN||process.env.GH_TOKEN,o={"User-Agent":`seal-home/${R}`,Accept:"application/vnd.github.v3+json",...r?{Authorization:`Bearer ${r}`}:{}},t=[`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases?per_page=${i}`,`https://api.github.com/repos/${n}/releases?per_page=${i}`];for(let e of t)try{let u=await fetch(e,{headers:o,signal:AbortSignal.timeout(5000)});if(!u.ok)continue;let l=await u.json();if(!Array.isArray(l)||l.length===0)continue;let $=[];for(let I of l){let g=I.tag_name??"",b=g.replace(/^v/,"");if(!b)continue;let w=(I.assets??[]).map((f)=>({name:f.name,downloadUrl:f.browser_download_url,size:f.size??0}));$.push({version:b,tagName:g,name:I.name??g,publishedAt:I.published_at,author:I.author?.login,notes:I.body??"",htmlUrl:I.html_url??"",assets:w})}if($.length>0)return $}catch{}return[]}async function sN(n,i){let r=i?i.startsWith("v")?i:`v${i}`:void 0,o=process.env.GITHUB_TOKEN||process.env.GH_TOKEN,t={"User-Agent":`seal-home/${R}`,Accept:"application/vnd.github.v3+json",...o?{Authorization:`Bearer ${o}`}:{}},e=r?[`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/tags/${r}`,`https://api.github.com/repos/${n}/releases/tags/${r}`]:["https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/latest",`https://api.github.com/repos/${n}/releases/latest`],u;for(let l of e)try{let $=await fetch(l,{headers:t,signal:AbortSignal.timeout(5000)});if(!$.ok)continue;let I=await $.json(),g=I.tag_name??"",b=g.replace(/^v/,"");if(!b)continue;let w=(I.assets??[]).map((c)=>({name:c.name,downloadUrl:c.browser_download_url,size:c.size??0})),f={version:b,tagName:g,name:I.name??g,publishedAt:I.published_at,author:I.author?.login,notes:I.body??"",htmlUrl:I.html_url??"",assets:w};if(w.length>0)return f;if(!u)u=f}catch{}return u}function yF(n,i,r){let o={darwin:["darwin","macos","osx","apple"],linux:["linux"],windows:["windows","win32","win"]},t={arm64:["arm64","aarch64"],x64:["x64","x86_64","amd64"]},e=o[i]||[],u=t[r]||[],l=n.filter((g)=>{let b=g.name.toLowerCase(),w=e.some((c)=>b.includes(c)),f=u.some((c)=>b.includes(c));return w&&f}),$=l.find((g)=>!g.name.endsWith(".tar.gz")&&!g.name.endsWith(".tgz")&&!g.name.endsWith(".zip")&&!g.name.endsWith(".sha256"));if($)return $;return l.find((g)=>g.name.endsWith(".tar.gz")||g.name.endsWith(".tgz")||g.name.endsWith(".zip"))||l[0]}function $$(n){try{process.stderr.write(`${n}
|
||
`)}catch{}}async function GF(n,i,r,o){let t=[],e=r?r.startsWith("v")?r:`v${r}`:void 0,u=o||n.split("/").pop()||"";if(e&&u)t.push(`https://git.ying-qing.cn/gitea/seal-home/releases/download/${e}/${u}`);if(n.startsWith("https://git.ying-qing.cn"))t.push(n);if(e&&u){let c=`https://github.com/${ty}/releases/download/${e}/${u}`;t.push(`https://ghfast.top/${c}`),t.push(`https://gh.ddlc.top/${c}`),t.push(c)}else if(n.includes("github.com"))t.push(`https://ghfast.top/${n}`),t.push(`https://gh.ddlc.top/${n}`),t.push(n);else t.push(n);let l=Array.from(new Set(t)),$,I=6000,g=6000,b=307200,w=1e4,f=180000;for(let c=0;c<l.length;c++){let S=l[c],k=new AbortController,d="",p=(q)=>{d=q;try{k.abort()}catch{}},h=setTimeout(()=>{p("Connection timed out (no response headers within 6s)")},I),j,L;try{$$(`==> [${c+1}/${l.length}] Downloading via: ${S}`);let q=await fetch(S,{signal:k.signal});if(h)clearTimeout(h),h=void 0;if(!q.ok)throw Error(`HTTP ${q.status} ${q.statusText}`);j=setTimeout(()=>{p("Overall download time exceeded 3 minutes")},f);let x=Number(q.headers.get("content-length"))||0,yn=q.body?.getReader();if(!yn){let wi=Buffer.from(await q.arrayBuffer());if(wi.length<1000)throw Error(`Downloaded content is suspiciously small (${wi.length} bytes)`);xN(i,wi),$$(`✓ Download succeeded (${(wi.length/1024/1024).toFixed(1)} MB)`);return}let Wn=[],On=0,en=0;L=setTimeout(()=>{if(On<b){let wi=(On/1024).toFixed(1);p(`Initial transfer too slow (${wi} KB < 300 KB in 6s), switching mirror...`)}},g);while(!0){let wi=yn.read(),no,gy=new Promise((g$,b$)=>{no=setTimeout(()=>{b$(Error("Data transfer stalled (no chunk received for 10s)"))},w)}),E4;try{E4=await Promise.race([wi,gy])}finally{if(no)clearTimeout(no)}let{done:by,value:I$}=E4;if(by)break;if(I$){if(Wn.push(I$),On+=I$.length,L&&On>=b)clearTimeout(L),L=void 0;let g$=Date.now();if(g$-en>200){en=g$;let b$=x?Math.round(On/x*100):0,wy=(On/1048576).toFixed(1),fy=x?(x/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${b$}% (${wy} / ${fy} MB)...`)}catch{}}}}try{process.stderr.write(`
|
||
`)}catch{}let kt=Buffer.concat(Wn);if(kt.length<1000)throw Error(`Downloaded content is suspiciously small (${kt.length} bytes)`);xN(i,kt),$$(`✓ Download completed successfully (${(kt.length/1024/1024).toFixed(1)} MB)`);return}catch(q){if(h)clearTimeout(h);if(L)clearTimeout(L);if(j)clearTimeout(j);let x=d||(q instanceof Error?q.message:String(q));$=Error(x),$$(`
|
||
↳ Mirror failed: ${$.message}`)}finally{if(h)clearTimeout(h);if(L)clearTimeout(L);if(j)clearTimeout(j)}}throw Error(`Failed to download asset from all mirrors: ${$?.message}`)}function jF(n,i,r){let o=Zt("tar",["-xzf",n,"-C",i],{stdio:"pipe"});if(o.status!==0)throw Error(`Failed to extract tar archive: ${o.stderr.toString()}`);iy(n);let t=r==="windows"?"seal-home.exe":"seal-home",e=Zt("find",[i,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
|
||
`).filter(Boolean),u=e.find((l)=>l.endsWith(`/${t}`)||l.endsWith(t));if(u)return u;return e[0]||n}function WF(n,i,r){let o=Zt("unzip",["-q","-o",n,"-d",i],{stdio:"pipe"});if(o.status!==0)throw Error(`Failed to extract zip archive: ${o.stderr.toString()}`);iy(n);let t=r==="windows"?"seal-home.exe":"seal-home",e=Zt("find",[i,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
|
||
`).filter(Boolean),u=e.find((l)=>l.endsWith(`/${t}`)||l.endsWith(t));if(u)return u;return e[0]||n}function oy(n,i){let r=n.replace(/^v/,"").split(".").map((t)=>Number.parseInt(t,10)||0),o=i.replace(/^v/,"").split(".").map((t)=>Number.parseInt(t,10)||0);for(let t=0;t<Math.max(r.length,o.length);t++){let e=r[t]??0,u=o[t]??0;if(e>u)return 1;if(e<u)return-1}return 0}function Ee(n,i){return oy(n,i)>0}function ny(n,i,r={}){let o=Zt(n,i,{cwd:r.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(o.stdout)console.error(o.stdout.trimEnd());if(o.stderr)console.error(o.stderr.trimEnd());if(o.status!==0)throw Error(`${n} ${i.join(" ")} failed with status ${o.status}`)}async function ey(n,i,r,o,t){if(n==="create"){let e=D(t.options.name)??i,u=D(t.options.phone);if(!e||!u)throw Error("Usage: seal-home users create --name <name> --phone <phone> [--dept <deptId>]");let l=D(t.options.dept)??D(t.options.departmentId);await H("seal_user_create",r,o,{name:e,phone:u,departmentIds:l?[l]:void 0},J(t.options));return}if(n==="reset-password"){let e=i??D(t.options.userId);if(!e)throw Error("Usage: seal-home users reset-password <userId>");await H("seal_user_reset_password",r,o,{userId:e},J(t.options));return}if(n==="search"||n==="list"){let e=i??D(t.options.keyword)??D(t.options.query)??"";await H("seal_user_search",r,o,{keyword:e},J(t.options));return}if(n==="get"){let e=i??D(t.options.userId);if(!e)throw Error("Usage: seal-home users get <userId>");await H("seal_user_get",r,o,{userId:e},J(t.options));return}if(n==="delete"){let e=i??D(t.options.userId);if(!e)throw Error("Usage: seal-home users delete <userId>");await H("seal_user_delete",r,o,{userId:e},J(t.options));return}if(n==="activate"){let e=i??D(t.options.userId);if(!e)throw Error("Usage: seal-home users activate <userId>");await H("seal_user_activate",r,o,{userId:e},J(t.options));return}if(n==="delegation"||n==="impersonate"){let e=i??D(t.options.userId)??D(t.options.phone);if(!e)throw Error("Usage: seal-home users delegation <userIdOrPhone> [--note <note>]");let u=D(t.options.note);await H("seal_user_delegation_create",r,o,{userIdOrPhone:e,note:u},J(t.options));return}throw Error(`Unknown users command: ${n??""}. Run 'seal-home help' for available commands.`)}async function uy(n,i,r,o,t){if(n==="list"){await H("seal_webhook_list",r,o,{query:D(t.options.query)??D(t.options.keyword),includeSecret:H4(t.options)},J(t.options));return}if(n==="get"||n==="find"){let e=i??D(t.options.selector)??D(t.options.id);if(!e)throw Error("Usage: seal-home webhook get <idOrName> [--show-secret]");await H("seal_webhook_get",r,o,{selector:e,includeSecret:H4(t.options)},J(t.options));return}if(n==="add"||n==="create"){let e=D(t.options.name)??i,u=D(t.options.resultUrl)??D(t.options["result-url"])??D(t.options.outgoingResultWebhook)??D(t.options["outgoing-result-webhook"]);if(!e||!u)throw Error("Usage: seal-home webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");let l=J4(t.options);await H("seal_webhook_add",r,o,{name:e,mode:W4(D(t.options.mode)),outgoingResultWebhook:u,autoApprovalRate:l,secret:D(t.options.secret)},J(t.options));return}if(n==="update"){let e=i??D(t.options.selector)??D(t.options.id);if(!e)throw Error("Usage: seal-home webhook update <idOrName> [options]");let u=D(t.options.secret),l=_(t.options.rotateSecret)??_(t.options["rotate-secret"]);if(u!==void 0&&l)throw Error("Use either --secret or --rotate-secret, not both");let $=D(t.options.name),I=W4(D(t.options.mode)),g=D(t.options.resultUrl)??D(t.options["result-url"])??D(t.options.outgoingResultWebhook)??D(t.options["outgoing-result-webhook"]),b=J4(t.options);if($===void 0&&I===void 0&&g===void 0&&b===void 0&&u===void 0&&!l)throw Error("Webhook update requires at least one field option");await H("seal_webhook_update",r,o,{selector:e,name:$,mode:I,outgoingResultWebhook:g,autoApprovalRate:b,secret:u,rotateSecret:l},J(t.options));return}if(n==="delete"){let e=i??D(t.options.selector)??D(t.options.id);if(!e)throw Error("Usage: seal-home webhook delete <idOrName> --yes");if(_(t.options.yes)!==!0)throw Error("Refusing to delete Webhook integration without --yes");await H("seal_webhook_delete",r,o,{selector:e,confirm:!0},J(t.options));return}throw Error(`Unknown webhook command: ${n??""}. Run 'seal-home help' for available commands.`)}var ly=q4(q4(q4(HF(import.meta.url)))),XF=new Set(["config","service","http","serve","update","tools","corps","tool","source","auth","delegation","users","llm","permissions","billing","webhook","webhooks","context","rules","approval-runs","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","changelog"]),vy=Promise.resolve();function qe(n,i={}){let r=vy.then(()=>hF(n,i));return vy=r.then(()=>{return},()=>{return}),r}async function hF(n,i){let r=[],o=[],t=console.log,e=console.error,u={appRoot:i.appRoot??ly,entryFile:i.entryFile??JF(i.appRoot??ly,"src","cli.ts"),launcher:i.launcher};console.log=(...l)=>{r.push(X4(l))},console.error=(...l)=>{o.push(X4(l))};try{return await PF(n,u),{stdout:Be(r),stderr:Be(o),isError:!1,exitCode:0}}catch(l){return o.push(Ve(l instanceof Error?l.message:String(l))),{stdout:Be(r),stderr:Be(o),isError:!0,exitCode:1}}finally{console.log=t,console.error=e}}async function PF(n,i){let r=pL(n),[o,t,e]=r.command;if(o==="version"||o==="v"||Boolean(r.options.version)||Boolean(r.options.v)||Boolean(r.options.V)){K({name:"seal-home",version:R});return}if(!o||o==="help"||r.options.help){_L();return}if(!XF.has(o))throw Error(`Unknown command: ${r.command.join(" ")}. Run 'seal-home help' for available commands.`);if(o==="openapi"){cN(r);return}if(o==="mcp-config"){Y4();return}if(o==="skill"){MN(t,e,r);return}if(o==="mcp"||o==="server"){await fN(t,r);return}if(o==="probe"){await ON(t,e,r);return}if(o==="config"){xL(t,e,r);return}if(o==="service"){await jN(t,i);return}if(o==="http"||o==="serve"){await bN(r);return}if(o==="update"||o==="changelog"){let $=o==="changelog"||t==="changelog"||t==="log"||t==="history"||_(r.options.changelog)===!0,I=t==="check"||_(r.options.check)===!0||_(r.options["check-only"])===!0,g=D(r.options.version)??D(r.options.tag)??(!$&&!I&&t&&!t.startsWith("-")?t:void 0);await ry(i,{checkOnly:I,changelogOnly:$,limit:ln(r.options.limit),force:_(r.options.force),targetVersion:g,repo:D(r.options.repo)});return}if(o==="tools"&&t==="list"){RN();return}if(o==="corps"){await rN(t,e,r);return}if(o==="delegation"&&t==="create"&&(("from-link"in r.options)||("link"in r.options))){let $=D(r.options["from-link"])??D(r.options.link);if(!$)throw Error("Usage: seal-home delegation create --from-link <url> [--note <note>]");await eN($,D(r.options.note));return}let u=Nn(D(r.options.corp));if(o==="source"){await zN(t,u);return}if(o==="auth"){await ML(t,u,r);return}let l=await An(u);if(o==="delegation"){await uN(t,e,l,u,r);return}if(o==="users"){await ey(t,e,l,u,r);return}if(o==="llm"){await wN(t,l,u,r);return}if(o==="permissions"){await UN(t,l,u,r);return}if(o==="billing"){await RL(t,l,u,r);return}if(o==="webhook"||o==="webhooks"){await uy(t,e,l,u,r);return}if(o==="context"){await aL(l,u,r);return}if(o==="rules"){await kN(t,e,l,u,r);return}if(o==="approval-runs"){await EL(t,e,l,u,r);return}if(o==="simulation"){await JN(t,e,l,u,r);return}if(o==="deploy"){await lN(t,e,r.command[3],l,u,r);return}if(o==="preference"||o==="preferences"){await SN(t,e,r.command[3],r.command[4],l,u,r);return}if(o==="tool"){await CN(t,l,u,r);return}throw Error(`Unknown command: ${r.command.join(" ")}. Run 'seal-home help' for available commands.`)}var zi=YF(import.meta.url),Iy=zi.includes("/dist/mcp/")||zi.includes("\\dist\\mcp\\")?Ze(Ze(Ze(zi))):Ze(Ze(zi)),pF="seal_cli",QF="SEAL_HOME_MCP_ENABLED";function FF(n=process.env[QF]){if(n===void 0)return!1;return["1","true","yes","on"].includes(n.trim().toLowerCase())}function KF(n={}){let i=n.enableCli??!0,r=new h6({name:"seal-home",version:R},{capabilities:{tools:{}}});if(r.setRequestHandler(Ac,async()=>({tools:i?[{name:pF,description:"Run seal-home CLI commands. See the seal-home skill for command reference.",inputSchema:{type:"object",properties:{command:{type:"string",description:"A seal-home CLI command, with or without the leading 'seal-home'."}},required:["command"],additionalProperties:!1}}]:[]})),i)r.setRequestHandler(Co,async(o)=>{let t=o.params.arguments,e=t&&typeof t.command==="string"?t.command:void 0;if(!e?.trim())return _4({stdout:"",stderr:"seal_cli requires a non-empty command string",isError:!0,exitCode:1});try{let u=P4(e),l=BF(u);if(!l.length)throw Error("seal_cli requires a non-empty command string");return _4(await qe(l,{appRoot:Iy,entryFile:zi,launcher:{command:process.execPath,args:[zi,"--seal-home-cli"]}}))}catch(u){return _4({stdout:"",stderr:u instanceof Error?u.message:String(u),isError:!0,exitCode:1})}});return r}async function p4(){let n=FF();await KF({enableCli:n}).connect(new Y6),console.error(n?"seal-home MCP server running on stdio":"seal-home MCP server connected with seal_cli disabled by configuration")}function P4(n){let i=[],r="",o,t=!1,e=!1;for(let u of n){if(t){r+=u,t=!1,e=!0;continue}if(u==="\\"&&o!=="'"){t=!0,e=!0;continue}if(o){if(u===o)o=void 0;else r+=u;e=!0;continue}if(u==="'"||u==='"'){o=u,e=!0;continue}if(/\s/.test(u)){if(e)i.push(r),r="",e=!1;continue}r+=u,e=!0}if(t)throw Error("Invalid command: trailing escape");if(o)throw Error("Invalid command: unterminated quote");if(e)i.push(r);return i}function BF(n){let i=n[0];if(!i)return[];if(i==="seal-home"||i.endsWith("/seal-home"))return n.slice(1);return n}function _4(n){return{content:[{type:"text",text:n.isError?n.stderr||n.stdout:n.stdout}],isError:n.isError}}async function VF(){let n=await qe(process.argv.slice(3),{appRoot:Iy,entryFile:zi,launcher:{command:process.execPath,args:[zi,"--seal-home-cli"]}});if(n.stdout)process.stdout.write(n.stdout);if(n.stderr)process.stderr.write(`${n.stderr}${n.stderr.endsWith(`
|
||
`)?"":`
|
||
`}`);process.exitCode=n.exitCode}var TF=Boolean(m4.main==m4.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&$y(process.argv[1])===$y(zi));if(TF)if(process.argv[2]==="--seal-home-cli")await VF();else p4().catch((n)=>{console.error(n),process.exitCode=1});export{P4 as tokenizeCommand,p4 as startServer,FF as resolveMcpEnabled,KF as createServer,QF as SEAL_MCP_ENABLED_ENV,pF as SEAL_CLI_TOOL_NAME};
|