@intelliweave/embedded 1.9.69-beta.5 → 2.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{b as P,c as Xd,d as Yd,e as ct}from"./chunk-AIYMQX7V.js";var Yc=P(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.regexpCode=Ve.getEsmExportName=Ve.getProperty=Ve.safeStringify=Ve.stringify=Ve.strConcat=Ve.addCodeArg=Ve.str=Ve._=Ve.nil=Ve._Code=Ve.Name=Ve.IDENTIFIER=Ve._CodeOrName=void 0;var Jc=class{};Ve._CodeOrName=Jc;Ve.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var po=class extends Jc{constructor(e){if(super(),!Ve.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Ve.Name=po;var _n=class extends Jc{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof po&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Ve._Code=_n;Ve.nil=new _n("");function gI(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Uv(r,e[n]),r.push(t[++n]);return new _n(r)}Ve._=gI;var jv=new _n("+");function yI(t,...e){let r=[Xc(t[0])],n=0;for(;n<e.length;)r.push(jv),Uv(r,e[n]),r.push(jv,Xc(t[++n]));return mj(r),new _n(r)}Ve.str=yI;function Uv(t,e){e instanceof _n?t.push(...e._items):e instanceof po?t.push(e):t.push(gj(e))}Ve.addCodeArg=Uv;function mj(t){let e=1;for(;e<t.length-1;){if(t[e]===jv){let r=hj(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function hj(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof po||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof po))return`"${t}${e.slice(1)}`}function fj(t,e){return e.emptyStr()?t:t.emptyStr()?e:yI`${t}${e}`}Ve.strConcat=fj;function gj(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xc(Array.isArray(t)?t.join(","):t)}function yj(t){return new _n(Xc(t))}Ve.stringify=yj;function Xc(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ve.safeStringify=Xc;function bj(t){return typeof t=="string"&&Ve.IDENTIFIER.test(t)?new _n(`.${t}`):gI`[${t}]`}Ve.getProperty=bj;function vj(t){if(typeof t=="string"&&Ve.IDENTIFIER.test(t))return new _n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Ve.getEsmExportName=vj;function _j(t){return new _n(t.toString())}Ve.regexpCode=_j});var Hv=P(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.ValueScope=jr.ValueScopeName=jr.Scope=jr.varKinds=jr.UsedValueState=void 0;var Br=Yc(),Gv=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Om;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Om||(jr.UsedValueState=Om={}));jr.varKinds={const:new Br.Name("const"),let:new Br.Name("let"),var:new Br.Name("var")};var Dm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Br.Name?e:this.name(e)}name(e){return new Br.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};jr.Scope=Dm;var Mm=class extends Br.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Br._)`.${new Br.Name(r)}[${n}]`}};jr.ValueScopeName=Mm;var Sj=(0,Br._)`\n`,Vv=class extends Dm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Sj:Br.nil}}get(){return this._scope}name(e){return new Mm(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Br._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Br.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,Om.Started);let u=r(c);if(u){let d=this.opts.es5?jr.varKinds.var:jr.varKinds.const;a=(0,Br._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Br._)`${a}${u}${this.opts._n}`;else throw new Gv(c);l.set(c,Om.Completed)})}return a}};jr.ValueScope=Vv});var Ne=P(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.or=Ie.and=Ie.not=Ie.CodeGen=Ie.operators=Ie.varKinds=Ie.ValueScopeName=Ie.ValueScope=Ie.Scope=Ie.Name=Ie.regexpCode=Ie.stringify=Ie.getProperty=Ie.nil=Ie.strConcat=Ie.str=Ie._=void 0;var ze=Yc(),Bn=Hv(),wa=Yc();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return wa._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return wa.str}});Object.defineProperty(Ie,"strConcat",{enumerable:!0,get:function(){return wa.strConcat}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return wa.nil}});Object.defineProperty(Ie,"getProperty",{enumerable:!0,get:function(){return wa.getProperty}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return wa.stringify}});Object.defineProperty(Ie,"regexpCode",{enumerable:!0,get:function(){return wa.regexpCode}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return wa.Name}});var Fm=Hv();Object.defineProperty(Ie,"Scope",{enumerable:!0,get:function(){return Fm.Scope}});Object.defineProperty(Ie,"ValueScope",{enumerable:!0,get:function(){return Fm.ValueScope}});Object.defineProperty(Ie,"ValueScopeName",{enumerable:!0,get:function(){return Fm.ValueScopeName}});Object.defineProperty(Ie,"varKinds",{enumerable:!0,get:function(){return Fm.varKinds}});Ie.operators={GT:new ze._Code(">"),GTE:new ze._Code(">="),LT:new ze._Code("<"),LTE:new ze._Code("<="),EQ:new ze._Code("==="),NEQ:new ze._Code("!=="),NOT:new ze._Code("!"),OR:new ze._Code("||"),AND:new ze._Code("&&"),ADD:new ze._Code("+")};var Bi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},qv=class extends Bi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Bn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Qs(this.rhs,e,r)),this}get names(){return this.rhs instanceof ze._CodeOrName?this.rhs.names:{}}},$m=class extends Bi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ze.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Qs(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ze.Name?{}:{...this.lhs.names};return zm(e,this.rhs)}},Wv=class extends $m{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Zv=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Kv=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Jv=class extends Bi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Xv=class extends Bi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Qs(this.code,e,r),this}get names(){return this.code instanceof ze._CodeOrName?this.code.names:{}}},Qc=class extends Bi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(wj(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>fo(e,r.names),{})}},ji=class extends Qc{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Yv=class extends Qc{},Ys=class extends ji{};Ys.kind="else";var mo=class t extends ji{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ys(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(bI(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Qs(this.condition,e,r),this}get names(){let e=super.names;return zm(e,this.condition),this.else&&fo(e,this.else.names),e}};mo.kind="if";var ho=class extends ji{};ho.kind="for";var Qv=class extends ho{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Qs(this.iteration,e,r),this}get names(){return fo(super.names,this.iteration.names)}},e_=class extends ho{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Bn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=zm(super.names,this.from);return zm(e,this.to)}},Lm=class extends ho{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Qs(this.iterable,e,r),this}get names(){return fo(super.names,this.iterable.names)}},eu=class extends ji{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};eu.kind="func";var tu=class extends Qc{render(e){return"return "+super.render(e)}};tu.kind="return";var t_=class extends ji{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&fo(e,this.catch.names),this.finally&&fo(e,this.finally.names),e}},ru=class extends ji{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ru.kind="catch";var nu=class extends ji{render(e){return"finally"+super.render(e)}};nu.kind="finally";var r_=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
-
`:""},this._extScope=e,this._scope=new Bn.Scope({parent:e}),this._nodes=[new Yv]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new qv(e,a,n)),a}const(e,r,n){return this._def(Bn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Bn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Bn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new $m(e,r,n))}add(e,r){return this._leafNode(new Wv(e,Ie.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ze.nil&&this._leafNode(new Xv(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ze.addCodeArg)(r,i));return r.push("}"),new ze._Code(r)}if(e,r,n){if(this._blockNode(new mo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mo(e))}else(){return this._elseNode(new Ys)}endIf(){return this._endBlockNode(mo,Ys)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Qv(e),r)}forRange(e,r,n,i,a=this.opts.es5?Bn.varKinds.var:Bn.varKinds.let){let o=this._scope.toName(e);return this._for(new e_(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Bn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ze.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ze._)`${o}.length`,s=>{this.var(a,(0,ze._)`${o}[${s}]`),n(a)})}return this._for(new Lm("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Bn.varKinds.var:Bn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ze._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new Lm("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(ho)}label(e){return this._leafNode(new Zv(e))}break(e){return this._leafNode(new Kv(e))}return(e){let r=new tu;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tu)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new t_;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new ru(a),r(a)}return n&&(this._currNode=i.finally=new nu,this.code(n)),this._endBlockNode(ru,nu)}throw(e){return this._leafNode(new Jv(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ze.nil,n,i){return this._blockNode(new eu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(eu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ie.CodeGen=r_;function fo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function zm(t,e){return e instanceof ze._CodeOrName?fo(t,e.names):t}function Qs(t,e,r){if(t instanceof ze.Name)return n(t);if(!i(t))return t;return new ze._Code(t._items.reduce((a,o)=>(o instanceof ze.Name&&(o=n(o)),o instanceof ze._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof ze._Code&&a._items.some(o=>o instanceof ze.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function wj(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function bI(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ze._)`!${n_(t)}`}Ie.not=bI;var kj=vI(Ie.operators.AND);function xj(...t){return t.reduce(kj)}Ie.and=xj;var Ej=vI(Ie.operators.OR);function Tj(...t){return t.reduce(Ej)}Ie.or=Tj;function vI(t){return(e,r)=>e===ze.nil?r:r===ze.nil?e:(0,ze._)`${n_(e)} ${t} ${n_(r)}`}function n_(t){return t instanceof ze.Name?t:(0,ze._)`(${t})`}});var He=P(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.checkStrictMode=Oe.getErrorPath=Oe.Type=Oe.useFunc=Oe.setEvaluated=Oe.evaluatedPropsToName=Oe.mergeEvaluated=Oe.eachItem=Oe.unescapeJsonPointer=Oe.escapeJsonPointer=Oe.escapeFragment=Oe.unescapeFragment=Oe.schemaRefOrVal=Oe.schemaHasRulesButRef=Oe.schemaHasRules=Oe.checkUnknownRules=Oe.alwaysValidSchema=Oe.toHash=void 0;var st=Ne(),Cj=Yc();function Ij(t){let e={};for(let r of t)e[r]=!0;return e}Oe.toHash=Ij;function Aj(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(wI(t,e),!kI(e,t.self.RULES.all))}Oe.alwaysValidSchema=Aj;function wI(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||TI(t,`unknown keyword: "${a}"`)}Oe.checkUnknownRules=wI;function kI(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Oe.schemaHasRules=kI;function Pj(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Oe.schemaHasRulesButRef=Pj;function Rj({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,st._)`${r}`}return(0,st._)`${t}${e}${(0,st.getProperty)(n)}`}Oe.schemaRefOrVal=Rj;function Nj(t){return xI(decodeURIComponent(t))}Oe.unescapeFragment=Nj;function Oj(t){return encodeURIComponent(a_(t))}Oe.escapeFragment=Oj;function a_(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Oe.escapeJsonPointer=a_;function xI(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Oe.unescapeJsonPointer=xI;function Dj(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Oe.eachItem=Dj;function _I({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof st.Name?(a instanceof st.Name?t(i,a,o):e(i,a,o),o):a instanceof st.Name?(e(i,o,a),a):r(a,o);return s===st.Name&&!(l instanceof st.Name)?n(i,l):l}}Oe.mergeEvaluated={props:_I({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,st._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,st._)`${r} || {}`).code((0,st._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,st._)`${r} || {}`),o_(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:EI}),items:_I({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,st._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,st._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function EI(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,st._)`{}`);return e!==void 0&&o_(t,r,e),r}Oe.evaluatedPropsToName=EI;function o_(t,e,r){Object.keys(r).forEach(n=>t.assign((0,st._)`${e}${(0,st.getProperty)(n)}`,!0))}Oe.setEvaluated=o_;var SI={};function Mj(t,e){return t.scopeValue("func",{ref:e,code:SI[e.code]||(SI[e.code]=new Cj._Code(e.code))})}Oe.useFunc=Mj;var i_;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(i_||(Oe.Type=i_={}));function $j(t,e,r){if(t instanceof st.Name){let n=e===i_.Num;return r?n?(0,st._)`"[" + ${t} + "]"`:(0,st._)`"['" + ${t} + "']"`:n?(0,st._)`"/" + ${t}`:(0,st._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,st.getProperty)(t).toString():"/"+a_(t)}Oe.getErrorPath=$j;function TI(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Oe.checkStrictMode=TI});var Ui=P(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var gr=Ne(),Lj={data:new gr.Name("data"),valCxt:new gr.Name("valCxt"),instancePath:new gr.Name("instancePath"),parentData:new gr.Name("parentData"),parentDataProperty:new gr.Name("parentDataProperty"),rootData:new gr.Name("rootData"),dynamicAnchors:new gr.Name("dynamicAnchors"),vErrors:new gr.Name("vErrors"),errors:new gr.Name("errors"),this:new gr.Name("this"),self:new gr.Name("self"),scope:new gr.Name("scope"),json:new gr.Name("json"),jsonPos:new gr.Name("jsonPos"),jsonLen:new gr.Name("jsonLen"),jsonPart:new gr.Name("jsonPart")};s_.default=Lj});var iu=P(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendErrors=yr.resetErrorsCount=yr.reportExtraError=yr.reportError=yr.keyword$DataError=yr.keywordError=void 0;var je=Ne(),Bm=He(),Tr=Ui();yr.keywordError={message:({keyword:t})=>(0,je.str)`must pass "${t}" keyword validation`};yr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,je.str)`"${t}" keyword must be ${e} ($data)`:(0,je.str)`"${t}" keyword is invalid ($data)`};function zj(t,e=yr.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=AI(t,e,r);n??(o||s)?CI(a,l):II(i,(0,je._)`[${l}]`)}yr.reportError=zj;function Fj(t,e=yr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=AI(t,e,r);CI(i,s),a||o||II(n,Tr.default.vErrors)}yr.reportExtraError=Fj;function Bj(t,e){t.assign(Tr.default.errors,e),t.if((0,je._)`${Tr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,je._)`${Tr.default.vErrors}.length`,e),()=>t.assign(Tr.default.vErrors,null)))}yr.resetErrorsCount=Bj;function jj({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Tr.default.errors,s=>{t.const(o,(0,je._)`${Tr.default.vErrors}[${s}]`),t.if((0,je._)`${o}.instancePath === undefined`,()=>t.assign((0,je._)`${o}.instancePath`,(0,je.strConcat)(Tr.default.instancePath,a.errorPath))),t.assign((0,je._)`${o}.schemaPath`,(0,je.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,je._)`${o}.schema`,r),t.assign((0,je._)`${o}.data`,n))})}yr.extendErrors=jj;function CI(t,e){let r=t.const("err",e);t.if((0,je._)`${Tr.default.vErrors} === null`,()=>t.assign(Tr.default.vErrors,(0,je._)`[${r}]`),(0,je._)`${Tr.default.vErrors}.push(${r})`),t.code((0,je._)`${Tr.default.errors}++`)}function II(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,je._)`new ${t.ValidationError}(${e})`):(r.assign((0,je._)`${n}.errors`,e),r.return(!1))}var go={keyword:new je.Name("keyword"),schemaPath:new je.Name("schemaPath"),params:new je.Name("params"),propertyName:new je.Name("propertyName"),message:new je.Name("message"),schema:new je.Name("schema"),parentSchema:new je.Name("parentSchema")};function AI(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,je._)`{}`:Uj(t,e,r)}function Uj(t,e,r={}){let{gen:n,it:i}=t,a=[Gj(i,r),Vj(t,r)];return Hj(t,e,a),n.object(...a)}function Gj({errorPath:t},{instancePath:e}){let r=e?(0,je.str)`${t}${(0,Bm.getErrorPath)(e,Bm.Type.Str)}`:t;return[Tr.default.instancePath,(0,je.strConcat)(Tr.default.instancePath,r)]}function Vj({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,je.str)`${e}/${t}`;return r&&(i=(0,je.str)`${i}${(0,Bm.getErrorPath)(r,Bm.Type.Str)}`),[go.schemaPath,i]}function Hj(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([go.keyword,i],[go.params,typeof e=="function"?e(t):e||(0,je._)`{}`]),l.messages&&n.push([go.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([go.schema,o],[go.parentSchema,(0,je._)`${u}${d}`],[Tr.default.data,a]),c&&n.push([go.propertyName,c])}});var RI=P(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.boolOrEmptySchema=el.topBoolOrEmptySchema=void 0;var qj=iu(),Wj=Ne(),Zj=Ui(),Kj={message:"boolean schema is false"};function Jj(t){let{gen:e,schema:r,validateName:n}=t;r===!1?PI(t,!1):typeof r=="object"&&r.$async===!0?e.return(Zj.default.data):(e.assign((0,Wj._)`${n}.errors`,null),e.return(!0))}el.topBoolOrEmptySchema=Jj;function Xj(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),PI(t)):r.var(e,!0)}el.boolOrEmptySchema=Xj;function PI(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,qj.reportError)(i,Kj,void 0,e)}});var l_=P(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.getRules=tl.isJSONType=void 0;var Yj=["string","number","integer","boolean","null","object","array"],Qj=new Set(Yj);function eU(t){return typeof t=="string"&&Qj.has(t)}tl.isJSONType=eU;function tU(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}tl.getRules=tU});var c_=P(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.shouldUseRule=ka.shouldUseGroup=ka.schemaHasRulesForType=void 0;function rU({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&NI(t,n)}ka.schemaHasRulesForType=rU;function NI(t,e){return e.rules.some(r=>OI(t,r))}ka.shouldUseGroup=NI;function OI(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ka.shouldUseRule=OI});var au=P(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.reportTypeError=br.checkDataTypes=br.checkDataType=br.coerceAndCheckDataType=br.getJSONTypes=br.getSchemaTypes=br.DataType=void 0;var nU=l_(),iU=c_(),aU=iu(),ke=Ne(),DI=He(),rl;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(rl||(br.DataType=rl={}));function oU(t){let e=MI(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}br.getSchemaTypes=oU;function MI(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(nU.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}br.getJSONTypes=MI;function sU(t,e){let{gen:r,data:n,opts:i}=t,a=lU(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,iU.schemaHasRulesForType)(t,e[0]));if(o){let s=d_(e,n,i.strictNumbers,rl.Wrong);r.if(s,()=>{a.length?cU(t,e,a):p_(t)})}return o}br.coerceAndCheckDataType=sU;var $I=new Set(["string","number","integer","boolean","null"]);function lU(t,e){return e?t.filter(r=>$I.has(r)||e==="array"&&r==="array"):[]}function cU(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,ke._)`typeof ${i}`),s=n.let("coerced",(0,ke._)`undefined`);a.coerceTypes==="array"&&n.if((0,ke._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ke._)`${i}[0]`).assign(o,(0,ke._)`typeof ${i}`).if(d_(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,ke._)`${s} !== undefined`);for(let c of r)($I.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),p_(t),n.endIf(),n.if((0,ke._)`${s} !== undefined`,()=>{n.assign(i,s),uU(t,s)});function l(c){switch(c){case"string":n.elseIf((0,ke._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,ke._)`"" + ${i}`).elseIf((0,ke._)`${i} === null`).assign(s,(0,ke._)`""`);return;case"number":n.elseIf((0,ke._)`${o} == "boolean" || ${i} === null
|
|
1
|
+
import{b as P,c as rc,d as ep,e as ct}from"./chunk-AIYMQX7V.js";var tu=P(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.regexpCode=Ve.getEsmExportName=Ve.getProperty=Ve.safeStringify=Ve.stringify=Ve.strConcat=Ve.addCodeArg=Ve.str=Ve._=Ve.nil=Ve._Code=Ve.Name=Ve.IDENTIFIER=Ve._CodeOrName=void 0;var Qc=class{};Ve._CodeOrName=Qc;Ve.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var po=class extends Qc{constructor(e){if(super(),!Ve.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Ve.Name=po;var _n=class extends Qc{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof po&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Ve._Code=_n;Ve.nil=new _n("");function yI(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Yv(r,e[n]),r.push(t[++n]);return new _n(r)}Ve._=yI;var Xv=new _n("+");function bI(t,...e){let r=[eu(t[0])],n=0;for(;n<e.length;)r.push(Xv),Yv(r,e[n]),r.push(Xv,eu(t[++n]));return hj(r),new _n(r)}Ve.str=bI;function Yv(t,e){e instanceof _n?t.push(...e._items):e instanceof po?t.push(e):t.push(yj(e))}Ve.addCodeArg=Yv;function hj(t){let e=1;for(;e<t.length-1;){if(t[e]===Xv){let r=fj(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function fj(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof po||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof po))return`"${t}${e.slice(1)}`}function gj(t,e){return e.emptyStr()?t:t.emptyStr()?e:bI`${t}${e}`}Ve.strConcat=gj;function yj(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:eu(Array.isArray(t)?t.join(","):t)}function bj(t){return new _n(eu(t))}Ve.stringify=bj;function eu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ve.safeStringify=eu;function vj(t){return typeof t=="string"&&Ve.IDENTIFIER.test(t)?new _n(`.${t}`):yI`[${t}]`}Ve.getProperty=vj;function _j(t){if(typeof t=="string"&&Ve.IDENTIFIER.test(t))return new _n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Ve.getEsmExportName=_j;function Sj(t){return new _n(t.toString())}Ve.regexpCode=Sj});var t_=P(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.ValueScope=jr.ValueScopeName=jr.Scope=jr.varKinds=jr.UsedValueState=void 0;var Br=tu(),Qv=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Mm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Mm||(jr.UsedValueState=Mm={}));jr.varKinds={const:new Br.Name("const"),let:new Br.Name("let"),var:new Br.Name("var")};var $m=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Br.Name?e:this.name(e)}name(e){return new Br.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};jr.Scope=$m;var Lm=class extends Br.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Br._)`.${new Br.Name(r)}[${n}]`}};jr.ValueScopeName=Lm;var wj=(0,Br._)`\n`,e_=class extends $m{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?wj:Br.nil}}get(){return this._scope}name(e){return new Lm(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Br._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Br.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,Mm.Started);let u=r(c);if(u){let d=this.opts.es5?jr.varKinds.var:jr.varKinds.const;a=(0,Br._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Br._)`${a}${u}${this.opts._n}`;else throw new Qv(c);l.set(c,Mm.Completed)})}return a}};jr.ValueScope=e_});var Ne=P(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.or=Ie.and=Ie.not=Ie.CodeGen=Ie.operators=Ie.varKinds=Ie.ValueScopeName=Ie.ValueScope=Ie.Scope=Ie.Name=Ie.regexpCode=Ie.stringify=Ie.getProperty=Ie.nil=Ie.strConcat=Ie.str=Ie._=void 0;var ze=tu(),Bn=t_(),wa=tu();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return wa._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return wa.str}});Object.defineProperty(Ie,"strConcat",{enumerable:!0,get:function(){return wa.strConcat}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return wa.nil}});Object.defineProperty(Ie,"getProperty",{enumerable:!0,get:function(){return wa.getProperty}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return wa.stringify}});Object.defineProperty(Ie,"regexpCode",{enumerable:!0,get:function(){return wa.regexpCode}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return wa.Name}});var jm=t_();Object.defineProperty(Ie,"Scope",{enumerable:!0,get:function(){return jm.Scope}});Object.defineProperty(Ie,"ValueScope",{enumerable:!0,get:function(){return jm.ValueScope}});Object.defineProperty(Ie,"ValueScopeName",{enumerable:!0,get:function(){return jm.ValueScopeName}});Object.defineProperty(Ie,"varKinds",{enumerable:!0,get:function(){return jm.varKinds}});Ie.operators={GT:new ze._Code(">"),GTE:new ze._Code(">="),LT:new ze._Code("<"),LTE:new ze._Code("<="),EQ:new ze._Code("==="),NEQ:new ze._Code("!=="),NOT:new ze._Code("!"),OR:new ze._Code("||"),AND:new ze._Code("&&"),ADD:new ze._Code("+")};var Bi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},r_=class extends Bi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Bn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=el(this.rhs,e,r)),this}get names(){return this.rhs instanceof ze._CodeOrName?this.rhs.names:{}}},zm=class extends Bi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ze.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=el(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ze.Name?{}:{...this.lhs.names};return Bm(e,this.rhs)}},n_=class extends zm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},i_=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},a_=class extends Bi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},o_=class extends Bi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},s_=class extends Bi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=el(this.code,e,r),this}get names(){return this.code instanceof ze._CodeOrName?this.code.names:{}}},ru=class extends Bi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(kj(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>fo(e,r.names),{})}},ji=class extends ru{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},l_=class extends ru{},Qs=class extends ji{};Qs.kind="else";var mo=class t extends ji{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qs(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(vI(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=el(this.condition,e,r),this}get names(){let e=super.names;return Bm(e,this.condition),this.else&&fo(e,this.else.names),e}};mo.kind="if";var ho=class extends ji{};ho.kind="for";var c_=class extends ho{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=el(this.iteration,e,r),this}get names(){return fo(super.names,this.iteration.names)}},u_=class extends ho{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Bn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=Bm(super.names,this.from);return Bm(e,this.to)}},Fm=class extends ho{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=el(this.iterable,e,r),this}get names(){return fo(super.names,this.iterable.names)}},nu=class extends ji{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};nu.kind="func";var iu=class extends ru{render(e){return"return "+super.render(e)}};iu.kind="return";var d_=class extends ji{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&fo(e,this.catch.names),this.finally&&fo(e,this.finally.names),e}},au=class extends ji{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};au.kind="catch";var ou=class extends ji{render(e){return"finally"+super.render(e)}};ou.kind="finally";var p_=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=e,this._scope=new Bn.Scope({parent:e}),this._nodes=[new l_]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new r_(e,a,n)),a}const(e,r,n){return this._def(Bn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Bn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Bn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new zm(e,r,n))}add(e,r){return this._leafNode(new n_(e,Ie.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ze.nil&&this._leafNode(new s_(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ze.addCodeArg)(r,i));return r.push("}"),new ze._Code(r)}if(e,r,n){if(this._blockNode(new mo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mo(e))}else(){return this._elseNode(new Qs)}endIf(){return this._endBlockNode(mo,Qs)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new c_(e),r)}forRange(e,r,n,i,a=this.opts.es5?Bn.varKinds.var:Bn.varKinds.let){let o=this._scope.toName(e);return this._for(new u_(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Bn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ze.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ze._)`${o}.length`,s=>{this.var(a,(0,ze._)`${o}[${s}]`),n(a)})}return this._for(new Fm("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Bn.varKinds.var:Bn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ze._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new Fm("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(ho)}label(e){return this._leafNode(new i_(e))}break(e){return this._leafNode(new a_(e))}return(e){let r=new iu;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(iu)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new d_;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new au(a),r(a)}return n&&(this._currNode=i.finally=new ou,this.code(n)),this._endBlockNode(au,ou)}throw(e){return this._leafNode(new o_(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ze.nil,n,i){return this._blockNode(new nu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(nu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ie.CodeGen=p_;function fo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Bm(t,e){return e instanceof ze._CodeOrName?fo(t,e.names):t}function el(t,e,r){if(t instanceof ze.Name)return n(t);if(!i(t))return t;return new ze._Code(t._items.reduce((a,o)=>(o instanceof ze.Name&&(o=n(o)),o instanceof ze._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof ze._Code&&a._items.some(o=>o instanceof ze.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function kj(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function vI(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ze._)`!${m_(t)}`}Ie.not=vI;var xj=_I(Ie.operators.AND);function Ej(...t){return t.reduce(xj)}Ie.and=Ej;var Tj=_I(Ie.operators.OR);function Cj(...t){return t.reduce(Tj)}Ie.or=Cj;function _I(t){return(e,r)=>e===ze.nil?r:r===ze.nil?e:(0,ze._)`${m_(e)} ${t} ${m_(r)}`}function m_(t){return t instanceof ze.Name?t:(0,ze._)`(${t})`}});var He=P(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.checkStrictMode=Oe.getErrorPath=Oe.Type=Oe.useFunc=Oe.setEvaluated=Oe.evaluatedPropsToName=Oe.mergeEvaluated=Oe.eachItem=Oe.unescapeJsonPointer=Oe.escapeJsonPointer=Oe.escapeFragment=Oe.unescapeFragment=Oe.schemaRefOrVal=Oe.schemaHasRulesButRef=Oe.schemaHasRules=Oe.checkUnknownRules=Oe.alwaysValidSchema=Oe.toHash=void 0;var st=Ne(),Ij=tu();function Aj(t){let e={};for(let r of t)e[r]=!0;return e}Oe.toHash=Aj;function Pj(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(kI(t,e),!xI(e,t.self.RULES.all))}Oe.alwaysValidSchema=Pj;function kI(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||CI(t,`unknown keyword: "${a}"`)}Oe.checkUnknownRules=kI;function xI(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Oe.schemaHasRules=xI;function Rj(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Oe.schemaHasRulesButRef=Rj;function Nj({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,st._)`${r}`}return(0,st._)`${t}${e}${(0,st.getProperty)(n)}`}Oe.schemaRefOrVal=Nj;function Oj(t){return EI(decodeURIComponent(t))}Oe.unescapeFragment=Oj;function Dj(t){return encodeURIComponent(f_(t))}Oe.escapeFragment=Dj;function f_(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Oe.escapeJsonPointer=f_;function EI(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Oe.unescapeJsonPointer=EI;function Mj(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Oe.eachItem=Mj;function SI({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof st.Name?(a instanceof st.Name?t(i,a,o):e(i,a,o),o):a instanceof st.Name?(e(i,o,a),a):r(a,o);return s===st.Name&&!(l instanceof st.Name)?n(i,l):l}}Oe.mergeEvaluated={props:SI({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,st._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,st._)`${r} || {}`).code((0,st._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,st._)`${r} || {}`),g_(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:TI}),items:SI({mergeNames:(t,e,r)=>t.if((0,st._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,st._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,st._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,st._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function TI(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,st._)`{}`);return e!==void 0&&g_(t,r,e),r}Oe.evaluatedPropsToName=TI;function g_(t,e,r){Object.keys(r).forEach(n=>t.assign((0,st._)`${e}${(0,st.getProperty)(n)}`,!0))}Oe.setEvaluated=g_;var wI={};function $j(t,e){return t.scopeValue("func",{ref:e,code:wI[e.code]||(wI[e.code]=new Ij._Code(e.code))})}Oe.useFunc=$j;var h_;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(h_||(Oe.Type=h_={}));function Lj(t,e,r){if(t instanceof st.Name){let n=e===h_.Num;return r?n?(0,st._)`"[" + ${t} + "]"`:(0,st._)`"['" + ${t} + "']"`:n?(0,st._)`"/" + ${t}`:(0,st._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,st.getProperty)(t).toString():"/"+f_(t)}Oe.getErrorPath=Lj;function CI(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Oe.checkStrictMode=CI});var Ui=P(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var gr=Ne(),zj={data:new gr.Name("data"),valCxt:new gr.Name("valCxt"),instancePath:new gr.Name("instancePath"),parentData:new gr.Name("parentData"),parentDataProperty:new gr.Name("parentDataProperty"),rootData:new gr.Name("rootData"),dynamicAnchors:new gr.Name("dynamicAnchors"),vErrors:new gr.Name("vErrors"),errors:new gr.Name("errors"),this:new gr.Name("this"),self:new gr.Name("self"),scope:new gr.Name("scope"),json:new gr.Name("json"),jsonPos:new gr.Name("jsonPos"),jsonLen:new gr.Name("jsonLen"),jsonPart:new gr.Name("jsonPart")};y_.default=zj});var su=P(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendErrors=yr.resetErrorsCount=yr.reportExtraError=yr.reportError=yr.keyword$DataError=yr.keywordError=void 0;var je=Ne(),Um=He(),Tr=Ui();yr.keywordError={message:({keyword:t})=>(0,je.str)`must pass "${t}" keyword validation`};yr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,je.str)`"${t}" keyword must be ${e} ($data)`:(0,je.str)`"${t}" keyword is invalid ($data)`};function Fj(t,e=yr.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=PI(t,e,r);n??(o||s)?II(a,l):AI(i,(0,je._)`[${l}]`)}yr.reportError=Fj;function Bj(t,e=yr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=PI(t,e,r);II(i,s),a||o||AI(n,Tr.default.vErrors)}yr.reportExtraError=Bj;function jj(t,e){t.assign(Tr.default.errors,e),t.if((0,je._)`${Tr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,je._)`${Tr.default.vErrors}.length`,e),()=>t.assign(Tr.default.vErrors,null)))}yr.resetErrorsCount=jj;function Uj({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Tr.default.errors,s=>{t.const(o,(0,je._)`${Tr.default.vErrors}[${s}]`),t.if((0,je._)`${o}.instancePath === undefined`,()=>t.assign((0,je._)`${o}.instancePath`,(0,je.strConcat)(Tr.default.instancePath,a.errorPath))),t.assign((0,je._)`${o}.schemaPath`,(0,je.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,je._)`${o}.schema`,r),t.assign((0,je._)`${o}.data`,n))})}yr.extendErrors=Uj;function II(t,e){let r=t.const("err",e);t.if((0,je._)`${Tr.default.vErrors} === null`,()=>t.assign(Tr.default.vErrors,(0,je._)`[${r}]`),(0,je._)`${Tr.default.vErrors}.push(${r})`),t.code((0,je._)`${Tr.default.errors}++`)}function AI(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,je._)`new ${t.ValidationError}(${e})`):(r.assign((0,je._)`${n}.errors`,e),r.return(!1))}var go={keyword:new je.Name("keyword"),schemaPath:new je.Name("schemaPath"),params:new je.Name("params"),propertyName:new je.Name("propertyName"),message:new je.Name("message"),schema:new je.Name("schema"),parentSchema:new je.Name("parentSchema")};function PI(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,je._)`{}`:Gj(t,e,r)}function Gj(t,e,r={}){let{gen:n,it:i}=t,a=[Vj(i,r),Hj(t,r)];return qj(t,e,a),n.object(...a)}function Vj({errorPath:t},{instancePath:e}){let r=e?(0,je.str)`${t}${(0,Um.getErrorPath)(e,Um.Type.Str)}`:t;return[Tr.default.instancePath,(0,je.strConcat)(Tr.default.instancePath,r)]}function Hj({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,je.str)`${e}/${t}`;return r&&(i=(0,je.str)`${i}${(0,Um.getErrorPath)(r,Um.Type.Str)}`),[go.schemaPath,i]}function qj(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([go.keyword,i],[go.params,typeof e=="function"?e(t):e||(0,je._)`{}`]),l.messages&&n.push([go.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([go.schema,o],[go.parentSchema,(0,je._)`${u}${d}`],[Tr.default.data,a]),c&&n.push([go.propertyName,c])}});var NI=P(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.boolOrEmptySchema=tl.topBoolOrEmptySchema=void 0;var Wj=su(),Zj=Ne(),Kj=Ui(),Jj={message:"boolean schema is false"};function Xj(t){let{gen:e,schema:r,validateName:n}=t;r===!1?RI(t,!1):typeof r=="object"&&r.$async===!0?e.return(Kj.default.data):(e.assign((0,Zj._)`${n}.errors`,null),e.return(!0))}tl.topBoolOrEmptySchema=Xj;function Yj(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),RI(t)):r.var(e,!0)}tl.boolOrEmptySchema=Yj;function RI(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Wj.reportError)(i,Jj,void 0,e)}});var b_=P(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.getRules=rl.isJSONType=void 0;var Qj=["string","number","integer","boolean","null","object","array"],eU=new Set(Qj);function tU(t){return typeof t=="string"&&eU.has(t)}rl.isJSONType=tU;function rU(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}rl.getRules=rU});var v_=P(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.shouldUseRule=ka.shouldUseGroup=ka.schemaHasRulesForType=void 0;function nU({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&OI(t,n)}ka.schemaHasRulesForType=nU;function OI(t,e){return e.rules.some(r=>DI(t,r))}ka.shouldUseGroup=OI;function DI(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ka.shouldUseRule=DI});var lu=P(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.reportTypeError=br.checkDataTypes=br.checkDataType=br.coerceAndCheckDataType=br.getJSONTypes=br.getSchemaTypes=br.DataType=void 0;var iU=b_(),aU=v_(),oU=su(),ke=Ne(),MI=He(),nl;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(nl||(br.DataType=nl={}));function sU(t){let e=$I(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}br.getSchemaTypes=sU;function $I(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(iU.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}br.getJSONTypes=$I;function lU(t,e){let{gen:r,data:n,opts:i}=t,a=cU(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,aU.schemaHasRulesForType)(t,e[0]));if(o){let s=S_(e,n,i.strictNumbers,nl.Wrong);r.if(s,()=>{a.length?uU(t,e,a):w_(t)})}return o}br.coerceAndCheckDataType=lU;var LI=new Set(["string","number","integer","boolean","null"]);function cU(t,e){return e?t.filter(r=>LI.has(r)||e==="array"&&r==="array"):[]}function uU(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,ke._)`typeof ${i}`),s=n.let("coerced",(0,ke._)`undefined`);a.coerceTypes==="array"&&n.if((0,ke._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ke._)`${i}[0]`).assign(o,(0,ke._)`typeof ${i}`).if(S_(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,ke._)`${s} !== undefined`);for(let c of r)(LI.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),w_(t),n.endIf(),n.if((0,ke._)`${s} !== undefined`,()=>{n.assign(i,s),dU(t,s)});function l(c){switch(c){case"string":n.elseIf((0,ke._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,ke._)`"" + ${i}`).elseIf((0,ke._)`${i} === null`).assign(s,(0,ke._)`""`);return;case"number":n.elseIf((0,ke._)`${o} == "boolean" || ${i} === null
|
|
3
3
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,ke._)`+${i}`);return;case"integer":n.elseIf((0,ke._)`${o} === "boolean" || ${i} === null
|
|
4
4
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,ke._)`+${i}`);return;case"boolean":n.elseIf((0,ke._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,ke._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,ke._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,ke._)`${o} === "string" || ${o} === "number"
|
|
5
|
-
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,ke._)`[${i}]`)}}}function uU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ke._)`${e} !== undefined`,()=>t.assign((0,ke._)`${e}[${r}]`,n))}function u_(t,e,r,n=rl.Correct){let i=n===rl.Correct?ke.operators.EQ:ke.operators.NEQ,a;switch(t){case"null":return(0,ke._)`${e} ${i} null`;case"array":a=(0,ke._)`Array.isArray(${e})`;break;case"object":a=(0,ke._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,ke._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,ke._)`typeof ${e} ${i} ${t}`}return n===rl.Correct?a:(0,ke.not)(a);function o(s=ke.nil){return(0,ke.and)((0,ke._)`typeof ${e} == "number"`,s,r?(0,ke._)`isFinite(${e})`:ke.nil)}}br.checkDataType=u_;function d_(t,e,r,n){if(t.length===1)return u_(t[0],e,r,n);let i,a=(0,DI.toHash)(t);if(a.array&&a.object){let o=(0,ke._)`typeof ${e} != "object"`;i=a.null?o:(0,ke._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=ke.nil;a.number&&delete a.integer;for(let o in a)i=(0,ke.and)(i,u_(o,e,r,n));return i}br.checkDataTypes=d_;var dU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ke._)`{type: ${t}}`:(0,ke._)`{type: ${e}}`};function p_(t){let e=pU(t);(0,aU.reportError)(e,dU)}br.reportTypeError=p_;function pU(t){let{gen:e,data:r,schema:n}=t,i=(0,DI.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var zI=P(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.assignDefaults=void 0;var nl=Ne(),mU=He();function hU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)LI(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>LI(t,a,i.default))}jm.assignDefaults=hU;function LI(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,nl._)`${a}${(0,nl.getProperty)(e)}`;if(i){(0,mU.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,nl._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,nl._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,nl._)`${s} = ${(0,nl.stringify)(r)}`)}});var Sn=P(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.validateUnion=it.validateArray=it.usePattern=it.callValidateCode=it.schemaProperties=it.allSchemaProperties=it.noPropertyInData=it.propertyInData=it.isOwnProperty=it.hasPropFunc=it.reportMissingProp=it.checkMissingProp=it.checkReportMissingProp=void 0;var gt=Ne(),m_=He(),xa=Ui(),fU=He();function gU(t,e){let{gen:r,data:n,it:i}=t;r.if(f_(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,gt._)`${e}`},!0),t.error()})}it.checkReportMissingProp=gU;function yU({gen:t,data:e,it:{opts:r}},n,i){return(0,gt.or)(...n.map(a=>(0,gt.and)(f_(t,e,a,r.ownProperties),(0,gt._)`${i} = ${a}`)))}it.checkMissingProp=yU;function bU(t,e){t.setParams({missingProperty:e},!0),t.error()}it.reportMissingProp=bU;function FI(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,gt._)`Object.prototype.hasOwnProperty`})}it.hasPropFunc=FI;function h_(t,e,r){return(0,gt._)`${FI(t)}.call(${e}, ${r})`}it.isOwnProperty=h_;function vU(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} !== undefined`;return n?(0,gt._)`${i} && ${h_(t,e,r)}`:i}it.propertyInData=vU;function f_(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} === undefined`;return n?(0,gt.or)(i,(0,gt.not)(h_(t,e,r))):i}it.noPropertyInData=f_;function BI(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}it.allSchemaProperties=BI;function _U(t,e){return BI(e).filter(r=>!(0,m_.alwaysValidSchema)(t,e[r]))}it.schemaProperties=_U;function SU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,gt._)`${t}, ${e}, ${n}${i}`:e,d=[[xa.default.instancePath,(0,gt.strConcat)(xa.default.instancePath,a)],[xa.default.parentData,o.parentData],[xa.default.parentDataProperty,o.parentDataProperty],[xa.default.rootData,xa.default.rootData]];o.opts.dynamicRef&&d.push([xa.default.dynamicAnchors,xa.default.dynamicAnchors]);let m=(0,gt._)`${u}, ${r.object(...d)}`;return l!==gt.nil?(0,gt._)`${s}.call(${l}, ${m})`:(0,gt._)`${s}(${m})`}it.callValidateCode=SU;var wU=(0,gt._)`new RegExp`;function kU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,gt._)`${i.code==="new RegExp"?wU:(0,fU.useFunc)(t,i)}(${r}, ${n})`})}it.usePattern=kU;function xU(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,gt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:m_.Type.Num},a),e.if((0,gt.not)(a),s)})}}it.validateArray=xU;function EU(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,m_.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,gt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,gt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}it.validateUnion=EU});var GI=P(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateKeywordUsage=si.validSchemaType=si.funcKeywordCode=si.macroKeywordCode=void 0;var Cr=Ne(),yo=Ui(),TU=Sn(),CU=iu();function IU(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=UI(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Cr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}si.macroKeywordCode=IU;function AU(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;RU(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=UI(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&jI(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&jI(t),y(()=>PU(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Cr._)`await `),S=>n.assign(d,!1).if((0,Cr._)`${S} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Cr._)`${S}.errors`),()=>n.throw(S))),g}function h(){let g=(0,Cr._)`${u}.errors`;return n.assign(g,null),f(Cr.nil),g}function f(g=e.async?(0,Cr._)`await `:Cr.nil){let S=l.opts.passContext?yo.default.this:yo.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Cr._)`${g}${(0,TU.callValidateCode)(t,u,S,v)}`,e.modifying)}function y(g){var S;n.if((0,Cr.not)((S=e.valid)!==null&&S!==void 0?S:d),g)}}si.funcKeywordCode=AU;function jI(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Cr._)`${n.parentData}[${n.parentDataProperty}]`))}function PU(t,e){let{gen:r}=t;r.if((0,Cr._)`Array.isArray(${e})`,()=>{r.assign(yo.default.vErrors,(0,Cr._)`${yo.default.vErrors} === null ? ${e} : ${yo.default.vErrors}.concat(${e})`).assign(yo.default.errors,(0,Cr._)`${yo.default.vErrors}.length`),(0,CU.extendErrors)(t)},()=>t.error())}function RU({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function UI(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Cr.stringify)(r)})}function NU(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}si.validSchemaType=NU;function OU({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}si.validateKeywordUsage=OU});var HI=P(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.extendSubschemaMode=Ea.extendSubschemaData=Ea.getSubschema=void 0;var li=Ne(),VI=He();function DU(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}${(0,li.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,VI.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Ea.getSubschema=DU;function MU(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,li._)`${e.data}${(0,li.getProperty)(r)}`,!0);l(m),t.errorPath=(0,li.str)`${c}${(0,VI.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,li._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof li.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Ea.extendSubschemaData=MU;function $U(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Ea.extendSubschemaMode=$U});var ou=P((wce,qI)=>{"use strict";qI.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var g_=P((kce,WI)=>{"use strict";var Ta=WI.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Um(e,n,i,t,"",t)};Ta.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ta.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ta.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ta.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 Um(t,e,r,n,i,a,o,s,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,a,o,s,l,c);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Ta.arrayKeywords)for(var m=0;m<d.length;m++)Um(t,e,r,d[m],i+"/"+u+"/"+m,a,i,u,n,m)}else if(u in Ta.propsKeywords){if(d&&typeof d=="object")for(var p in d)Um(t,e,r,d[p],i+"/"+u+"/"+LU(p),a,i,u,n,p)}else(u in Ta.keywords||t.allKeys&&!(u in Ta.skipKeywords))&&Um(t,e,r,d,i+"/"+u,a,i,u,n)}r(n,i,a,o,s,l,c)}}function LU(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var su=P(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getSchemaRefs=Ur.resolveUrl=Ur.normalizeId=Ur._getFullPath=Ur.getFullPath=Ur.inlineRef=void 0;var zU=He(),FU=ou(),BU=g_(),jU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function UU(t,e=!0){return typeof t=="boolean"?!0:e===!0?!y_(t):e?ZI(t)<=e:!1}Ur.inlineRef=UU;var GU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function y_(t){for(let e in t){if(GU.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(y_)||typeof r=="object"&&y_(r))return!0}return!1}function ZI(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!jU.has(r)&&(typeof t[r]=="object"&&(0,zU.eachItem)(t[r],n=>e+=ZI(n)),e===1/0))return 1/0}return e}function KI(t,e="",r){r!==!1&&(e=il(e));let n=t.parse(e);return JI(t,n)}Ur.getFullPath=KI;function JI(t,e){return t.serialize(e).split("#")[0]+"#"}Ur._getFullPath=JI;var VU=/#\/?$/;function il(t){return t?t.replace(VU,""):""}Ur.normalizeId=il;function HU(t,e,r){return r=il(r),t.resolve(e,r)}Ur.resolveUrl=HU;var qU=/^[a-z_][-a-z0-9._]*$/i;function WU(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=il(t[r]||e),a={"":i},o=KI(n,i,!1),s={},l=new Set;return BU(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=il(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==il(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function S(v){if(typeof v=="string"){if(!qU.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!FU(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ur.getSchemaRefs=WU});var uu=P(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.getData=Ca.KeywordCxt=Ca.validateFunctionCode=void 0;var tA=RI(),XI=au(),v_=c_(),Gm=au(),ZU=zI(),cu=GI(),b_=HI(),re=Ne(),fe=Ui(),KU=su(),Gi=He(),lu=iu();function JU(t){if(iA(t)&&(aA(t),nA(t))){QU(t);return}rA(t,()=>(0,tA.topBoolOrEmptySchema)(t))}Ca.validateFunctionCode=JU;function rA({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,re._)`${fe.default.data}, ${fe.default.valCxt}`,n.$async,()=>{t.code((0,re._)`"use strict"; ${YI(r,i)}`),YU(t,i),t.code(a)}):t.func(e,(0,re._)`${fe.default.data}, ${XU(i)}`,n.$async,()=>t.code(YI(r,i)).code(a))}function XU(t){return(0,re._)`{${fe.default.instancePath}="", ${fe.default.parentData}, ${fe.default.parentDataProperty}, ${fe.default.rootData}=${fe.default.data}${t.dynamicRef?(0,re._)`, ${fe.default.dynamicAnchors}={}`:re.nil}}={}`}function YU(t,e){t.if(fe.default.valCxt,()=>{t.var(fe.default.instancePath,(0,re._)`${fe.default.valCxt}.${fe.default.instancePath}`),t.var(fe.default.parentData,(0,re._)`${fe.default.valCxt}.${fe.default.parentData}`),t.var(fe.default.parentDataProperty,(0,re._)`${fe.default.valCxt}.${fe.default.parentDataProperty}`),t.var(fe.default.rootData,(0,re._)`${fe.default.valCxt}.${fe.default.rootData}`),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`${fe.default.valCxt}.${fe.default.dynamicAnchors}`)},()=>{t.var(fe.default.instancePath,(0,re._)`""`),t.var(fe.default.parentData,(0,re._)`undefined`),t.var(fe.default.parentDataProperty,(0,re._)`undefined`),t.var(fe.default.rootData,fe.default.data),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`{}`)})}function QU(t){let{schema:e,opts:r,gen:n}=t;rA(t,()=>{r.$comment&&e.$comment&&sA(t),i4(t),n.let(fe.default.vErrors,null),n.let(fe.default.errors,0),r.unevaluated&&e4(t),oA(t),s4(t)})}function e4(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,re._)`${r}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function YI(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${r} */`:re.nil}function t4(t,e){if(iA(t)&&(aA(t),nA(t))){r4(t,e);return}(0,tA.boolOrEmptySchema)(t,e)}function nA({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function iA(t){return typeof t.schema!="boolean"}function r4(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&sA(t),a4(t),o4(t);let a=n.const("_errs",fe.default.errors);oA(t,a),n.var(e,(0,re._)`${a} === ${fe.default.errors}`)}function aA(t){(0,Gi.checkUnknownRules)(t),n4(t)}function oA(t,e){if(t.opts.jtd)return QI(t,[],!1,e);let r=(0,XI.getSchemaTypes)(t.schema),n=(0,XI.coerceAndCheckDataType)(t,r);QI(t,r,!n,e)}function n4(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Gi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function i4(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Gi.checkStrictMode)(t,"default is ignored in the schema root")}function a4(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,KU.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function o4(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function sA({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,re._)`${fe.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,re.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${fe.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function s4(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,re._)`${fe.default.errors} === 0`,()=>e.return(fe.default.data),()=>e.throw((0,re._)`new ${i}(${fe.default.vErrors})`)):(e.assign((0,re._)`${n}.errors`,fe.default.vErrors),a.unevaluated&&l4(t),e.return((0,re._)`${fe.default.errors} === 0`))}function l4({gen:t,evaluated:e,props:r,items:n}){r instanceof re.Name&&t.assign((0,re._)`${e}.props`,r),n instanceof re.Name&&t.assign((0,re._)`${e}.items`,n)}function QI(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Gi.schemaHasRulesButRef)(a,u))){i.block(()=>cA(t,"$ref",u.all.$ref.definition));return}l.jtd||c4(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,v_.shouldUseGroup)(a,m)&&(m.type?(i.if((0,Gm.checkDataType)(m.type,o,l.strictNumbers)),eA(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,Gm.reportTypeError)(t)),i.endIf()):eA(t,m),s||i.if((0,re._)`${fe.default.errors} === ${n||0}`))}}function eA(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,ZU.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,v_.shouldUseRule)(n,a)&&cA(t,a.keyword,a.definition,e.type)})}function c4(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(u4(t,e),t.opts.allowUnionTypes||d4(t,e),p4(t,t.dataTypes))}function u4(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{lA(t.dataTypes,r)||__(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),h4(t,e)}}function d4(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&__(t,"use allowUnionTypes to allow union type keyword")}function p4(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,v_.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>m4(e,o))&&__(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function m4(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function lA(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function h4(t,e){let r=[];for(let n of t.dataTypes)lA(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function __(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Gi.checkStrictMode)(t,e,t.opts.strictTypes)}var Vm=class{constructor(e,r,n){if((0,cu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",uA(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,cu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",fe.default.errors))}result(e,r,n){this.failResult((0,re.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,re.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,re._)`${r} !== undefined && (${(0,re.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?lu.reportExtraError:lu.reportError)(this,this.def.error,r)}$dataError(){(0,lu.reportError)(this,this.def.$dataError||lu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,lu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=re.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=re.nil,r=re.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,re.or)((0,re._)`${i} === undefined`,r)),e!==re.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,re.or)(o(),s());function o(){if(n.length){if(!(r instanceof re.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,re._)`${(0,Gm.checkDataTypes)(l,r,a.opts.strictNumbers,Gm.DataType.Wrong)}`}return re.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,re._)`!${l}(${r})`}return re.nil}}subschema(e,r){let n=(0,b_.getSubschema)(this.it,e);(0,b_.extendSubschemaData)(n,this.it,e),(0,b_.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return t4(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Gi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Gi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,re.Name)),!0}};Ca.KeywordCxt=Vm;function cA(t,e,r,n){let i=new Vm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,cu.funcKeywordCode)(i,r):"macro"in r?(0,cu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,cu.funcKeywordCode)(i,r)}var f4=/^\/(?:[^~]|~0|~1)*$/,g4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function uA(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return fe.default.rootData;if(t[0]==="/"){if(!f4.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=fe.default.rootData}else{let c=g4.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,re._)`${a}${(0,re.getProperty)((0,Gi.unescapeJsonPointer)(c))}`,o=(0,re._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Ca.getData=uA});var Hm=P(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var S_=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};w_.default=S_});var du=P(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var k_=su(),x_=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,k_.resolveUrl)(e,r,n),this.missingSchema=(0,k_.normalizeId)((0,k_.getFullPath)(e,this.missingRef))}};E_.default=x_});var Wm=P(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;var jn=Ne(),y4=Hm(),bo=Ui(),Un=su(),dA=He(),b4=uu(),al=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Un.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};wn.SchemaEnv=al;function C_(t){let e=pA.call(this,t);if(e)return e;let r=(0,Un.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new jn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:y4.default,code:(0,jn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[jn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,jn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:jn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,jn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,b4.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(bo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${bo.default.self}`,`${bo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof jn.Name?void 0:h,items:f instanceof jn.Name?void 0:f,dynamicProps:h instanceof jn.Name,dynamicItems:f instanceof jn.Name},p.source&&(p.source.evaluated=(0,jn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}wn.compileSchema=C_;function v4(t,e,r){var n;r=(0,Un.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=w4.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new al({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=_4.call(this,a)}wn.resolveRef=v4;function _4(t){return(0,Un.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:C_.call(this,t)}function pA(t){for(let e of this._compilations)if(S4(e,t))return e}wn.getCompilingSchema=pA;function S4(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function w4(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||qm.call(this,t,e)}function qm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Un._getFullPath)(this.opts.uriResolver,r),i=(0,Un.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return T_.call(this,r,t);let a=(0,Un.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=qm.call(this,t,o);return typeof s?.schema!="object"?void 0:T_.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||C_.call(this,o),a===(0,Un.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,Un.resolveUrl)(this.opts.uriResolver,i,c)),new al({schema:s,schemaId:l,root:t,baseId:i})}return T_.call(this,r,o)}}wn.resolveSchema=qm;var k4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function T_(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,dA.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!k4.has(s)&&c&&(e=(0,Un.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,dA.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Un.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=qm.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new al({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var mA=P((Ace,x4)=>{x4.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 A_=P((Pce,yA)=>{"use strict";var E4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),fA=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function I_(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var T4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hA(t){return t.length=0,!0}function C4(t,e,r){if(t.length){let n=I_(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function I4(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],a=!1,o=!1,s=C4;for(let l=0;l<t.length;l++){let c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(a===!0&&(o=!0),!s(i,n,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(a=!0),n.push(":");continue}else if(c==="%"){if(!s(i,n,r))break;s=hA}else{i.push(c);continue}}return i.length&&(s===hA?r.zone=i.join(""):o?n.push(i.join("")):n.push(I_(i))),r.address=n.join(""),r}function gA(t){if(A4(t,":")<2)return{host:t,isIPV6:!1};let e=I4(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function A4(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function P4(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function R4(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function N4(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!fA(r)){let n=gA(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}yA.exports={nonSimpleDomain:T4,recomposeAuthority:N4,normalizeComponentEncoding:R4,removeDotSegments:P4,isIPv4:fA,isUUID:E4,normalizeIPv6:gA,stringArrayToHexStripped:I_}});var wA=P((Rce,SA)=>{"use strict";var{isUUID:O4}=A_(),D4=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,M4=["http","https","ws","wss","urn","urn:uuid"];function $4(t){return M4.indexOf(t)!==-1}function P_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function bA(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function vA(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function L4(t){return t.secure=P_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function z4(t){if((t.port===(P_(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function F4(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(D4);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,a=R_(i);t.path=void 0,a&&(t=a.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function B4(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,a=R_(i);a&&(t=a.serialize(t,e));let o=t,s=t.nss;return o.path=`${n||e.nid}:${s}`,e.skipEscape=!0,o}function j4(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!O4(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function U4(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var _A={scheme:"http",domainHost:!0,parse:bA,serialize:vA},G4={scheme:"https",domainHost:_A.domainHost,parse:bA,serialize:vA},Zm={scheme:"ws",domainHost:!0,parse:L4,serialize:z4},V4={scheme:"wss",domainHost:Zm.domainHost,parse:Zm.parse,serialize:Zm.serialize},H4={scheme:"urn",parse:F4,serialize:B4,skipNormalize:!0},q4={scheme:"urn:uuid",parse:j4,serialize:U4,skipNormalize:!0},Km={http:_A,https:G4,ws:Zm,wss:V4,urn:H4,"urn:uuid":q4};Object.setPrototypeOf(Km,null);function R_(t){return t&&(Km[t]||Km[t.toLowerCase()])||void 0}SA.exports={wsIsSecure:P_,SCHEMES:Km,isValidSchemeName:$4,getSchemeHandler:R_}});var EA=P((Nce,Xm)=>{"use strict";var{normalizeIPv6:W4,removeDotSegments:pu,recomposeAuthority:Z4,normalizeComponentEncoding:Jm,isIPv4:K4,nonSimpleDomain:J4}=A_(),{SCHEMES:X4,getSchemeHandler:kA}=wA();function Y4(t,e){return typeof t=="string"?t=ci(Vi(t,e),e):typeof t=="object"&&(t=Vi(ci(t,e),e)),t}function Q4(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=xA(Vi(t,n),Vi(e,n),n,!0);return n.skipEscape=!0,ci(i,n)}function xA(t,e,r,n){let i={};return n||(t=Vi(ci(t,r),r),e=Vi(ci(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=pu(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=pu(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=pu(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=pu(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function eG(t,e,r){return typeof t=="string"?(t=unescape(t),t=ci(Jm(Vi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=ci(Jm(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=ci(Jm(Vi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=ci(Jm(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function ci(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],a=kA(n.scheme||r.scheme);a&&a.serialize&&a.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=Z4(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!a||!a.absolutePath)&&(s=pu(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var tG=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Vi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let a=t.match(tG);if(a){if(n.scheme=a[1],n.userinfo=a[3],n.host=a[4],n.port=parseInt(a[5],10),n.path=a[6]||"",n.query=a[7],n.fragment=a[8],isNaN(n.port)&&(n.port=a[5]),n.host)if(K4(n.host)===!1){let l=W4(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let o=kA(r.scheme||n.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&n.host&&(r.domainHost||o&&o.domainHost)&&i===!1&&J4(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!o||o&&!o.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),o&&o.parse&&o.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var N_={SCHEMES:X4,normalize:Y4,resolve:Q4,resolveComponent:xA,equal:eG,serialize:ci,parse:Vi};Xm.exports=N_;Xm.exports.default=N_;Xm.exports.fastUri=N_});var CA=P(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var TA=EA();TA.code='require("ajv/dist/runtime/uri").default';O_.default=TA});var MA=P(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.CodeGen=nr.Name=nr.nil=nr.stringify=nr.str=nr._=nr.KeywordCxt=void 0;var rG=uu();Object.defineProperty(nr,"KeywordCxt",{enumerable:!0,get:function(){return rG.KeywordCxt}});var ol=Ne();Object.defineProperty(nr,"_",{enumerable:!0,get:function(){return ol._}});Object.defineProperty(nr,"str",{enumerable:!0,get:function(){return ol.str}});Object.defineProperty(nr,"stringify",{enumerable:!0,get:function(){return ol.stringify}});Object.defineProperty(nr,"nil",{enumerable:!0,get:function(){return ol.nil}});Object.defineProperty(nr,"Name",{enumerable:!0,get:function(){return ol.Name}});Object.defineProperty(nr,"CodeGen",{enumerable:!0,get:function(){return ol.CodeGen}});var nG=Hm(),NA=du(),iG=l_(),mu=Wm(),aG=Ne(),hu=su(),Ym=au(),M_=He(),IA=mA(),oG=CA(),OA=(t,e)=>new RegExp(t,e);OA.code="new RegExp";var sG=["removeAdditional","useDefaults","coerceTypes"],lG=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),cG={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."},uG={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},AA=200;function dG(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,S,v,I,T,C,$,W,M;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:OA,Z=(i=t.uriResolver)!==null&&i!==void 0?i:oG.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:AA,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:AA,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(S=t.messages)!==null&&S!==void 0?S:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:($=t.validateFormats)!==null&&$!==void 0?$:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:(M=t.int32range)!==null&&M!==void 0?M:!0,uriResolver:Z}}var fu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...dG(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new aG.ValueScope({scope:{},prefixes:lG,es5:r,lines:n}),this.logger=yG(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,iG.getRules)(),PA.call(this,cG,e,"NOT SUPPORTED"),PA.call(this,uG,e,"DEPRECATED","warn"),this._metaOpts=fG.call(this),e.formats&&mG.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&hG.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),pG.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=IA;n==="id"&&(i={...IA},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof NA.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,hu.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=RA.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new mu.SchemaEnv({schema:{},schemaId:n});if(r=mu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=RA.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,hu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(vG.call(this,n,r),!r)return(0,M_.eachItem)(n,a=>D_.call(this,a)),this;SG.call(this,r);let i={...r,type:(0,Ym.getJSONTypes)(r.type),schemaType:(0,Ym.getJSONTypes)(r.schemaType)};return(0,M_.eachItem)(n,i.type.length===0?a=>D_.call(this,a,i):a=>i.type.forEach(o=>D_.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=DA(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,hu.normalizeId)(o||n);let c=hu.getSchemaRefs.call(this,e,n);return l=new mu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):mu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{mu.compileSchema.call(this,e)}finally{this.opts=r}}};fu.ValidationError=nG.default;fu.MissingRefError=NA.default;nr.default=fu;function PA(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function RA(t){return t=(0,hu.normalizeId)(t),this.schemas[t]||this.refs[t]}function pG(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function mG(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function hG(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function fG(){let t={...this.opts};for(let e of sG)delete t[e];return t}var gG={log(){},warn(){},error(){}};function yG(t){if(t===!1)return gG;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var bG=/^[a-z_$][a-z0-9_$:-]*$/i;function vG(t,e){let{RULES:r}=this;if((0,M_.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!bG.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function D_(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Ym.getJSONTypes)(e.type),schemaType:(0,Ym.getJSONTypes)(e.schemaType)}};e.before?_G.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function _G(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function SG(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=DA(e)),t.validateSchema=this.compile(e,!0))}var wG={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function DA(t){return{anyOf:[t,wG]}}});var $A=P($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var kG={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$_.default=kG});var BA=P(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.callRef=vo.getValidate=void 0;var xG=du(),LA=Sn(),Gr=Ne(),sl=Ui(),zA=Wm(),Qm=He(),EG={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=zA.resolveRef.call(l,c,i,r);if(u===void 0)throw new xG.default(n.opts.uriResolver,i,r);if(u instanceof zA.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return eh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return eh(t,(0,Gr._)`${h}.validate`,c,c.$async)}function m(h){let f=FA(t,h);eh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Gr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:Gr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function FA(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Gr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}vo.getValidate=FA;function eh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?sl.default.this:Gr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Gr._)`await ${(0,LA.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,Gr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,LA.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,Gr._)`${h}.errors`;i.assign(sl.default.vErrors,(0,Gr._)`${sl.default.vErrors} === null ? ${f} : ${sl.default.vErrors}.concat(${f})`),i.assign(sl.default.errors,(0,Gr._)`${sl.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=Qm.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,Gr._)`${h}.evaluated.props`);a.props=Qm.mergeEvaluated.props(i,g,a.props,Gr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=Qm.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,Gr._)`${h}.evaluated.items`);a.items=Qm.mergeEvaluated.items(i,g,a.items,Gr.Name)}}}vo.callRef=eh;vo.default=EG});var jA=P(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var TG=$A(),CG=BA(),IG=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",TG.default,CG.default];L_.default=IG});var UA=P(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var th=Ne(),Ia=th.operators,rh={maximum:{okStr:"<=",ok:Ia.LTE,fail:Ia.GT},minimum:{okStr:">=",ok:Ia.GTE,fail:Ia.LT},exclusiveMaximum:{okStr:"<",ok:Ia.LT,fail:Ia.GTE},exclusiveMinimum:{okStr:">",ok:Ia.GT,fail:Ia.LTE}},AG={message:({keyword:t,schemaCode:e})=>(0,th.str)`must be ${rh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,th._)`{comparison: ${rh[t].okStr}, limit: ${e}}`},PG={keyword:Object.keys(rh),type:"number",schemaType:"number",$data:!0,error:AG,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,th._)`${r} ${rh[e].fail} ${n} || isNaN(${r})`)}};z_.default=PG});var GA=P(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var gu=Ne(),RG={message:({schemaCode:t})=>(0,gu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,gu._)`{multipleOf: ${t}}`},NG={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:RG,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,gu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,gu._)`${o} !== parseInt(${o})`;t.fail$data((0,gu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};F_.default=NG});var HA=P(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});function VA(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}B_.default=VA;VA.code='require("ajv/dist/runtime/ucs2length").default'});var qA=P(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});var _o=Ne(),OG=He(),DG=HA(),MG={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_o.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_o._)`{limit: ${t}}`},$G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:MG,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?_o.operators.GT:_o.operators.LT,o=i.opts.unicode===!1?(0,_o._)`${r}.length`:(0,_o._)`${(0,OG.useFunc)(t.gen,DG.default)}(${r})`;t.fail$data((0,_o._)`${o} ${a} ${n}`)}};j_.default=$G});var WA=P(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});var LG=Sn(),nh=Ne(),zG={message:({schemaCode:t})=>(0,nh.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,nh._)`{pattern: ${t}}`},FG={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zG,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,nh._)`(new RegExp(${i}, ${o}))`:(0,LG.usePattern)(t,n);t.fail$data((0,nh._)`!${s}.test(${e})`)}};U_.default=FG});var ZA=P(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var yu=Ne(),BG={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,yu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,yu._)`{limit: ${t}}`},jG={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:BG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?yu.operators.GT:yu.operators.LT;t.fail$data((0,yu._)`Object.keys(${r}).length ${i} ${n}`)}};G_.default=jG});var KA=P(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});var bu=Sn(),vu=Ne(),UG=He(),GG={message:({params:{missingProperty:t}})=>(0,vu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,vu._)`{missingProperty: ${t}}`},VG={keyword:"required",type:"object",schemaType:"array",$data:!0,error:GG,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,UG.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(vu.nil,d);else for(let p of r)(0,bu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,bu.checkMissingProp)(t,r,p)),(0,bu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,bu.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,bu.propertyInData)(e,i,p,s.ownProperties)),e.if((0,vu.not)(h),()=>{t.error(),e.break()})},vu.nil)}}};V_.default=VG});var JA=P(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});var _u=Ne(),HG={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,_u.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,_u._)`{limit: ${t}}`},qG={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:HG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?_u.operators.GT:_u.operators.LT;t.fail$data((0,_u._)`${r}.length ${i} ${n}`)}};H_.default=qG});var ih=P(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var XA=ou();XA.code='require("ajv/dist/runtime/equal").default';q_.default=XA});var YA=P(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var W_=au(),ir=Ne(),WG=He(),ZG=ih(),KG={message:({params:{i:t,j:e}})=>(0,ir.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ir._)`{i: ${t}, j: ${e}}`},JG={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:KG,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,W_.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,ir._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,ir._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,ir._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,W_.checkDataTypes)(c,y,s.opts.strictNumbers,W_.DataType.Wrong),S=e.const("indices",(0,ir._)`{}`);e.for((0,ir._)`;${h}--;`,()=>{e.let(y,(0,ir._)`${r}[${h}]`),e.if(g,(0,ir._)`continue`),c.length>1&&e.if((0,ir._)`typeof ${y} == "string"`,(0,ir._)`${y} += "_"`),e.if((0,ir._)`typeof ${S}[${y}] == "number"`,()=>{e.assign(f,(0,ir._)`${S}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,ir._)`${S}[${y}] = ${h}`)})}function p(h,f){let y=(0,WG.useFunc)(e,ZG.default),g=e.name("outer");e.label(g).for((0,ir._)`;${h}--;`,()=>e.for((0,ir._)`${f} = ${h}; ${f}--;`,()=>e.if((0,ir._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};Z_.default=JG});var QA=P(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});var K_=Ne(),XG=He(),YG=ih(),QG={message:"must be equal to constant",params:({schemaCode:t})=>(0,K_._)`{allowedValue: ${t}}`},eV={keyword:"const",$data:!0,error:QG,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,K_._)`!${(0,XG.useFunc)(e,YG.default)}(${r}, ${i})`):t.fail((0,K_._)`${a} !== ${r}`)}};J_.default=eV});var eP=P(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});var Su=Ne(),tV=He(),rV=ih(),nV={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Su._)`{allowedValues: ${t}}`},iV={keyword:"enum",schemaType:"array",$data:!0,error:nV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,tV.useFunc)(e,rV.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,Su.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,Su._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,Su._)`${c()}(${r}, ${p}[${h}])`:(0,Su._)`${r} === ${f}`}}};X_.default=iV});var tP=P(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var aV=UA(),oV=GA(),sV=qA(),lV=WA(),cV=ZA(),uV=KA(),dV=JA(),pV=YA(),mV=QA(),hV=eP(),fV=[aV.default,oV.default,sV.default,lV.default,cV.default,uV.default,dV.default,pV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},mV.default,hV.default];Y_.default=fV});var eS=P(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.validateAdditionalItems=void 0;var So=Ne(),Q_=He(),gV={message:({params:{len:t}})=>(0,So.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,So._)`{limit: ${t}}`},yV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:gV,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Q_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}rP(t,n)}};function rP(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,So._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,So._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Q_.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,So._)`${s} <= ${e.length}`);r.if((0,So.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:Q_.Type.Num},c),o.allErrors||r.if((0,So.not)(c),()=>r.break())})}}wu.validateAdditionalItems=rP;wu.default=yV});var tS=P(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.validateTuple=void 0;var nP=Ne(),ah=He(),bV=Sn(),vV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return iP(t,"additionalItems",e);r.items=!0,!(0,ah.alwaysValidSchema)(r,e)&&t.ok((0,bV.validateArray)(t))}};function iP(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ah.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,nP._)`${a}.length`);r.forEach((d,m)=>{(0,ah.alwaysValidSchema)(s,d)||(n.if((0,nP._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,ah.checkStrictMode)(s,y,m.strictTuples)}}}ku.validateTuple=iP;ku.default=vV});var aP=P(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var _V=tS(),SV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,_V.validateTuple)(t,"items")};rS.default=SV});var sP=P(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var oP=Ne(),wV=He(),kV=Sn(),xV=eS(),EV={message:({params:{len:t}})=>(0,oP.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,oP._)`{limit: ${t}}`},TV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:EV,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,wV.alwaysValidSchema)(n,e)&&(i?(0,xV.validateAdditionalItems)(t,i):t.ok((0,kV.validateArray)(t)))}};nS.default=TV});var lP=P(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var kn=Ne(),oh=He(),CV={message:({params:{min:t,max:e}})=>e===void 0?(0,kn.str)`must contain at least ${t} valid item(s)`:(0,kn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,kn._)`{minContains: ${t}}`:(0,kn._)`{minContains: ${t}, maxContains: ${e}}`},IV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:CV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,kn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,oh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,oh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,oh.alwaysValidSchema)(a,r)){let f=(0,kn._)`${u} >= ${o}`;s!==void 0&&(f=(0,kn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,kn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:oh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,kn._)`${f}++`),s===void 0?e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,kn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};iS.default=IV});var dP=P(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.validateSchemaDeps=ui.validatePropertyDeps=ui.error=void 0;var aS=Ne(),AV=He(),xu=Sn();ui.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,aS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,aS._)`{property: ${t},
|
|
5
|
+
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,ke._)`[${i}]`)}}}function dU({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ke._)`${e} !== undefined`,()=>t.assign((0,ke._)`${e}[${r}]`,n))}function __(t,e,r,n=nl.Correct){let i=n===nl.Correct?ke.operators.EQ:ke.operators.NEQ,a;switch(t){case"null":return(0,ke._)`${e} ${i} null`;case"array":a=(0,ke._)`Array.isArray(${e})`;break;case"object":a=(0,ke._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,ke._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,ke._)`typeof ${e} ${i} ${t}`}return n===nl.Correct?a:(0,ke.not)(a);function o(s=ke.nil){return(0,ke.and)((0,ke._)`typeof ${e} == "number"`,s,r?(0,ke._)`isFinite(${e})`:ke.nil)}}br.checkDataType=__;function S_(t,e,r,n){if(t.length===1)return __(t[0],e,r,n);let i,a=(0,MI.toHash)(t);if(a.array&&a.object){let o=(0,ke._)`typeof ${e} != "object"`;i=a.null?o:(0,ke._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=ke.nil;a.number&&delete a.integer;for(let o in a)i=(0,ke.and)(i,__(o,e,r,n));return i}br.checkDataTypes=S_;var pU={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ke._)`{type: ${t}}`:(0,ke._)`{type: ${e}}`};function w_(t){let e=mU(t);(0,oU.reportError)(e,pU)}br.reportTypeError=w_;function mU(t){let{gen:e,data:r,schema:n}=t,i=(0,MI.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var FI=P(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.assignDefaults=void 0;var il=Ne(),hU=He();function fU(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)zI(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>zI(t,a,i.default))}Gm.assignDefaults=fU;function zI(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,il._)`${a}${(0,il.getProperty)(e)}`;if(i){(0,hU.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,il._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,il._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,il._)`${s} = ${(0,il.stringify)(r)}`)}});var Sn=P(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.validateUnion=it.validateArray=it.usePattern=it.callValidateCode=it.schemaProperties=it.allSchemaProperties=it.noPropertyInData=it.propertyInData=it.isOwnProperty=it.hasPropFunc=it.reportMissingProp=it.checkMissingProp=it.checkReportMissingProp=void 0;var gt=Ne(),k_=He(),xa=Ui(),gU=He();function yU(t,e){let{gen:r,data:n,it:i}=t;r.if(E_(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,gt._)`${e}`},!0),t.error()})}it.checkReportMissingProp=yU;function bU({gen:t,data:e,it:{opts:r}},n,i){return(0,gt.or)(...n.map(a=>(0,gt.and)(E_(t,e,a,r.ownProperties),(0,gt._)`${i} = ${a}`)))}it.checkMissingProp=bU;function vU(t,e){t.setParams({missingProperty:e},!0),t.error()}it.reportMissingProp=vU;function BI(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,gt._)`Object.prototype.hasOwnProperty`})}it.hasPropFunc=BI;function x_(t,e,r){return(0,gt._)`${BI(t)}.call(${e}, ${r})`}it.isOwnProperty=x_;function _U(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} !== undefined`;return n?(0,gt._)`${i} && ${x_(t,e,r)}`:i}it.propertyInData=_U;function E_(t,e,r,n){let i=(0,gt._)`${e}${(0,gt.getProperty)(r)} === undefined`;return n?(0,gt.or)(i,(0,gt.not)(x_(t,e,r))):i}it.noPropertyInData=E_;function jI(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}it.allSchemaProperties=jI;function SU(t,e){return jI(e).filter(r=>!(0,k_.alwaysValidSchema)(t,e[r]))}it.schemaProperties=SU;function wU({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,gt._)`${t}, ${e}, ${n}${i}`:e,d=[[xa.default.instancePath,(0,gt.strConcat)(xa.default.instancePath,a)],[xa.default.parentData,o.parentData],[xa.default.parentDataProperty,o.parentDataProperty],[xa.default.rootData,xa.default.rootData]];o.opts.dynamicRef&&d.push([xa.default.dynamicAnchors,xa.default.dynamicAnchors]);let m=(0,gt._)`${u}, ${r.object(...d)}`;return l!==gt.nil?(0,gt._)`${s}.call(${l}, ${m})`:(0,gt._)`${s}(${m})`}it.callValidateCode=wU;var kU=(0,gt._)`new RegExp`;function xU({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,gt._)`${i.code==="new RegExp"?kU:(0,gU.useFunc)(t,i)}(${r}, ${n})`})}it.usePattern=xU;function EU(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,gt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:k_.Type.Num},a),e.if((0,gt.not)(a),s)})}}it.validateArray=EU;function TU(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,k_.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,gt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,gt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}it.validateUnion=TU});var VI=P(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateKeywordUsage=si.validSchemaType=si.funcKeywordCode=si.macroKeywordCode=void 0;var Cr=Ne(),yo=Ui(),CU=Sn(),IU=su();function AU(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=GI(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Cr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}si.macroKeywordCode=AU;function PU(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;NU(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=GI(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&UI(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&UI(t),y(()=>RU(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Cr._)`await `),x=>n.assign(d,!1).if((0,Cr._)`${x} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Cr._)`${x}.errors`),()=>n.throw(x))),g}function h(){let g=(0,Cr._)`${u}.errors`;return n.assign(g,null),f(Cr.nil),g}function f(g=e.async?(0,Cr._)`await `:Cr.nil){let x=l.opts.passContext?yo.default.this:yo.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Cr._)`${g}${(0,CU.callValidateCode)(t,u,x,v)}`,e.modifying)}function y(g){var x;n.if((0,Cr.not)((x=e.valid)!==null&&x!==void 0?x:d),g)}}si.funcKeywordCode=PU;function UI(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Cr._)`${n.parentData}[${n.parentDataProperty}]`))}function RU(t,e){let{gen:r}=t;r.if((0,Cr._)`Array.isArray(${e})`,()=>{r.assign(yo.default.vErrors,(0,Cr._)`${yo.default.vErrors} === null ? ${e} : ${yo.default.vErrors}.concat(${e})`).assign(yo.default.errors,(0,Cr._)`${yo.default.vErrors}.length`),(0,IU.extendErrors)(t)},()=>t.error())}function NU({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function GI(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Cr.stringify)(r)})}function OU(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}si.validSchemaType=OU;function DU({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}si.validateKeywordUsage=DU});var qI=P(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.extendSubschemaMode=Ea.extendSubschemaData=Ea.getSubschema=void 0;var li=Ne(),HI=He();function MU(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,li._)`${t.schemaPath}${(0,li.getProperty)(e)}${(0,li.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,HI.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Ea.getSubschema=MU;function $U(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,li._)`${e.data}${(0,li.getProperty)(r)}`,!0);l(m),t.errorPath=(0,li.str)`${c}${(0,HI.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,li._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof li.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Ea.extendSubschemaData=$U;function LU(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Ea.extendSubschemaMode=LU});var cu=P((kce,WI)=>{"use strict";WI.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var T_=P((xce,ZI)=>{"use strict";var Ta=ZI.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Vm(e,n,i,t,"",t)};Ta.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ta.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ta.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ta.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 Vm(t,e,r,n,i,a,o,s,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,a,o,s,l,c);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Ta.arrayKeywords)for(var m=0;m<d.length;m++)Vm(t,e,r,d[m],i+"/"+u+"/"+m,a,i,u,n,m)}else if(u in Ta.propsKeywords){if(d&&typeof d=="object")for(var p in d)Vm(t,e,r,d[p],i+"/"+u+"/"+zU(p),a,i,u,n,p)}else(u in Ta.keywords||t.allKeys&&!(u in Ta.skipKeywords))&&Vm(t,e,r,d,i+"/"+u,a,i,u,n)}r(n,i,a,o,s,l,c)}}function zU(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var uu=P(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getSchemaRefs=Ur.resolveUrl=Ur.normalizeId=Ur._getFullPath=Ur.getFullPath=Ur.inlineRef=void 0;var FU=He(),BU=cu(),jU=T_(),UU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GU(t,e=!0){return typeof t=="boolean"?!0:e===!0?!C_(t):e?KI(t)<=e:!1}Ur.inlineRef=GU;var VU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function C_(t){for(let e in t){if(VU.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(C_)||typeof r=="object"&&C_(r))return!0}return!1}function KI(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!UU.has(r)&&(typeof t[r]=="object"&&(0,FU.eachItem)(t[r],n=>e+=KI(n)),e===1/0))return 1/0}return e}function JI(t,e="",r){r!==!1&&(e=al(e));let n=t.parse(e);return XI(t,n)}Ur.getFullPath=JI;function XI(t,e){return t.serialize(e).split("#")[0]+"#"}Ur._getFullPath=XI;var HU=/#\/?$/;function al(t){return t?t.replace(HU,""):""}Ur.normalizeId=al;function qU(t,e,r){return r=al(r),t.resolve(e,r)}Ur.resolveUrl=qU;var WU=/^[a-z_][-a-z0-9._]*$/i;function ZU(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=al(t[r]||e),a={"":i},o=JI(n,i,!1),s={},l=new Set;return jU(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),x.call(this,d.$anchor),x.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=al(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==al(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function x(v){if(typeof v=="string"){if(!WU.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!BU(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ur.getSchemaRefs=ZU});var mu=P(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.getData=Ca.KeywordCxt=Ca.validateFunctionCode=void 0;var rA=NI(),YI=lu(),A_=v_(),Hm=lu(),KU=FI(),pu=VI(),I_=qI(),re=Ne(),fe=Ui(),JU=uu(),Gi=He(),du=su();function XU(t){if(aA(t)&&(oA(t),iA(t))){e4(t);return}nA(t,()=>(0,rA.topBoolOrEmptySchema)(t))}Ca.validateFunctionCode=XU;function nA({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,re._)`${fe.default.data}, ${fe.default.valCxt}`,n.$async,()=>{t.code((0,re._)`"use strict"; ${QI(r,i)}`),QU(t,i),t.code(a)}):t.func(e,(0,re._)`${fe.default.data}, ${YU(i)}`,n.$async,()=>t.code(QI(r,i)).code(a))}function YU(t){return(0,re._)`{${fe.default.instancePath}="", ${fe.default.parentData}, ${fe.default.parentDataProperty}, ${fe.default.rootData}=${fe.default.data}${t.dynamicRef?(0,re._)`, ${fe.default.dynamicAnchors}={}`:re.nil}}={}`}function QU(t,e){t.if(fe.default.valCxt,()=>{t.var(fe.default.instancePath,(0,re._)`${fe.default.valCxt}.${fe.default.instancePath}`),t.var(fe.default.parentData,(0,re._)`${fe.default.valCxt}.${fe.default.parentData}`),t.var(fe.default.parentDataProperty,(0,re._)`${fe.default.valCxt}.${fe.default.parentDataProperty}`),t.var(fe.default.rootData,(0,re._)`${fe.default.valCxt}.${fe.default.rootData}`),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`${fe.default.valCxt}.${fe.default.dynamicAnchors}`)},()=>{t.var(fe.default.instancePath,(0,re._)`""`),t.var(fe.default.parentData,(0,re._)`undefined`),t.var(fe.default.parentDataProperty,(0,re._)`undefined`),t.var(fe.default.rootData,fe.default.data),e.dynamicRef&&t.var(fe.default.dynamicAnchors,(0,re._)`{}`)})}function e4(t){let{schema:e,opts:r,gen:n}=t;nA(t,()=>{r.$comment&&e.$comment&&lA(t),a4(t),n.let(fe.default.vErrors,null),n.let(fe.default.errors,0),r.unevaluated&&t4(t),sA(t),l4(t)})}function t4(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,re._)`${r}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function QI(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${r} */`:re.nil}function r4(t,e){if(aA(t)&&(oA(t),iA(t))){n4(t,e);return}(0,rA.boolOrEmptySchema)(t,e)}function iA({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function aA(t){return typeof t.schema!="boolean"}function n4(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&lA(t),o4(t),s4(t);let a=n.const("_errs",fe.default.errors);sA(t,a),n.var(e,(0,re._)`${a} === ${fe.default.errors}`)}function oA(t){(0,Gi.checkUnknownRules)(t),i4(t)}function sA(t,e){if(t.opts.jtd)return eA(t,[],!1,e);let r=(0,YI.getSchemaTypes)(t.schema),n=(0,YI.coerceAndCheckDataType)(t,r);eA(t,r,!n,e)}function i4(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Gi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function a4(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Gi.checkStrictMode)(t,"default is ignored in the schema root")}function o4(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,JU.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function s4(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function lA({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,re._)`${fe.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,re.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${fe.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function l4(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,re._)`${fe.default.errors} === 0`,()=>e.return(fe.default.data),()=>e.throw((0,re._)`new ${i}(${fe.default.vErrors})`)):(e.assign((0,re._)`${n}.errors`,fe.default.vErrors),a.unevaluated&&c4(t),e.return((0,re._)`${fe.default.errors} === 0`))}function c4({gen:t,evaluated:e,props:r,items:n}){r instanceof re.Name&&t.assign((0,re._)`${e}.props`,r),n instanceof re.Name&&t.assign((0,re._)`${e}.items`,n)}function eA(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Gi.schemaHasRulesButRef)(a,u))){i.block(()=>uA(t,"$ref",u.all.$ref.definition));return}l.jtd||u4(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,A_.shouldUseGroup)(a,m)&&(m.type?(i.if((0,Hm.checkDataType)(m.type,o,l.strictNumbers)),tA(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,Hm.reportTypeError)(t)),i.endIf()):tA(t,m),s||i.if((0,re._)`${fe.default.errors} === ${n||0}`))}}function tA(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,KU.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,A_.shouldUseRule)(n,a)&&uA(t,a.keyword,a.definition,e.type)})}function u4(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(d4(t,e),t.opts.allowUnionTypes||p4(t,e),m4(t,t.dataTypes))}function d4(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{cA(t.dataTypes,r)||P_(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),f4(t,e)}}function p4(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&P_(t,"use allowUnionTypes to allow union type keyword")}function m4(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,A_.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>h4(e,o))&&P_(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function h4(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function cA(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function f4(t,e){let r=[];for(let n of t.dataTypes)cA(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function P_(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Gi.checkStrictMode)(t,e,t.opts.strictTypes)}var qm=class{constructor(e,r,n){if((0,pu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",dA(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,pu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",fe.default.errors))}result(e,r,n){this.failResult((0,re.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,re.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,re._)`${r} !== undefined && (${(0,re.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?du.reportExtraError:du.reportError)(this,this.def.error,r)}$dataError(){(0,du.reportError)(this,this.def.$dataError||du.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,du.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=re.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=re.nil,r=re.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,re.or)((0,re._)`${i} === undefined`,r)),e!==re.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,re.or)(o(),s());function o(){if(n.length){if(!(r instanceof re.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,re._)`${(0,Hm.checkDataTypes)(l,r,a.opts.strictNumbers,Hm.DataType.Wrong)}`}return re.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,re._)`!${l}(${r})`}return re.nil}}subschema(e,r){let n=(0,I_.getSubschema)(this.it,e);(0,I_.extendSubschemaData)(n,this.it,e),(0,I_.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return r4(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Gi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Gi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,re.Name)),!0}};Ca.KeywordCxt=qm;function uA(t,e,r,n){let i=new qm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,pu.funcKeywordCode)(i,r):"macro"in r?(0,pu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,pu.funcKeywordCode)(i,r)}var g4=/^\/(?:[^~]|~0|~1)*$/,y4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dA(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return fe.default.rootData;if(t[0]==="/"){if(!g4.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=fe.default.rootData}else{let c=y4.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,re._)`${a}${(0,re.getProperty)((0,Gi.unescapeJsonPointer)(c))}`,o=(0,re._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Ca.getData=dA});var Wm=P(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var R_=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};N_.default=R_});var hu=P(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var O_=uu(),D_=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,O_.resolveUrl)(e,r,n),this.missingSchema=(0,O_.normalizeId)((0,O_.getFullPath)(e,this.missingRef))}};M_.default=D_});var Km=P(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;var jn=Ne(),b4=Wm(),bo=Ui(),Un=uu(),pA=He(),v4=mu(),ol=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Un.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};wn.SchemaEnv=ol;function L_(t){let e=mA.call(this,t);if(e)return e;let r=(0,Un.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new jn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:b4.default,code:(0,jn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[jn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,jn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:jn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,jn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,v4.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(bo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${bo.default.self}`,`${bo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof jn.Name?void 0:h,items:f instanceof jn.Name?void 0:f,dynamicProps:h instanceof jn.Name,dynamicItems:f instanceof jn.Name},p.source&&(p.source.evaluated=(0,jn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}wn.compileSchema=L_;function _4(t,e,r){var n;r=(0,Un.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=k4.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new ol({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=S4.call(this,a)}wn.resolveRef=_4;function S4(t){return(0,Un.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:L_.call(this,t)}function mA(t){for(let e of this._compilations)if(w4(e,t))return e}wn.getCompilingSchema=mA;function w4(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function k4(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Zm.call(this,t,e)}function Zm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Un._getFullPath)(this.opts.uriResolver,r),i=(0,Un.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return $_.call(this,r,t);let a=(0,Un.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=Zm.call(this,t,o);return typeof s?.schema!="object"?void 0:$_.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||L_.call(this,o),a===(0,Un.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,Un.resolveUrl)(this.opts.uriResolver,i,c)),new ol({schema:s,schemaId:l,root:t,baseId:i})}return $_.call(this,r,o)}}wn.resolveSchema=Zm;var x4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $_(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,pA.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!x4.has(s)&&c&&(e=(0,Un.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,pA.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Un.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=Zm.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new ol({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var hA=P((Pce,E4)=>{E4.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 F_=P((Rce,bA)=>{"use strict";var T4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gA=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function z_(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var C4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function fA(t){return t.length=0,!0}function I4(t,e,r){if(t.length){let n=z_(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function A4(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],a=!1,o=!1,s=I4;for(let l=0;l<t.length;l++){let c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(a===!0&&(o=!0),!s(i,n,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(a=!0),n.push(":");continue}else if(c==="%"){if(!s(i,n,r))break;s=fA}else{i.push(c);continue}}return i.length&&(s===fA?r.zone=i.join(""):o?n.push(i.join("")):n.push(z_(i))),r.address=n.join(""),r}function yA(t){if(P4(t,":")<2)return{host:t,isIPV6:!1};let e=A4(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function P4(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function R4(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function N4(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function O4(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!gA(r)){let n=yA(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}bA.exports={nonSimpleDomain:C4,recomposeAuthority:O4,normalizeComponentEncoding:N4,removeDotSegments:R4,isIPv4:gA,isUUID:T4,normalizeIPv6:yA,stringArrayToHexStripped:z_}});var kA=P((Nce,wA)=>{"use strict";var{isUUID:D4}=F_(),M4=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,$4=["http","https","ws","wss","urn","urn:uuid"];function L4(t){return $4.indexOf(t)!==-1}function B_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function vA(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function _A(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function z4(t){return t.secure=B_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function F4(t){if((t.port===(B_(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function B4(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(M4);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,a=j_(i);t.path=void 0,a&&(t=a.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function j4(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,a=j_(i);a&&(t=a.serialize(t,e));let o=t,s=t.nss;return o.path=`${n||e.nid}:${s}`,e.skipEscape=!0,o}function U4(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!D4(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function G4(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var SA={scheme:"http",domainHost:!0,parse:vA,serialize:_A},V4={scheme:"https",domainHost:SA.domainHost,parse:vA,serialize:_A},Jm={scheme:"ws",domainHost:!0,parse:z4,serialize:F4},H4={scheme:"wss",domainHost:Jm.domainHost,parse:Jm.parse,serialize:Jm.serialize},q4={scheme:"urn",parse:B4,serialize:j4,skipNormalize:!0},W4={scheme:"urn:uuid",parse:U4,serialize:G4,skipNormalize:!0},Xm={http:SA,https:V4,ws:Jm,wss:H4,urn:q4,"urn:uuid":W4};Object.setPrototypeOf(Xm,null);function j_(t){return t&&(Xm[t]||Xm[t.toLowerCase()])||void 0}wA.exports={wsIsSecure:B_,SCHEMES:Xm,isValidSchemeName:L4,getSchemeHandler:j_}});var TA=P((Oce,Qm)=>{"use strict";var{normalizeIPv6:Z4,removeDotSegments:fu,recomposeAuthority:K4,normalizeComponentEncoding:Ym,isIPv4:J4,nonSimpleDomain:X4}=F_(),{SCHEMES:Y4,getSchemeHandler:xA}=kA();function Q4(t,e){return typeof t=="string"?t=ci(Vi(t,e),e):typeof t=="object"&&(t=Vi(ci(t,e),e)),t}function eG(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=EA(Vi(t,n),Vi(e,n),n,!0);return n.skipEscape=!0,ci(i,n)}function EA(t,e,r,n){let i={};return n||(t=Vi(ci(t,r),r),e=Vi(ci(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=fu(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=fu(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=fu(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=fu(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function tG(t,e,r){return typeof t=="string"?(t=unescape(t),t=ci(Ym(Vi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=ci(Ym(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=ci(Ym(Vi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=ci(Ym(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function ci(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],a=xA(n.scheme||r.scheme);a&&a.serialize&&a.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=K4(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!a||!a.absolutePath)&&(s=fu(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var rG=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Vi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let a=t.match(rG);if(a){if(n.scheme=a[1],n.userinfo=a[3],n.host=a[4],n.port=parseInt(a[5],10),n.path=a[6]||"",n.query=a[7],n.fragment=a[8],isNaN(n.port)&&(n.port=a[5]),n.host)if(J4(n.host)===!1){let l=Z4(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let o=xA(r.scheme||n.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&n.host&&(r.domainHost||o&&o.domainHost)&&i===!1&&X4(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!o||o&&!o.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),o&&o.parse&&o.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var U_={SCHEMES:Y4,normalize:Q4,resolve:eG,resolveComponent:EA,equal:tG,serialize:ci,parse:Vi};Qm.exports=U_;Qm.exports.default=U_;Qm.exports.fastUri=U_});var IA=P(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var CA=TA();CA.code='require("ajv/dist/runtime/uri").default';G_.default=CA});var $A=P(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.CodeGen=ir.Name=ir.nil=ir.stringify=ir.str=ir._=ir.KeywordCxt=void 0;var nG=mu();Object.defineProperty(ir,"KeywordCxt",{enumerable:!0,get:function(){return nG.KeywordCxt}});var sl=Ne();Object.defineProperty(ir,"_",{enumerable:!0,get:function(){return sl._}});Object.defineProperty(ir,"str",{enumerable:!0,get:function(){return sl.str}});Object.defineProperty(ir,"stringify",{enumerable:!0,get:function(){return sl.stringify}});Object.defineProperty(ir,"nil",{enumerable:!0,get:function(){return sl.nil}});Object.defineProperty(ir,"Name",{enumerable:!0,get:function(){return sl.Name}});Object.defineProperty(ir,"CodeGen",{enumerable:!0,get:function(){return sl.CodeGen}});var iG=Wm(),OA=hu(),aG=b_(),gu=Km(),oG=Ne(),yu=uu(),eh=lu(),H_=He(),AA=hA(),sG=IA(),DA=(t,e)=>new RegExp(t,e);DA.code="new RegExp";var lG=["removeAdditional","useDefaults","coerceTypes"],cG=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),uG={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."},dG={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PA=200;function pG(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:DA,Z=(i=t.uriResolver)!==null&&i!==void 0?i:sG.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:PA,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:PA,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(x=t.messages)!==null&&x!==void 0?x:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:($=t.int32range)!==null&&$!==void 0?$:!0,uriResolver:Z}}var bu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...pG(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new oG.ValueScope({scope:{},prefixes:cG,es5:r,lines:n}),this.logger=bG(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,aG.getRules)(),RA.call(this,uG,e,"NOT SUPPORTED"),RA.call(this,dG,e,"DEPRECATED","warn"),this._metaOpts=gG.call(this),e.formats&&hG.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&fG.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),mG.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=AA;n==="id"&&(i={...AA},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof OA.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,yu.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=NA.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new gu.SchemaEnv({schema:{},schemaId:n});if(r=gu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=NA.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,yu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(_G.call(this,n,r),!r)return(0,H_.eachItem)(n,a=>V_.call(this,a)),this;wG.call(this,r);let i={...r,type:(0,eh.getJSONTypes)(r.type),schemaType:(0,eh.getJSONTypes)(r.schemaType)};return(0,H_.eachItem)(n,i.type.length===0?a=>V_.call(this,a,i):a=>i.type.forEach(o=>V_.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=MA(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,yu.normalizeId)(o||n);let c=yu.getSchemaRefs.call(this,e,n);return l=new gu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):gu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{gu.compileSchema.call(this,e)}finally{this.opts=r}}};bu.ValidationError=iG.default;bu.MissingRefError=OA.default;ir.default=bu;function RA(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function NA(t){return t=(0,yu.normalizeId)(t),this.schemas[t]||this.refs[t]}function mG(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function hG(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function fG(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function gG(){let t={...this.opts};for(let e of lG)delete t[e];return t}var yG={log(){},warn(){},error(){}};function bG(t){if(t===!1)return yG;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var vG=/^[a-z_$][a-z0-9_$:-]*$/i;function _G(t,e){let{RULES:r}=this;if((0,H_.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!vG.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function V_(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,eh.getJSONTypes)(e.type),schemaType:(0,eh.getJSONTypes)(e.schemaType)}};e.before?SG.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function SG(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function wG(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=MA(e)),t.validateSchema=this.compile(e,!0))}var kG={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function MA(t){return{anyOf:[t,kG]}}});var LA=P(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var xG={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};q_.default=xG});var jA=P(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.callRef=vo.getValidate=void 0;var EG=hu(),zA=Sn(),Gr=Ne(),ll=Ui(),FA=Km(),th=He(),TG={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=FA.resolveRef.call(l,c,i,r);if(u===void 0)throw new EG.default(n.opts.uriResolver,i,r);if(u instanceof FA.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return rh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return rh(t,(0,Gr._)`${h}.validate`,c,c.$async)}function m(h){let f=BA(t,h);rh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Gr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:Gr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function BA(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Gr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}vo.getValidate=BA;function rh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?ll.default.this:Gr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Gr._)`await ${(0,zA.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,Gr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,zA.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,Gr._)`${h}.errors`;i.assign(ll.default.vErrors,(0,Gr._)`${ll.default.vErrors} === null ? ${f} : ${ll.default.vErrors}.concat(${f})`),i.assign(ll.default.errors,(0,Gr._)`${ll.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=th.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,Gr._)`${h}.evaluated.props`);a.props=th.mergeEvaluated.props(i,g,a.props,Gr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=th.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,Gr._)`${h}.evaluated.items`);a.items=th.mergeEvaluated.items(i,g,a.items,Gr.Name)}}}vo.callRef=rh;vo.default=TG});var UA=P(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});var CG=LA(),IG=jA(),AG=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",CG.default,IG.default];W_.default=AG});var GA=P(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var nh=Ne(),Ia=nh.operators,ih={maximum:{okStr:"<=",ok:Ia.LTE,fail:Ia.GT},minimum:{okStr:">=",ok:Ia.GTE,fail:Ia.LT},exclusiveMaximum:{okStr:"<",ok:Ia.LT,fail:Ia.GTE},exclusiveMinimum:{okStr:">",ok:Ia.GT,fail:Ia.LTE}},PG={message:({keyword:t,schemaCode:e})=>(0,nh.str)`must be ${ih[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,nh._)`{comparison: ${ih[t].okStr}, limit: ${e}}`},RG={keyword:Object.keys(ih),type:"number",schemaType:"number",$data:!0,error:PG,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,nh._)`${r} ${ih[e].fail} ${n} || isNaN(${r})`)}};Z_.default=RG});var VA=P(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var vu=Ne(),NG={message:({schemaCode:t})=>(0,vu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,vu._)`{multipleOf: ${t}}`},OG={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:NG,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,vu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,vu._)`${o} !== parseInt(${o})`;t.fail$data((0,vu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};K_.default=OG});var qA=P(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});function HA(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}J_.default=HA;HA.code='require("ajv/dist/runtime/ucs2length").default'});var WA=P(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});var _o=Ne(),DG=He(),MG=qA(),$G={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_o.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_o._)`{limit: ${t}}`},LG={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$G,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?_o.operators.GT:_o.operators.LT,o=i.opts.unicode===!1?(0,_o._)`${r}.length`:(0,_o._)`${(0,DG.useFunc)(t.gen,MG.default)}(${r})`;t.fail$data((0,_o._)`${o} ${a} ${n}`)}};X_.default=LG});var ZA=P(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var zG=Sn(),ah=Ne(),FG={message:({schemaCode:t})=>(0,ah.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ah._)`{pattern: ${t}}`},BG={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:FG,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,ah._)`(new RegExp(${i}, ${o}))`:(0,zG.usePattern)(t,n);t.fail$data((0,ah._)`!${s}.test(${e})`)}};Y_.default=BG});var KA=P(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var _u=Ne(),jG={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,_u.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,_u._)`{limit: ${t}}`},UG={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:jG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?_u.operators.GT:_u.operators.LT;t.fail$data((0,_u._)`Object.keys(${r}).length ${i} ${n}`)}};Q_.default=UG});var JA=P(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});var Su=Sn(),wu=Ne(),GG=He(),VG={message:({params:{missingProperty:t}})=>(0,wu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,wu._)`{missingProperty: ${t}}`},HG={keyword:"required",type:"object",schemaType:"array",$data:!0,error:VG,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,GG.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(wu.nil,d);else for(let p of r)(0,Su.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,Su.checkMissingProp)(t,r,p)),(0,Su.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Su.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,Su.propertyInData)(e,i,p,s.ownProperties)),e.if((0,wu.not)(h),()=>{t.error(),e.break()})},wu.nil)}}};eS.default=HG});var XA=P(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var ku=Ne(),qG={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ku.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ku._)`{limit: ${t}}`},WG={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qG,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?ku.operators.GT:ku.operators.LT;t.fail$data((0,ku._)`${r}.length ${i} ${n}`)}};tS.default=WG});var oh=P(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var YA=cu();YA.code='require("ajv/dist/runtime/equal").default';rS.default=YA});var QA=P(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var nS=lu(),ar=Ne(),ZG=He(),KG=oh(),JG={message:({params:{i:t,j:e}})=>(0,ar.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ar._)`{i: ${t}, j: ${e}}`},XG={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:JG,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,nS.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,ar._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,ar._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,ar._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,nS.checkDataTypes)(c,y,s.opts.strictNumbers,nS.DataType.Wrong),x=e.const("indices",(0,ar._)`{}`);e.for((0,ar._)`;${h}--;`,()=>{e.let(y,(0,ar._)`${r}[${h}]`),e.if(g,(0,ar._)`continue`),c.length>1&&e.if((0,ar._)`typeof ${y} == "string"`,(0,ar._)`${y} += "_"`),e.if((0,ar._)`typeof ${x}[${y}] == "number"`,()=>{e.assign(f,(0,ar._)`${x}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,ar._)`${x}[${y}] = ${h}`)})}function p(h,f){let y=(0,ZG.useFunc)(e,KG.default),g=e.name("outer");e.label(g).for((0,ar._)`;${h}--;`,()=>e.for((0,ar._)`${f} = ${h}; ${f}--;`,()=>e.if((0,ar._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};iS.default=XG});var eP=P(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var aS=Ne(),YG=He(),QG=oh(),eV={message:"must be equal to constant",params:({schemaCode:t})=>(0,aS._)`{allowedValue: ${t}}`},tV={keyword:"const",$data:!0,error:eV,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,aS._)`!${(0,YG.useFunc)(e,QG.default)}(${r}, ${i})`):t.fail((0,aS._)`${a} !== ${r}`)}};oS.default=tV});var tP=P(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var xu=Ne(),rV=He(),nV=oh(),iV={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,xu._)`{allowedValues: ${t}}`},aV={keyword:"enum",schemaType:"array",$data:!0,error:iV,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,rV.useFunc)(e,nV.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,xu.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,xu._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,xu._)`${c()}(${r}, ${p}[${h}])`:(0,xu._)`${r} === ${f}`}}};sS.default=aV});var rP=P(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});var oV=GA(),sV=VA(),lV=WA(),cV=ZA(),uV=KA(),dV=JA(),pV=XA(),mV=QA(),hV=eP(),fV=tP(),gV=[oV.default,sV.default,lV.default,cV.default,uV.default,dV.default,pV.default,mV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hV.default,fV.default];lS.default=gV});var uS=P(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.validateAdditionalItems=void 0;var So=Ne(),cS=He(),yV={message:({params:{len:t}})=>(0,So.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,So._)`{limit: ${t}}`},bV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:yV,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,cS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}nP(t,n)}};function nP(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,So._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,So._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,cS.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,So._)`${s} <= ${e.length}`);r.if((0,So.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:cS.Type.Num},c),o.allErrors||r.if((0,So.not)(c),()=>r.break())})}}Eu.validateAdditionalItems=nP;Eu.default=bV});var dS=P(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.validateTuple=void 0;var iP=Ne(),sh=He(),vV=Sn(),_V={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return aP(t,"additionalItems",e);r.items=!0,!(0,sh.alwaysValidSchema)(r,e)&&t.ok((0,vV.validateArray)(t))}};function aP(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=sh.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,iP._)`${a}.length`);r.forEach((d,m)=>{(0,sh.alwaysValidSchema)(s,d)||(n.if((0,iP._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,sh.checkStrictMode)(s,y,m.strictTuples)}}}Tu.validateTuple=aP;Tu.default=_V});var oP=P(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var SV=dS(),wV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,SV.validateTuple)(t,"items")};pS.default=wV});var lP=P(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var sP=Ne(),kV=He(),xV=Sn(),EV=uS(),TV={message:({params:{len:t}})=>(0,sP.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sP._)`{limit: ${t}}`},CV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:TV,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,kV.alwaysValidSchema)(n,e)&&(i?(0,EV.validateAdditionalItems)(t,i):t.ok((0,xV.validateArray)(t)))}};mS.default=CV});var cP=P(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});var kn=Ne(),lh=He(),IV={message:({params:{min:t,max:e}})=>e===void 0?(0,kn.str)`must contain at least ${t} valid item(s)`:(0,kn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,kn._)`{minContains: ${t}}`:(0,kn._)`{minContains: ${t}, maxContains: ${e}}`},AV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:IV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,kn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,lh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,lh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,lh.alwaysValidSchema)(a,r)){let f=(0,kn._)`${u} >= ${o}`;s!==void 0&&(f=(0,kn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,kn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:lh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,kn._)`${f}++`),s===void 0?e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,kn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,kn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};hS.default=AV});var pP=P(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.validateSchemaDeps=ui.validatePropertyDeps=ui.error=void 0;var fS=Ne(),PV=He(),Cu=Sn();ui.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,fS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,fS._)`{property: ${t},
|
|
6
6
|
missingProperty: ${n},
|
|
7
7
|
depsCount: ${e},
|
|
8
|
-
deps: ${r}}`};var PV={keyword:"dependencies",type:"object",schemaType:"object",error:ui.error,code(t){let[e,r]=RV(t);cP(t,e),uP(t,r)}};function RV({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function cP(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,xu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,xu.checkReportMissingProp)(t,c)}):(r.if((0,aS._)`${l} && (${(0,xu.checkMissingProp)(t,s,a)})`),(0,xu.reportMissingProp)(t,a),r.else())}}ui.validatePropertyDeps=cP;function uP(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,AV.alwaysValidSchema)(a,e[s])||(r.if((0,xu.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}ui.validateSchemaDeps=uP;ui.default=PV});var mP=P(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var pP=Ne(),NV=He(),OV={message:"property name must be valid",params:({params:t})=>(0,pP._)`{propertyName: ${t.propertyName}}`},DV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:OV,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,NV.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,pP.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};oS.default=DV});var lS=P(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var sh=Sn(),Gn=Ne(),MV=Ui(),lh=He(),$V={message:"must NOT have additional properties",params:({params:t})=>(0,Gn._)`{additionalProperty: ${t.additionalProperty}}`},LV={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:$V,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,lh.alwaysValidSchema)(o,r))return;let c=(0,sh.allSchemaProperties)(n.properties),u=(0,sh.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Gn._)`${a} === ${MV.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let S=(0,lh.schemaRefOrVal)(o,n.properties,"properties");g=(0,sh.isOwnProperty)(e,S,y)}else c.length?g=(0,Gn.or)(...c.map(S=>(0,Gn._)`${y} === ${S}`)):g=Gn.nil;return u.length&&(g=(0,Gn.or)(g,...u.map(S=>(0,Gn._)`${(0,sh.usePattern)(t,S)}.test(${y})`))),(0,Gn.not)(g)}function p(y){e.code((0,Gn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,lh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Gn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Gn.not)(g),()=>e.break()))}}function f(y,g,S){let v={keyword:"additionalProperties",dataProp:y,dataPropType:lh.Type.Str};S===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};sS.default=LV});var gP=P(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var zV=uu(),hP=Sn(),cS=He(),fP=lS(),FV={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&fP.default.code(new zV.KeywordCxt(a,fP.default,"additionalProperties"));let o=(0,hP.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=cS.mergeEvaluated.props(e,(0,cS.toHash)(o),a.props));let s=o.filter(d=>!(0,cS.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,hP.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};uS.default=FV});var _P=P(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var yP=Sn(),ch=Ne(),bP=He(),vP=He(),BV={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,yP.allSchemaProperties)(r),l=s.filter(f=>(0,bP.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof ch.Name)&&(a.props=(0,vP.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,bP.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,ch._)`${(0,yP.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:vP.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,ch._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,ch.not)(u),()=>e.break())})})}}};dS.default=BV});var SP=P(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var jV=He(),UV={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,jV.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};pS.default=UV});var wP=P(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var GV=Sn(),VV={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:GV.validateUnion,error:{message:"must match a schema in anyOf"}};mS.default=VV});var kP=P(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});var uh=Ne(),HV=He(),qV={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,uh._)`{passingSchemas: ${t.passing}}`},WV={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:qV,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,HV.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,uh._)`${l} && ${o}`).assign(o,!1).assign(s,(0,uh._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,uh.Name)})})}}};hS.default=WV});var xP=P(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});var ZV=He(),KV={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,ZV.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};fS.default=KV});var CP=P(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var dh=Ne(),TP=He(),JV={message:({params:t})=>(0,dh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,dh._)`{failingKeyword: ${t.ifClause}}`},XV={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:JV,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,TP.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=EP(n,"then"),a=EP(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,dh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,dh._)`${u}`):t.setParams({ifClause:u})}}}};function EP(t,e){let r=t.schema[e];return r!==void 0&&!(0,TP.alwaysValidSchema)(t,r)}gS.default=XV});var IP=P(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var YV=He(),QV={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,YV.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};yS.default=QV});var AP=P(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});var e3=eS(),t3=aP(),r3=tS(),n3=sP(),i3=lP(),a3=dP(),o3=mP(),s3=lS(),l3=gP(),c3=_P(),u3=SP(),d3=wP(),p3=kP(),m3=xP(),h3=CP(),f3=IP();function g3(t=!1){let e=[u3.default,d3.default,p3.default,m3.default,h3.default,f3.default,o3.default,s3.default,a3.default,l3.default,c3.default];return t?e.push(t3.default,n3.default):e.push(e3.default,r3.default),e.push(i3.default),e}bS.default=g3});var PP=P(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});var Nt=Ne(),y3={message:({schemaCode:t})=>(0,Nt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Nt._)`{format: ${t}}`},b3={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:y3,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Nt._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Nt._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Nt._)`${f}.type || "string"`).assign(g,(0,Nt._)`${f}.validate`),()=>r.assign(y,(0,Nt._)`"string"`).assign(g,f)),t.fail$data((0,Nt.or)(S(),v()));function S(){return l.strictSchema===!1?Nt.nil:(0,Nt._)`${o} && !${g}`}function v(){let I=u.$async?(0,Nt._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Nt._)`${g}(${n})`,T=(0,Nt._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Nt._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){S();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function S(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Nt.regexpCode)(T):l.code.formats?(0,Nt._)`${l.code.formats}${(0,Nt.getProperty)(a)}`:void 0,$=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Nt._)`${$}.validate`]:["string",T,$]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Nt._)`await ${g}(${n})`}return typeof y=="function"?(0,Nt._)`${g}(${n})`:(0,Nt._)`${g}.test(${n})`}}}};vS.default=b3});var RP=P(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var v3=PP(),_3=[v3.default];_S.default=_3});var NP=P(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.contentVocabulary=ll.metadataVocabulary=void 0;ll.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ll.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var DP=P(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var S3=jA(),w3=tP(),k3=AP(),x3=RP(),OP=NP(),E3=[S3.default,w3.default,(0,k3.default)(),x3.default,OP.metadataVocabulary,OP.contentVocabulary];SS.default=E3});var $P=P(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.DiscrError=void 0;var MP;(function(t){t.Tag="tag",t.Mapping="mapping"})(MP||(ph.DiscrError=MP={}))});var zP=P(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var cl=Ne(),wS=$P(),LP=Wm(),T3=du(),C3=He(),I3={message:({params:{discrError:t,tagName:e}})=>t===wS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,cl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},A3={keyword:"discriminator",type:"object",schemaType:"object",error:I3,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,cl._)`${r}${(0,cl.getProperty)(s)}`);e.if((0,cl._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:wS.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,cl._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:wS.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,cl.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];if(T?.$ref&&!(0,C3.schemaHasRulesButRef)(T,a.self.RULES)){let $=T.$ref;if(T=LP.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,$),T instanceof LP.SchemaEnv&&(T=T.schema),T===void 0)throw new T3.default(a.opts.uriResolver,a.baseId,$)}let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),S(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function S(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};kS.default=A3});var FP=P((_ue,P3)=>{P3.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 jP=P((yt,xS)=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.MissingRefError=yt.ValidationError=yt.CodeGen=yt.Name=yt.nil=yt.stringify=yt.str=yt._=yt.KeywordCxt=yt.Ajv=void 0;var R3=MA(),N3=DP(),O3=zP(),BP=FP(),D3=["/properties"],mh="http://json-schema.org/draft-07/schema",ul=class extends R3.default{_addVocabularies(){super._addVocabularies(),N3.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(O3.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(BP,D3):BP;this.addMetaSchema(e,mh,!1),this.refs["http://json-schema.org/schema"]=mh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mh)?mh:void 0)}};yt.Ajv=ul;xS.exports=yt=ul;xS.exports.Ajv=ul;Object.defineProperty(yt,"__esModule",{value:!0});yt.default=ul;var M3=uu();Object.defineProperty(yt,"KeywordCxt",{enumerable:!0,get:function(){return M3.KeywordCxt}});var dl=Ne();Object.defineProperty(yt,"_",{enumerable:!0,get:function(){return dl._}});Object.defineProperty(yt,"str",{enumerable:!0,get:function(){return dl.str}});Object.defineProperty(yt,"stringify",{enumerable:!0,get:function(){return dl.stringify}});Object.defineProperty(yt,"nil",{enumerable:!0,get:function(){return dl.nil}});Object.defineProperty(yt,"Name",{enumerable:!0,get:function(){return dl.Name}});Object.defineProperty(yt,"CodeGen",{enumerable:!0,get:function(){return dl.CodeGen}});var $3=Hm();Object.defineProperty(yt,"ValidationError",{enumerable:!0,get:function(){return $3.default}});var L3=du();Object.defineProperty(yt,"MissingRefError",{enumerable:!0,get:function(){return L3.default}})});var KP=P(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.formatNames=pi.fastFormats=pi.fullFormats=void 0;function di(t,e){return{validate:t,compare:e}}pi.fullFormats={date:di(HP,IS),time:di(TS(!0),AS),"date-time":di(UP(!0),WP),"iso-time":di(TS(),qP),"iso-date-time":di(UP(),ZP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:G3,"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:J3,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:V3,int32:{type:"number",validate:W3},int64:{type:"number",validate:Z3},float:{type:"number",validate:VP},double:{type:"number",validate:VP},password:!0,binary:!0};pi.fastFormats={...pi.fullFormats,date:di(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,IS),time:di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,AS),"date-time":di(/^\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,WP),"iso-time":di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,qP),"iso-date-time":di(/^\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,ZP),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};pi.formatNames=Object.keys(pi.fullFormats);function z3(t){return t%4===0&&(t%100!==0||t%400===0)}var F3=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,B3=[0,31,28,31,30,31,30,31,31,30,31,30,31];function HP(t){let e=F3.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&z3(r)?29:B3[n])}function IS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ES=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function TS(t){return function(r){let n=ES.exec(r);if(!n)return!1;let i=+n[1],a=+n[2],o=+n[3],s=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||t&&!s)return!1;if(i<=23&&a<=59&&o<60)return!0;let d=a-u*l,m=i-c*l-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}}function AS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function qP(t,e){if(!(t&&e))return;let r=ES.exec(t),n=ES.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var CS=/t|\s/i;function UP(t){let e=TS(t);return function(n){let i=n.split(CS);return i.length===2&&HP(i[0])&&e(i[1])}}function WP(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function ZP(t,e){if(!(t&&e))return;let[r,n]=t.split(CS),[i,a]=e.split(CS),o=IS(r,i);if(o!==void 0)return o||AS(n,a)}var j3=/\/|:/,U3=/^(?:[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 G3(t){return j3.test(t)&&U3.test(t)}var GP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function V3(t){return GP.lastIndex=0,GP.test(t)}var H3=-(2**31),q3=2**31-1;function W3(t){return Number.isInteger(t)&&t<=q3&&t>=H3}function Z3(t){return Number.isInteger(t)}function VP(){return!0}var K3=/[^\\]\\Z/;function J3(t){if(K3.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Cu=P(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.regexpCode=qe.getEsmExportName=qe.getProperty=qe.safeStringify=qe.stringify=qe.strConcat=qe.addCodeArg=qe.str=qe._=qe.nil=qe._Code=qe.Name=qe.IDENTIFIER=qe._CodeOrName=void 0;var Eu=class{};qe._CodeOrName=Eu;qe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var wo=class extends Eu{constructor(e){if(super(),!qe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};qe.Name=wo;var xn=class extends Eu{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof wo&&(r[n.str]=(r[n.str]||0)+1),r),{})}};qe._Code=xn;qe.nil=new xn("");function JP(t,...e){let r=[t[0]],n=0;for(;n<e.length;)RS(r,e[n]),r.push(t[++n]);return new xn(r)}qe._=JP;var PS=new xn("+");function XP(t,...e){let r=[Tu(t[0])],n=0;for(;n<e.length;)r.push(PS),RS(r,e[n]),r.push(PS,Tu(t[++n]));return X3(r),new xn(r)}qe.str=XP;function RS(t,e){e instanceof xn?t.push(...e._items):e instanceof wo?t.push(e):t.push(e6(e))}qe.addCodeArg=RS;function X3(t){let e=1;for(;e<t.length-1;){if(t[e]===PS){let r=Y3(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Y3(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof wo||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof wo))return`"${t}${e.slice(1)}`}function Q3(t,e){return e.emptyStr()?t:t.emptyStr()?e:XP`${t}${e}`}qe.strConcat=Q3;function e6(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Tu(Array.isArray(t)?t.join(","):t)}function t6(t){return new xn(Tu(t))}qe.stringify=t6;function Tu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qe.safeStringify=Tu;function r6(t){return typeof t=="string"&&qe.IDENTIFIER.test(t)?new xn(`.${t}`):JP`[${t}]`}qe.getProperty=r6;function n6(t){if(typeof t=="string"&&qe.IDENTIFIER.test(t))return new xn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}qe.getEsmExportName=n6;function i6(t){return new xn(t.toString())}qe.regexpCode=i6});var MS=P(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.ValueScope=Ir.ValueScopeName=Ir.Scope=Ir.varKinds=Ir.UsedValueState=void 0;var Vr=Cu(),NS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},OS;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(OS=Ir.UsedValueState||(Ir.UsedValueState={}));Ir.varKinds={const:new Vr.Name("const"),let:new Vr.Name("let"),var:new Vr.Name("var")};var hh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Vr.Name?e:this.name(e)}name(e){return new Vr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ir.Scope=hh;var fh=class extends Vr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Vr._)`.${new Vr.Name(r)}[${n}]`}};Ir.ValueScopeName=fh;var a6=(0,Vr._)`\n`,DS=class extends hh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?a6:Vr.nil}}get(){return this._scope}name(e){return new fh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Vr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Vr.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,OS.Started);let u=r(c);if(u){let d=this.opts.es5?Ir.varKinds.var:Ir.varKinds.const;a=(0,Vr._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Vr._)`${a}${u}${this.opts._n}`;else throw new NS(c);l.set(c,OS.Completed)})}return a}};Ir.ValueScope=DS});var Ee=P(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.or=Ae.and=Ae.not=Ae.CodeGen=Ae.operators=Ae.varKinds=Ae.ValueScopeName=Ae.ValueScope=Ae.Scope=Ae.Name=Ae.regexpCode=Ae.stringify=Ae.getProperty=Ae.nil=Ae.strConcat=Ae.str=Ae._=void 0;var Fe=Cu(),Vn=MS(),Aa=Cu();Object.defineProperty(Ae,"_",{enumerable:!0,get:function(){return Aa._}});Object.defineProperty(Ae,"str",{enumerable:!0,get:function(){return Aa.str}});Object.defineProperty(Ae,"strConcat",{enumerable:!0,get:function(){return Aa.strConcat}});Object.defineProperty(Ae,"nil",{enumerable:!0,get:function(){return Aa.nil}});Object.defineProperty(Ae,"getProperty",{enumerable:!0,get:function(){return Aa.getProperty}});Object.defineProperty(Ae,"stringify",{enumerable:!0,get:function(){return Aa.stringify}});Object.defineProperty(Ae,"regexpCode",{enumerable:!0,get:function(){return Aa.regexpCode}});Object.defineProperty(Ae,"Name",{enumerable:!0,get:function(){return Aa.Name}});var vh=MS();Object.defineProperty(Ae,"Scope",{enumerable:!0,get:function(){return vh.Scope}});Object.defineProperty(Ae,"ValueScope",{enumerable:!0,get:function(){return vh.ValueScope}});Object.defineProperty(Ae,"ValueScopeName",{enumerable:!0,get:function(){return vh.ValueScopeName}});Object.defineProperty(Ae,"varKinds",{enumerable:!0,get:function(){return vh.varKinds}});Ae.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},$S=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Vn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ml(this.rhs,e,r)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},gh=class extends Hi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Fe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ml(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Fe.Name?{}:{...this.lhs.names};return bh(e,this.rhs)}},LS=class extends gh{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},zS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},FS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},BS=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jS=class extends Hi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ml(this.code,e,r),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},Iu=class extends Hi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(o6(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Eo(e,r.names),{})}},qi=class extends Iu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},US=class extends Iu{},pl=class extends qi{};pl.kind="else";var ko=class t extends qi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new pl(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(YP(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ml(this.condition,e,r),this}get names(){let e=super.names;return bh(e,this.condition),this.else&&Eo(e,this.else.names),e}};ko.kind="if";var xo=class extends qi{};xo.kind="for";var GS=class extends xo{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ml(this.iteration,e,r),this}get names(){return Eo(super.names,this.iteration.names)}},VS=class extends xo{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Vn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=bh(super.names,this.from);return bh(e,this.to)}},yh=class extends xo{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ml(this.iterable,e,r),this}get names(){return Eo(super.names,this.iterable.names)}},Au=class extends qi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Au.kind="func";var Pu=class extends Iu{render(e){return"return "+super.render(e)}};Pu.kind="return";var HS=class extends qi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Eo(e,this.catch.names),this.finally&&Eo(e,this.finally.names),e}},Ru=class extends qi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ru.kind="catch";var Nu=class extends qi{render(e){return"finally"+super.render(e)}};Nu.kind="finally";var qS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
9
|
-
`:""},this._extScope=e,this._scope=new Vn.Scope({parent:e}),this._nodes=[new US]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new $S(e,a,n)),a}const(e,r,n){return this._def(Vn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Vn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Vn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new gh(e,r,n))}add(e,r){return this._leafNode(new LS(e,Ae.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Fe.nil&&this._leafNode(new jS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Fe.addCodeArg)(r,i));return r.push("}"),new Fe._Code(r)}if(e,r,n){if(this._blockNode(new ko(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ko(e))}else(){return this._elseNode(new pl)}endIf(){return this._endBlockNode(ko,pl)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new GS(e),r)}forRange(e,r,n,i,a=this.opts.es5?Vn.varKinds.var:Vn.varKinds.let){let o=this._scope.toName(e);return this._for(new VS(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Vn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Fe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Fe._)`${o}.length`,s=>{this.var(a,(0,Fe._)`${o}[${s}]`),n(a)})}return this._for(new yh("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Vn.varKinds.var:Vn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Fe._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new yh("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(xo)}label(e){return this._leafNode(new zS(e))}break(e){return this._leafNode(new FS(e))}return(e){let r=new Pu;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Pu)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new HS;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new Ru(a),r(a)}return n&&(this._currNode=i.finally=new Nu,this.code(n)),this._endBlockNode(Ru,Nu)}throw(e){return this._leafNode(new BS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Fe.nil,n,i){return this._blockNode(new Au(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Au)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ko))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ae.CodeGen=qS;function Eo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function bh(t,e){return e instanceof Fe._CodeOrName?Eo(t,e.names):t}function ml(t,e,r){if(t instanceof Fe.Name)return n(t);if(!i(t))return t;return new Fe._Code(t._items.reduce((a,o)=>(o instanceof Fe.Name&&(o=n(o)),o instanceof Fe._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof Fe._Code&&a._items.some(o=>o instanceof Fe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function o6(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function YP(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Fe._)`!${WS(t)}`}Ae.not=YP;var s6=QP(Ae.operators.AND);function l6(...t){return t.reduce(s6)}Ae.and=l6;var c6=QP(Ae.operators.OR);function u6(...t){return t.reduce(c6)}Ae.or=u6;function QP(t){return(e,r)=>e===Fe.nil?r:r===Fe.nil?e:(0,Fe._)`${WS(e)} ${t} ${WS(r)}`}function WS(t){return t instanceof Fe.Name?t:(0,Fe._)`(${t})`}});var We=P(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.checkStrictMode=Pe.getErrorPath=Pe.Type=Pe.useFunc=Pe.setEvaluated=Pe.evaluatedPropsToName=Pe.mergeEvaluated=Pe.eachItem=Pe.unescapeJsonPointer=Pe.escapeJsonPointer=Pe.escapeFragment=Pe.unescapeFragment=Pe.schemaRefOrVal=Pe.schemaHasRulesButRef=Pe.schemaHasRules=Pe.checkUnknownRules=Pe.alwaysValidSchema=Pe.toHash=void 0;var lt=Ee(),d6=Cu();function p6(t){let e={};for(let r of t)e[r]=!0;return e}Pe.toHash=p6;function m6(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(rR(t,e),!nR(e,t.self.RULES.all))}Pe.alwaysValidSchema=m6;function rR(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||sR(t,`unknown keyword: "${a}"`)}Pe.checkUnknownRules=rR;function nR(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Pe.schemaHasRules=nR;function h6(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Pe.schemaHasRulesButRef=h6;function f6({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,lt._)`${r}`}return(0,lt._)`${t}${e}${(0,lt.getProperty)(n)}`}Pe.schemaRefOrVal=f6;function g6(t){return iR(decodeURIComponent(t))}Pe.unescapeFragment=g6;function y6(t){return encodeURIComponent(ZS(t))}Pe.escapeFragment=y6;function ZS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Pe.escapeJsonPointer=ZS;function iR(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Pe.unescapeJsonPointer=iR;function b6(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Pe.eachItem=b6;function eR({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof lt.Name?(a instanceof lt.Name?t(i,a,o):e(i,a,o),o):a instanceof lt.Name?(e(i,o,a),a):r(a,o);return s===lt.Name&&!(l instanceof lt.Name)?n(i,l):l}}Pe.mergeEvaluated={props:eR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,lt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,lt._)`${r} || {}`).code((0,lt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,lt._)`${r} || {}`),KS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:aR}),items:eR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,lt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,lt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function aR(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,lt._)`{}`);return e!==void 0&&KS(t,r,e),r}Pe.evaluatedPropsToName=aR;function KS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,lt._)`${e}${(0,lt.getProperty)(n)}`,!0))}Pe.setEvaluated=KS;var tR={};function v6(t,e){return t.scopeValue("func",{ref:e,code:tR[e.code]||(tR[e.code]=new d6._Code(e.code))})}Pe.useFunc=v6;var oR;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(oR=Pe.Type||(Pe.Type={}));function _6(t,e,r){if(t instanceof lt.Name){let n=e===oR.Num;return r?n?(0,lt._)`"[" + ${t} + "]"`:(0,lt._)`"['" + ${t} + "']"`:n?(0,lt._)`"/" + ${t}`:(0,lt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,lt.getProperty)(t).toString():"/"+ZS(t)}Pe.getErrorPath=_6;function sR(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Pe.checkStrictMode=sR});var Wi=P(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var vr=Ee(),S6={data:new vr.Name("data"),valCxt:new vr.Name("valCxt"),instancePath:new vr.Name("instancePath"),parentData:new vr.Name("parentData"),parentDataProperty:new vr.Name("parentDataProperty"),rootData:new vr.Name("rootData"),dynamicAnchors:new vr.Name("dynamicAnchors"),vErrors:new vr.Name("vErrors"),errors:new vr.Name("errors"),this:new vr.Name("this"),self:new vr.Name("self"),scope:new vr.Name("scope"),json:new vr.Name("json"),jsonPos:new vr.Name("jsonPos"),jsonLen:new vr.Name("jsonLen"),jsonPart:new vr.Name("jsonPart")};JS.default=S6});var Ou=P(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendErrors=_r.resetErrorsCount=_r.reportExtraError=_r.reportError=_r.keyword$DataError=_r.keywordError=void 0;var Ue=Ee(),_h=We(),Ar=Wi();_r.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};_r.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function w6(t,e=_r.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=uR(t,e,r);n??(o||s)?lR(a,l):cR(i,(0,Ue._)`[${l}]`)}_r.reportError=w6;function k6(t,e=_r.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=uR(t,e,r);lR(i,s),a||o||cR(n,Ar.default.vErrors)}_r.reportExtraError=k6;function x6(t,e){t.assign(Ar.default.errors,e),t.if((0,Ue._)`${Ar.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${Ar.default.vErrors}.length`,e),()=>t.assign(Ar.default.vErrors,null)))}_r.resetErrorsCount=x6;function E6({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Ar.default.errors,s=>{t.const(o,(0,Ue._)`${Ar.default.vErrors}[${s}]`),t.if((0,Ue._)`${o}.instancePath === undefined`,()=>t.assign((0,Ue._)`${o}.instancePath`,(0,Ue.strConcat)(Ar.default.instancePath,a.errorPath))),t.assign((0,Ue._)`${o}.schemaPath`,(0,Ue.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,Ue._)`${o}.schema`,r),t.assign((0,Ue._)`${o}.data`,n))})}_r.extendErrors=E6;function lR(t,e){let r=t.const("err",e);t.if((0,Ue._)`${Ar.default.vErrors} === null`,()=>t.assign(Ar.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${Ar.default.vErrors}.push(${r})`),t.code((0,Ue._)`${Ar.default.errors}++`)}function cR(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var To={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function uR(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:T6(t,e,r)}function T6(t,e,r={}){let{gen:n,it:i}=t,a=[C6(i,r),I6(t,r)];return A6(t,e,a),n.object(...a)}function C6({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,_h.getErrorPath)(e,_h.Type.Str)}`:t;return[Ar.default.instancePath,(0,Ue.strConcat)(Ar.default.instancePath,r)]}function I6({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ue.str)`${e}/${t}`;return r&&(i=(0,Ue.str)`${i}${(0,_h.getErrorPath)(r,_h.Type.Str)}`),[To.schemaPath,i]}function A6(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([To.keyword,i],[To.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),l.messages&&n.push([To.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([To.schema,o],[To.parentSchema,(0,Ue._)`${u}${d}`],[Ar.default.data,a]),c&&n.push([To.propertyName,c])}});var pR=P(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.boolOrEmptySchema=hl.topBoolOrEmptySchema=void 0;var P6=Ou(),R6=Ee(),N6=Wi(),O6={message:"boolean schema is false"};function D6(t){let{gen:e,schema:r,validateName:n}=t;r===!1?dR(t,!1):typeof r=="object"&&r.$async===!0?e.return(N6.default.data):(e.assign((0,R6._)`${n}.errors`,null),e.return(!0))}hl.topBoolOrEmptySchema=D6;function M6(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),dR(t)):r.var(e,!0)}hl.boolOrEmptySchema=M6;function dR(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,P6.reportError)(i,O6,void 0,e)}});var XS=P(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.getRules=fl.isJSONType=void 0;var $6=["string","number","integer","boolean","null","object","array"],L6=new Set($6);function z6(t){return typeof t=="string"&&L6.has(t)}fl.isJSONType=z6;function F6(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}fl.getRules=F6});var YS=P(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.shouldUseRule=Pa.shouldUseGroup=Pa.schemaHasRulesForType=void 0;function B6({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&mR(t,n)}Pa.schemaHasRulesForType=B6;function mR(t,e){return e.rules.some(r=>hR(t,r))}Pa.shouldUseGroup=mR;function hR(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Pa.shouldUseRule=hR});var Mu=P(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.reportTypeError=ar.checkDataTypes=ar.checkDataType=ar.coerceAndCheckDataType=ar.getJSONTypes=ar.getSchemaTypes=ar.DataType=void 0;var j6=XS(),U6=YS(),G6=Ou(),xe=Ee(),fR=We(),Du;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Du=ar.DataType||(ar.DataType={}));function V6(t){let e=gR(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ar.getSchemaTypes=V6;function gR(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(j6.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ar.getJSONTypes=gR;function H6(t,e){let{gen:r,data:n,opts:i}=t,a=q6(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,U6.schemaHasRulesForType)(t,e[0]));if(o){let s=ew(e,n,i.strictNumbers,Du.Wrong);r.if(s,()=>{a.length?W6(t,e,a):tw(t)})}return o}ar.coerceAndCheckDataType=H6;var yR=new Set(["string","number","integer","boolean","null"]);function q6(t,e){return e?t.filter(r=>yR.has(r)||e==="array"&&r==="array"):[]}function W6(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,xe._)`typeof ${i}`),s=n.let("coerced",(0,xe._)`undefined`);a.coerceTypes==="array"&&n.if((0,xe._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,xe._)`${i}[0]`).assign(o,(0,xe._)`typeof ${i}`).if(ew(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,xe._)`${s} !== undefined`);for(let c of r)(yR.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),tw(t),n.endIf(),n.if((0,xe._)`${s} !== undefined`,()=>{n.assign(i,s),Z6(t,s)});function l(c){switch(c){case"string":n.elseIf((0,xe._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,xe._)`"" + ${i}`).elseIf((0,xe._)`${i} === null`).assign(s,(0,xe._)`""`);return;case"number":n.elseIf((0,xe._)`${o} == "boolean" || ${i} === null
|
|
8
|
+
deps: ${r}}`};var RV={keyword:"dependencies",type:"object",schemaType:"object",error:ui.error,code(t){let[e,r]=NV(t);uP(t,e),dP(t,r)}};function NV({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function uP(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,Cu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,Cu.checkReportMissingProp)(t,c)}):(r.if((0,fS._)`${l} && (${(0,Cu.checkMissingProp)(t,s,a)})`),(0,Cu.reportMissingProp)(t,a),r.else())}}ui.validatePropertyDeps=uP;function dP(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,PV.alwaysValidSchema)(a,e[s])||(r.if((0,Cu.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}ui.validateSchemaDeps=dP;ui.default=RV});var hP=P(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var mP=Ne(),OV=He(),DV={message:"property name must be valid",params:({params:t})=>(0,mP._)`{propertyName: ${t.propertyName}}`},MV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:DV,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,OV.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,mP.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};gS.default=MV});var bS=P(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var ch=Sn(),Gn=Ne(),$V=Ui(),uh=He(),LV={message:"must NOT have additional properties",params:({params:t})=>(0,Gn._)`{additionalProperty: ${t.additionalProperty}}`},zV={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:LV,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,uh.alwaysValidSchema)(o,r))return;let c=(0,ch.allSchemaProperties)(n.properties),u=(0,ch.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Gn._)`${a} === ${$V.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let x=(0,uh.schemaRefOrVal)(o,n.properties,"properties");g=(0,ch.isOwnProperty)(e,x,y)}else c.length?g=(0,Gn.or)(...c.map(x=>(0,Gn._)`${y} === ${x}`)):g=Gn.nil;return u.length&&(g=(0,Gn.or)(g,...u.map(x=>(0,Gn._)`${(0,ch.usePattern)(t,x)}.test(${y})`))),(0,Gn.not)(g)}function p(y){e.code((0,Gn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,uh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Gn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Gn.not)(g),()=>e.break()))}}function f(y,g,x){let v={keyword:"additionalProperties",dataProp:y,dataPropType:uh.Type.Str};x===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};yS.default=zV});var yP=P(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var FV=mu(),fP=Sn(),vS=He(),gP=bS(),BV={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&gP.default.code(new FV.KeywordCxt(a,gP.default,"additionalProperties"));let o=(0,fP.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=vS.mergeEvaluated.props(e,(0,vS.toHash)(o),a.props));let s=o.filter(d=>!(0,vS.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,fP.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};_S.default=BV});var SP=P(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var bP=Sn(),dh=Ne(),vP=He(),_P=He(),jV={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,bP.allSchemaProperties)(r),l=s.filter(f=>(0,vP.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof dh.Name)&&(a.props=(0,_P.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,vP.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,dh._)`${(0,bP.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:_P.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,dh._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,dh.not)(u),()=>e.break())})})}}};SS.default=jV});var wP=P(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var UV=He(),GV={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,UV.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};wS.default=GV});var kP=P(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var VV=Sn(),HV={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:VV.validateUnion,error:{message:"must match a schema in anyOf"}};kS.default=HV});var xP=P(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var ph=Ne(),qV=He(),WV={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ph._)`{passingSchemas: ${t.passing}}`},ZV={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:WV,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,qV.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,ph._)`${l} && ${o}`).assign(o,!1).assign(s,(0,ph._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,ph.Name)})})}}};xS.default=ZV});var EP=P(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var KV=He(),JV={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,KV.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};ES.default=JV});var IP=P(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});var mh=Ne(),CP=He(),XV={message:({params:t})=>(0,mh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,mh._)`{failingKeyword: ${t.ifClause}}`},YV={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:XV,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,CP.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=TP(n,"then"),a=TP(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,mh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,mh._)`${u}`):t.setParams({ifClause:u})}}}};function TP(t,e){let r=t.schema[e];return r!==void 0&&!(0,CP.alwaysValidSchema)(t,r)}TS.default=YV});var AP=P(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var QV=He(),e3={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,QV.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};CS.default=e3});var PP=P(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var t3=uS(),r3=oP(),n3=dS(),i3=lP(),a3=cP(),o3=pP(),s3=hP(),l3=bS(),c3=yP(),u3=SP(),d3=wP(),p3=kP(),m3=xP(),h3=EP(),f3=IP(),g3=AP();function y3(t=!1){let e=[d3.default,p3.default,m3.default,h3.default,f3.default,g3.default,s3.default,l3.default,o3.default,c3.default,u3.default];return t?e.push(r3.default,i3.default):e.push(t3.default,n3.default),e.push(a3.default),e}IS.default=y3});var RP=P(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var Nt=Ne(),b3={message:({schemaCode:t})=>(0,Nt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Nt._)`{format: ${t}}`},v3={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:b3,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Nt._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Nt._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Nt._)`${f}.type || "string"`).assign(g,(0,Nt._)`${f}.validate`),()=>r.assign(y,(0,Nt._)`"string"`).assign(g,f)),t.fail$data((0,Nt.or)(x(),v()));function x(){return l.strictSchema===!1?Nt.nil:(0,Nt._)`${o} && !${g}`}function v(){let I=u.$async?(0,Nt._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Nt._)`${g}(${n})`,T=(0,Nt._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Nt._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){x();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function x(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Nt.regexpCode)(T):l.code.formats?(0,Nt._)`${l.code.formats}${(0,Nt.getProperty)(a)}`:void 0,M=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Nt._)`${M}.validate`]:["string",T,M]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Nt._)`await ${g}(${n})`}return typeof y=="function"?(0,Nt._)`${g}(${n})`:(0,Nt._)`${g}.test(${n})`}}}};AS.default=v3});var NP=P(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var _3=RP(),S3=[_3.default];PS.default=S3});var OP=P(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.contentVocabulary=cl.metadataVocabulary=void 0;cl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];cl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var MP=P(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var w3=UA(),k3=rP(),x3=PP(),E3=NP(),DP=OP(),T3=[w3.default,k3.default,(0,x3.default)(),E3.default,DP.metadataVocabulary,DP.contentVocabulary];RS.default=T3});var LP=P(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.DiscrError=void 0;var $P;(function(t){t.Tag="tag",t.Mapping="mapping"})($P||(hh.DiscrError=$P={}))});var FP=P(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var ul=Ne(),NS=LP(),zP=Km(),C3=hu(),I3=He(),A3={message:({params:{discrError:t,tagName:e}})=>t===NS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ul._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},P3={keyword:"discriminator",type:"object",schemaType:"object",error:A3,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,ul._)`${r}${(0,ul.getProperty)(s)}`);e.if((0,ul._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:NS.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,ul._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:NS.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,ul.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];if(T?.$ref&&!(0,I3.schemaHasRulesButRef)(T,a.self.RULES)){let M=T.$ref;if(T=zP.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,M),T instanceof zP.SchemaEnv&&(T=T.schema),T===void 0)throw new C3.default(a.opts.uriResolver,a.baseId,M)}let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),x(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function x(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};OS.default=P3});var BP=P((Sue,R3)=>{R3.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 UP=P((yt,DS)=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.MissingRefError=yt.ValidationError=yt.CodeGen=yt.Name=yt.nil=yt.stringify=yt.str=yt._=yt.KeywordCxt=yt.Ajv=void 0;var N3=$A(),O3=MP(),D3=FP(),jP=BP(),M3=["/properties"],fh="http://json-schema.org/draft-07/schema",dl=class extends N3.default{_addVocabularies(){super._addVocabularies(),O3.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(D3.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(jP,M3):jP;this.addMetaSchema(e,fh,!1),this.refs["http://json-schema.org/schema"]=fh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(fh)?fh:void 0)}};yt.Ajv=dl;DS.exports=yt=dl;DS.exports.Ajv=dl;Object.defineProperty(yt,"__esModule",{value:!0});yt.default=dl;var $3=mu();Object.defineProperty(yt,"KeywordCxt",{enumerable:!0,get:function(){return $3.KeywordCxt}});var pl=Ne();Object.defineProperty(yt,"_",{enumerable:!0,get:function(){return pl._}});Object.defineProperty(yt,"str",{enumerable:!0,get:function(){return pl.str}});Object.defineProperty(yt,"stringify",{enumerable:!0,get:function(){return pl.stringify}});Object.defineProperty(yt,"nil",{enumerable:!0,get:function(){return pl.nil}});Object.defineProperty(yt,"Name",{enumerable:!0,get:function(){return pl.Name}});Object.defineProperty(yt,"CodeGen",{enumerable:!0,get:function(){return pl.CodeGen}});var L3=Wm();Object.defineProperty(yt,"ValidationError",{enumerable:!0,get:function(){return L3.default}});var z3=hu();Object.defineProperty(yt,"MissingRefError",{enumerable:!0,get:function(){return z3.default}})});var JP=P(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.formatNames=pi.fastFormats=pi.fullFormats=void 0;function di(t,e){return{validate:t,compare:e}}pi.fullFormats={date:di(qP,zS),time:di($S(!0),FS),"date-time":di(GP(!0),ZP),"iso-time":di($S(),WP),"iso-date-time":di(GP(),KP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:V3,"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:X3,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:H3,int32:{type:"number",validate:Z3},int64:{type:"number",validate:K3},float:{type:"number",validate:HP},double:{type:"number",validate:HP},password:!0,binary:!0};pi.fastFormats={...pi.fullFormats,date:di(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,zS),time:di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FS),"date-time":di(/^\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,ZP),"iso-time":di(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,WP),"iso-date-time":di(/^\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,KP),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};pi.formatNames=Object.keys(pi.fullFormats);function F3(t){return t%4===0&&(t%100!==0||t%400===0)}var B3=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,j3=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qP(t){let e=B3.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&F3(r)?29:j3[n])}function zS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var MS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $S(t){return function(r){let n=MS.exec(r);if(!n)return!1;let i=+n[1],a=+n[2],o=+n[3],s=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||t&&!s)return!1;if(i<=23&&a<=59&&o<60)return!0;let d=a-u*l,m=i-c*l-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}}function FS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function WP(t,e){if(!(t&&e))return;let r=MS.exec(t),n=MS.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var LS=/t|\s/i;function GP(t){let e=$S(t);return function(n){let i=n.split(LS);return i.length===2&&qP(i[0])&&e(i[1])}}function ZP(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function KP(t,e){if(!(t&&e))return;let[r,n]=t.split(LS),[i,a]=e.split(LS),o=zS(r,i);if(o!==void 0)return o||FS(n,a)}var U3=/\/|:/,G3=/^(?:[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 V3(t){return U3.test(t)&&G3.test(t)}var VP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function H3(t){return VP.lastIndex=0,VP.test(t)}var q3=-(2**31),W3=2**31-1;function Z3(t){return Number.isInteger(t)&&t<=W3&&t>=q3}function K3(t){return Number.isInteger(t)}function HP(){return!0}var J3=/[^\\]\\Z/;function X3(t){if(J3.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Pu=P(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.regexpCode=qe.getEsmExportName=qe.getProperty=qe.safeStringify=qe.stringify=qe.strConcat=qe.addCodeArg=qe.str=qe._=qe.nil=qe._Code=qe.Name=qe.IDENTIFIER=qe._CodeOrName=void 0;var Iu=class{};qe._CodeOrName=Iu;qe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var wo=class extends Iu{constructor(e){if(super(),!qe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};qe.Name=wo;var xn=class extends Iu{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof wo&&(r[n.str]=(r[n.str]||0)+1),r),{})}};qe._Code=xn;qe.nil=new xn("");function XP(t,...e){let r=[t[0]],n=0;for(;n<e.length;)jS(r,e[n]),r.push(t[++n]);return new xn(r)}qe._=XP;var BS=new xn("+");function YP(t,...e){let r=[Au(t[0])],n=0;for(;n<e.length;)r.push(BS),jS(r,e[n]),r.push(BS,Au(t[++n]));return Y3(r),new xn(r)}qe.str=YP;function jS(t,e){e instanceof xn?t.push(...e._items):e instanceof wo?t.push(e):t.push(t6(e))}qe.addCodeArg=jS;function Y3(t){let e=1;for(;e<t.length-1;){if(t[e]===BS){let r=Q3(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Q3(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof wo||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof wo))return`"${t}${e.slice(1)}`}function e6(t,e){return e.emptyStr()?t:t.emptyStr()?e:YP`${t}${e}`}qe.strConcat=e6;function t6(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Au(Array.isArray(t)?t.join(","):t)}function r6(t){return new xn(Au(t))}qe.stringify=r6;function Au(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qe.safeStringify=Au;function n6(t){return typeof t=="string"&&qe.IDENTIFIER.test(t)?new xn(`.${t}`):XP`[${t}]`}qe.getProperty=n6;function i6(t){if(typeof t=="string"&&qe.IDENTIFIER.test(t))return new xn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}qe.getEsmExportName=i6;function a6(t){return new xn(t.toString())}qe.regexpCode=a6});var HS=P(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.ValueScope=Ir.ValueScopeName=Ir.Scope=Ir.varKinds=Ir.UsedValueState=void 0;var Vr=Pu(),US=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},GS;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(GS=Ir.UsedValueState||(Ir.UsedValueState={}));Ir.varKinds={const:new Vr.Name("const"),let:new Vr.Name("let"),var:new Vr.Name("var")};var gh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Vr.Name?e:this.name(e)}name(e){return new Vr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ir.Scope=gh;var yh=class extends Vr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Vr._)`.${new Vr.Name(r)}[${n}]`}};Ir.ValueScopeName=yh;var o6=(0,Vr._)`\n`,VS=class extends gh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o6:Vr.nil}}get(){return this._scope}name(e){return new yh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let u=s.get(o);if(u)return u}else s=this._values[a]=new Map;s.set(o,i);let l=this._scope[a]||(this._scope[a]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:a,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Vr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let a=Vr.nil;for(let o in e){let s=e[o];if(!s)continue;let l=n[o]=n[o]||new Map;s.forEach(c=>{if(l.has(c))return;l.set(c,GS.Started);let u=r(c);if(u){let d=this.opts.es5?Ir.varKinds.var:Ir.varKinds.const;a=(0,Vr._)`${a}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))a=(0,Vr._)`${a}${u}${this.opts._n}`;else throw new US(c);l.set(c,GS.Completed)})}return a}};Ir.ValueScope=VS});var Ee=P(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.or=Ae.and=Ae.not=Ae.CodeGen=Ae.operators=Ae.varKinds=Ae.ValueScopeName=Ae.ValueScope=Ae.Scope=Ae.Name=Ae.regexpCode=Ae.stringify=Ae.getProperty=Ae.nil=Ae.strConcat=Ae.str=Ae._=void 0;var Fe=Pu(),Vn=HS(),Aa=Pu();Object.defineProperty(Ae,"_",{enumerable:!0,get:function(){return Aa._}});Object.defineProperty(Ae,"str",{enumerable:!0,get:function(){return Aa.str}});Object.defineProperty(Ae,"strConcat",{enumerable:!0,get:function(){return Aa.strConcat}});Object.defineProperty(Ae,"nil",{enumerable:!0,get:function(){return Aa.nil}});Object.defineProperty(Ae,"getProperty",{enumerable:!0,get:function(){return Aa.getProperty}});Object.defineProperty(Ae,"stringify",{enumerable:!0,get:function(){return Aa.stringify}});Object.defineProperty(Ae,"regexpCode",{enumerable:!0,get:function(){return Aa.regexpCode}});Object.defineProperty(Ae,"Name",{enumerable:!0,get:function(){return Aa.Name}});var Sh=HS();Object.defineProperty(Ae,"Scope",{enumerable:!0,get:function(){return Sh.Scope}});Object.defineProperty(Ae,"ValueScope",{enumerable:!0,get:function(){return Sh.ValueScope}});Object.defineProperty(Ae,"ValueScopeName",{enumerable:!0,get:function(){return Sh.ValueScopeName}});Object.defineProperty(Ae,"varKinds",{enumerable:!0,get:function(){return Sh.varKinds}});Ae.operators={GT:new Fe._Code(">"),GTE:new Fe._Code(">="),LT:new Fe._Code("<"),LTE:new Fe._Code("<="),EQ:new Fe._Code("==="),NEQ:new Fe._Code("!=="),NOT:new Fe._Code("!"),OR:new Fe._Code("||"),AND:new Fe._Code("&&"),ADD:new Fe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},qS=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Vn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=hl(this.rhs,e,r)),this}get names(){return this.rhs instanceof Fe._CodeOrName?this.rhs.names:{}}},bh=class extends Hi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Fe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=hl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Fe.Name?{}:{...this.lhs.names};return _h(e,this.rhs)}},WS=class extends bh{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ZS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},KS=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},JS=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},XS=class extends Hi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=hl(this.code,e,r),this}get names(){return this.code instanceof Fe._CodeOrName?this.code.names:{}}},Ru=class extends Hi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(e,r)||(s6(e,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Eo(e,r.names),{})}},qi=class extends Ru{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},YS=class extends Ru{},ml=class extends qi{};ml.kind="else";var ko=class t extends qi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ml(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(QP(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=hl(this.condition,e,r),this}get names(){let e=super.names;return _h(e,this.condition),this.else&&Eo(e,this.else.names),e}};ko.kind="if";var xo=class extends qi{};xo.kind="for";var QS=class extends xo{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=hl(this.iteration,e,r),this}get names(){return Eo(super.names,this.iteration.names)}},ew=class extends xo{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Vn.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(e)}get names(){let e=_h(super.names,this.from);return _h(e,this.to)}},vh=class extends xo{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=hl(this.iterable,e,r),this}get names(){return Eo(super.names,this.iterable.names)}},Nu=class extends qi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Nu.kind="func";var Ou=class extends Ru{render(e){return"return "+super.render(e)}};Ou.kind="return";var tw=class extends qi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Eo(e,this.catch.names),this.finally&&Eo(e,this.finally.names),e}},Du=class extends qi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Du.kind="catch";var Mu=class extends qi{render(e){return"finally"+super.render(e)}};Mu.kind="finally";var rw=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
9
|
+
`:""},this._extScope=e,this._scope=new Vn.Scope({parent:e}),this._nodes=[new YS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new qS(e,a,n)),a}const(e,r,n){return this._def(Vn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Vn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Vn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new bh(e,r,n))}add(e,r){return this._leafNode(new WS(e,Ae.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Fe.nil&&this._leafNode(new XS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Fe.addCodeArg)(r,i));return r.push("}"),new Fe._Code(r)}if(e,r,n){if(this._blockNode(new ko(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ko(e))}else(){return this._elseNode(new ml)}endIf(){return this._endBlockNode(ko,ml)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new QS(e),r)}forRange(e,r,n,i,a=this.opts.es5?Vn.varKinds.var:Vn.varKinds.let){let o=this._scope.toName(e);return this._for(new ew(a,o,r,n),()=>i(o))}forOf(e,r,n,i=Vn.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Fe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Fe._)`${o}.length`,s=>{this.var(a,(0,Fe._)`${o}[${s}]`),n(a)})}return this._for(new vh("of",i,a,r),()=>n(a))}forIn(e,r,n,i=this.opts.es5?Vn.varKinds.var:Vn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Fe._)`Object.keys(${r})`,n);let a=this._scope.toName(e);return this._for(new vh("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(xo)}label(e){return this._leafNode(new ZS(e))}break(e){return this._leafNode(new KS(e))}return(e){let r=new Ou;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ou)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new tw;if(this._blockNode(i),this.code(e),r){let a=this.name("e");this._currNode=i.catch=new Du(a),r(a)}return n&&(this._currNode=i.finally=new Mu,this.code(n)),this._endBlockNode(Du,Mu)}throw(e){return this._leafNode(new JS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Fe.nil,n,i){return this._blockNode(new Nu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Nu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ko))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ae.CodeGen=rw;function Eo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function _h(t,e){return e instanceof Fe._CodeOrName?Eo(t,e.names):t}function hl(t,e,r){if(t instanceof Fe.Name)return n(t);if(!i(t))return t;return new Fe._Code(t._items.reduce((a,o)=>(o instanceof Fe.Name&&(o=n(o)),o instanceof Fe._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||e[a.str]!==1?a:(delete e[a.str],o)}function i(a){return a instanceof Fe._Code&&a._items.some(o=>o instanceof Fe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function s6(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function QP(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Fe._)`!${nw(t)}`}Ae.not=QP;var l6=eR(Ae.operators.AND);function c6(...t){return t.reduce(l6)}Ae.and=c6;var u6=eR(Ae.operators.OR);function d6(...t){return t.reduce(u6)}Ae.or=d6;function eR(t){return(e,r)=>e===Fe.nil?r:r===Fe.nil?e:(0,Fe._)`${nw(e)} ${t} ${nw(r)}`}function nw(t){return t instanceof Fe.Name?t:(0,Fe._)`(${t})`}});var We=P(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.checkStrictMode=Pe.getErrorPath=Pe.Type=Pe.useFunc=Pe.setEvaluated=Pe.evaluatedPropsToName=Pe.mergeEvaluated=Pe.eachItem=Pe.unescapeJsonPointer=Pe.escapeJsonPointer=Pe.escapeFragment=Pe.unescapeFragment=Pe.schemaRefOrVal=Pe.schemaHasRulesButRef=Pe.schemaHasRules=Pe.checkUnknownRules=Pe.alwaysValidSchema=Pe.toHash=void 0;var lt=Ee(),p6=Pu();function m6(t){let e={};for(let r of t)e[r]=!0;return e}Pe.toHash=m6;function h6(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(nR(t,e),!iR(e,t.self.RULES.all))}Pe.alwaysValidSchema=h6;function nR(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let a in e)i[a]||lR(t,`unknown keyword: "${a}"`)}Pe.checkUnknownRules=nR;function iR(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Pe.schemaHasRules=iR;function f6(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Pe.schemaHasRulesButRef=f6;function g6({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,lt._)`${r}`}return(0,lt._)`${t}${e}${(0,lt.getProperty)(n)}`}Pe.schemaRefOrVal=g6;function y6(t){return aR(decodeURIComponent(t))}Pe.unescapeFragment=y6;function b6(t){return encodeURIComponent(iw(t))}Pe.escapeFragment=b6;function iw(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Pe.escapeJsonPointer=iw;function aR(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Pe.unescapeJsonPointer=aR;function v6(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Pe.eachItem=v6;function tR({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let l=o===void 0?a:o instanceof lt.Name?(a instanceof lt.Name?t(i,a,o):e(i,a,o),o):a instanceof lt.Name?(e(i,o,a),a):r(a,o);return s===lt.Name&&!(l instanceof lt.Name)?n(i,l):l}}Pe.mergeEvaluated={props:tR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,lt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,lt._)`${r} || {}`).code((0,lt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,lt._)`${r} || {}`),aw(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:oR}),items:tR({mergeNames:(t,e,r)=>t.if((0,lt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,lt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,lt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,lt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function oR(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,lt._)`{}`);return e!==void 0&&aw(t,r,e),r}Pe.evaluatedPropsToName=oR;function aw(t,e,r){Object.keys(r).forEach(n=>t.assign((0,lt._)`${e}${(0,lt.getProperty)(n)}`,!0))}Pe.setEvaluated=aw;var rR={};function _6(t,e){return t.scopeValue("func",{ref:e,code:rR[e.code]||(rR[e.code]=new p6._Code(e.code))})}Pe.useFunc=_6;var sR;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(sR=Pe.Type||(Pe.Type={}));function S6(t,e,r){if(t instanceof lt.Name){let n=e===sR.Num;return r?n?(0,lt._)`"[" + ${t} + "]"`:(0,lt._)`"['" + ${t} + "']"`:n?(0,lt._)`"/" + ${t}`:(0,lt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,lt.getProperty)(t).toString():"/"+iw(t)}Pe.getErrorPath=S6;function lR(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Pe.checkStrictMode=lR});var Wi=P(ow=>{"use strict";Object.defineProperty(ow,"__esModule",{value:!0});var vr=Ee(),w6={data:new vr.Name("data"),valCxt:new vr.Name("valCxt"),instancePath:new vr.Name("instancePath"),parentData:new vr.Name("parentData"),parentDataProperty:new vr.Name("parentDataProperty"),rootData:new vr.Name("rootData"),dynamicAnchors:new vr.Name("dynamicAnchors"),vErrors:new vr.Name("vErrors"),errors:new vr.Name("errors"),this:new vr.Name("this"),self:new vr.Name("self"),scope:new vr.Name("scope"),json:new vr.Name("json"),jsonPos:new vr.Name("jsonPos"),jsonLen:new vr.Name("jsonLen"),jsonPart:new vr.Name("jsonPart")};ow.default=w6});var $u=P(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendErrors=_r.resetErrorsCount=_r.reportExtraError=_r.reportError=_r.keyword$DataError=_r.keywordError=void 0;var Ue=Ee(),wh=We(),Ar=Wi();_r.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};_r.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function k6(t,e=_r.keywordError,r,n){let{it:i}=t,{gen:a,compositeRule:o,allErrors:s}=i,l=dR(t,e,r);n??(o||s)?cR(a,l):uR(i,(0,Ue._)`[${l}]`)}_r.reportError=k6;function x6(t,e=_r.keywordError,r){let{it:n}=t,{gen:i,compositeRule:a,allErrors:o}=n,s=dR(t,e,r);cR(i,s),a||o||uR(n,Ar.default.vErrors)}_r.reportExtraError=x6;function E6(t,e){t.assign(Ar.default.errors,e),t.if((0,Ue._)`${Ar.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${Ar.default.vErrors}.length`,e),()=>t.assign(Ar.default.vErrors,null)))}_r.resetErrorsCount=E6;function T6({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Ar.default.errors,s=>{t.const(o,(0,Ue._)`${Ar.default.vErrors}[${s}]`),t.if((0,Ue._)`${o}.instancePath === undefined`,()=>t.assign((0,Ue._)`${o}.instancePath`,(0,Ue.strConcat)(Ar.default.instancePath,a.errorPath))),t.assign((0,Ue._)`${o}.schemaPath`,(0,Ue.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,Ue._)`${o}.schema`,r),t.assign((0,Ue._)`${o}.data`,n))})}_r.extendErrors=T6;function cR(t,e){let r=t.const("err",e);t.if((0,Ue._)`${Ar.default.vErrors} === null`,()=>t.assign(Ar.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${Ar.default.vErrors}.push(${r})`),t.code((0,Ue._)`${Ar.default.errors}++`)}function uR(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ue._)`${n}.errors`,e),r.return(!1))}var To={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function dR(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ue._)`{}`:C6(t,e,r)}function C6(t,e,r={}){let{gen:n,it:i}=t,a=[I6(i,r),A6(t,r)];return P6(t,e,a),n.object(...a)}function I6({errorPath:t},{instancePath:e}){let r=e?(0,Ue.str)`${t}${(0,wh.getErrorPath)(e,wh.Type.Str)}`:t;return[Ar.default.instancePath,(0,Ue.strConcat)(Ar.default.instancePath,r)]}function A6({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ue.str)`${e}/${t}`;return r&&(i=(0,Ue.str)`${i}${(0,wh.getErrorPath)(r,wh.Type.Str)}`),[To.schemaPath,i]}function P6(t,{params:e,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;n.push([To.keyword,i],[To.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),l.messages&&n.push([To.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([To.schema,o],[To.parentSchema,(0,Ue._)`${u}${d}`],[Ar.default.data,a]),c&&n.push([To.propertyName,c])}});var mR=P(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.boolOrEmptySchema=fl.topBoolOrEmptySchema=void 0;var R6=$u(),N6=Ee(),O6=Wi(),D6={message:"boolean schema is false"};function M6(t){let{gen:e,schema:r,validateName:n}=t;r===!1?pR(t,!1):typeof r=="object"&&r.$async===!0?e.return(O6.default.data):(e.assign((0,N6._)`${n}.errors`,null),e.return(!0))}fl.topBoolOrEmptySchema=M6;function $6(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),pR(t)):r.var(e,!0)}fl.boolOrEmptySchema=$6;function pR(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,R6.reportError)(i,D6,void 0,e)}});var sw=P(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.getRules=gl.isJSONType=void 0;var L6=["string","number","integer","boolean","null","object","array"],z6=new Set(L6);function F6(t){return typeof t=="string"&&z6.has(t)}gl.isJSONType=F6;function B6(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}gl.getRules=B6});var lw=P(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.shouldUseRule=Pa.shouldUseGroup=Pa.schemaHasRulesForType=void 0;function j6({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&hR(t,n)}Pa.schemaHasRulesForType=j6;function hR(t,e){return e.rules.some(r=>fR(t,r))}Pa.shouldUseGroup=hR;function fR(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Pa.shouldUseRule=fR});var zu=P(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.reportTypeError=or.checkDataTypes=or.checkDataType=or.coerceAndCheckDataType=or.getJSONTypes=or.getSchemaTypes=or.DataType=void 0;var U6=sw(),G6=lw(),V6=$u(),xe=Ee(),gR=We(),Lu;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Lu=or.DataType||(or.DataType={}));function H6(t){let e=yR(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}or.getSchemaTypes=H6;function yR(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(U6.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}or.getJSONTypes=yR;function q6(t,e){let{gen:r,data:n,opts:i}=t,a=W6(e,i.coerceTypes),o=e.length>0&&!(a.length===0&&e.length===1&&(0,G6.schemaHasRulesForType)(t,e[0]));if(o){let s=uw(e,n,i.strictNumbers,Lu.Wrong);r.if(s,()=>{a.length?Z6(t,e,a):dw(t)})}return o}or.coerceAndCheckDataType=q6;var bR=new Set(["string","number","integer","boolean","null"]);function W6(t,e){return e?t.filter(r=>bR.has(r)||e==="array"&&r==="array"):[]}function Z6(t,e,r){let{gen:n,data:i,opts:a}=t,o=n.let("dataType",(0,xe._)`typeof ${i}`),s=n.let("coerced",(0,xe._)`undefined`);a.coerceTypes==="array"&&n.if((0,xe._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,xe._)`${i}[0]`).assign(o,(0,xe._)`typeof ${i}`).if(uw(e,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,xe._)`${s} !== undefined`);for(let c of r)(bR.has(c)||c==="array"&&a.coerceTypes==="array")&&l(c);n.else(),dw(t),n.endIf(),n.if((0,xe._)`${s} !== undefined`,()=>{n.assign(i,s),K6(t,s)});function l(c){switch(c){case"string":n.elseIf((0,xe._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,xe._)`"" + ${i}`).elseIf((0,xe._)`${i} === null`).assign(s,(0,xe._)`""`);return;case"number":n.elseIf((0,xe._)`${o} == "boolean" || ${i} === null
|
|
10
10
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,xe._)`+${i}`);return;case"integer":n.elseIf((0,xe._)`${o} === "boolean" || ${i} === null
|
|
11
11
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,xe._)`+${i}`);return;case"boolean":n.elseIf((0,xe._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,xe._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,xe._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,xe._)`${o} === "string" || ${o} === "number"
|
|
12
|
-
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,xe._)`[${i}]`)}}}function Z6({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,xe._)`${e} !== undefined`,()=>t.assign((0,xe._)`${e}[${r}]`,n))}function QS(t,e,r,n=Du.Correct){let i=n===Du.Correct?xe.operators.EQ:xe.operators.NEQ,a;switch(t){case"null":return(0,xe._)`${e} ${i} null`;case"array":a=(0,xe._)`Array.isArray(${e})`;break;case"object":a=(0,xe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,xe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,xe._)`typeof ${e} ${i} ${t}`}return n===Du.Correct?a:(0,xe.not)(a);function o(s=xe.nil){return(0,xe.and)((0,xe._)`typeof ${e} == "number"`,s,r?(0,xe._)`isFinite(${e})`:xe.nil)}}ar.checkDataType=QS;function ew(t,e,r,n){if(t.length===1)return QS(t[0],e,r,n);let i,a=(0,fR.toHash)(t);if(a.array&&a.object){let o=(0,xe._)`typeof ${e} != "object"`;i=a.null?o:(0,xe._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=xe.nil;a.number&&delete a.integer;for(let o in a)i=(0,xe.and)(i,QS(o,e,r,n));return i}ar.checkDataTypes=ew;var K6={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,xe._)`{type: ${t}}`:(0,xe._)`{type: ${e}}`};function tw(t){let e=J6(t);(0,G6.reportError)(e,K6)}ar.reportTypeError=tw;function J6(t){let{gen:e,data:r,schema:n}=t,i=(0,fR.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var vR=P(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.assignDefaults=void 0;var gl=Ee(),X6=We();function Y6(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)bR(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>bR(t,a,i.default))}Sh.assignDefaults=Y6;function bR(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,gl._)`${a}${(0,gl.getProperty)(e)}`;if(i){(0,X6.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,gl._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,gl._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,gl._)`${s} = ${(0,gl.stringify)(r)}`)}});var En=P(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateUnion=at.validateArray=at.usePattern=at.callValidateCode=at.schemaProperties=at.allSchemaProperties=at.noPropertyInData=at.propertyInData=at.isOwnProperty=at.hasPropFunc=at.reportMissingProp=at.checkMissingProp=at.checkReportMissingProp=void 0;var bt=Ee(),rw=We(),Ra=Wi(),Q6=We();function eH(t,e){let{gen:r,data:n,it:i}=t;r.if(iw(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,bt._)`${e}`},!0),t.error()})}at.checkReportMissingProp=eH;function tH({gen:t,data:e,it:{opts:r}},n,i){return(0,bt.or)(...n.map(a=>(0,bt.and)(iw(t,e,a,r.ownProperties),(0,bt._)`${i} = ${a}`)))}at.checkMissingProp=tH;function rH(t,e){t.setParams({missingProperty:e},!0),t.error()}at.reportMissingProp=rH;function _R(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,bt._)`Object.prototype.hasOwnProperty`})}at.hasPropFunc=_R;function nw(t,e,r){return(0,bt._)`${_R(t)}.call(${e}, ${r})`}at.isOwnProperty=nw;function nH(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} !== undefined`;return n?(0,bt._)`${i} && ${nw(t,e,r)}`:i}at.propertyInData=nH;function iw(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} === undefined`;return n?(0,bt.or)(i,(0,bt.not)(nw(t,e,r))):i}at.noPropertyInData=iw;function SR(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}at.allSchemaProperties=SR;function iH(t,e){return SR(e).filter(r=>!(0,rw.alwaysValidSchema)(t,e[r]))}at.schemaProperties=iH;function aH({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,bt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ra.default.instancePath,(0,bt.strConcat)(Ra.default.instancePath,a)],[Ra.default.parentData,o.parentData],[Ra.default.parentDataProperty,o.parentDataProperty],[Ra.default.rootData,Ra.default.rootData]];o.opts.dynamicRef&&d.push([Ra.default.dynamicAnchors,Ra.default.dynamicAnchors]);let m=(0,bt._)`${u}, ${r.object(...d)}`;return l!==bt.nil?(0,bt._)`${s}.call(${l}, ${m})`:(0,bt._)`${s}(${m})`}at.callValidateCode=aH;var oH=(0,bt._)`new RegExp`;function sH({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,bt._)`${i.code==="new RegExp"?oH:(0,Q6.useFunc)(t,i)}(${r}, ${n})`})}at.usePattern=sH;function lH(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,bt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:rw.Type.Num},a),e.if((0,bt.not)(a),s)})}}at.validateArray=lH;function cH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,rw.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,bt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,bt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}at.validateUnion=cH});var xR=P(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateKeywordUsage=mi.validSchemaType=mi.funcKeywordCode=mi.macroKeywordCode=void 0;var Pr=Ee(),Co=Wi(),uH=En(),dH=Ou();function pH(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=kR(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Pr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}mi.macroKeywordCode=pH;function mH(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;fH(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=kR(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&wR(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&wR(t),y(()=>hH(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Pr._)`await `),S=>n.assign(d,!1).if((0,Pr._)`${S} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Pr._)`${S}.errors`),()=>n.throw(S))),g}function h(){let g=(0,Pr._)`${u}.errors`;return n.assign(g,null),f(Pr.nil),g}function f(g=e.async?(0,Pr._)`await `:Pr.nil){let S=l.opts.passContext?Co.default.this:Co.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Pr._)`${g}${(0,uH.callValidateCode)(t,u,S,v)}`,e.modifying)}function y(g){var S;n.if((0,Pr.not)((S=e.valid)!==null&&S!==void 0?S:d),g)}}mi.funcKeywordCode=mH;function wR(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Pr._)`${n.parentData}[${n.parentDataProperty}]`))}function hH(t,e){let{gen:r}=t;r.if((0,Pr._)`Array.isArray(${e})`,()=>{r.assign(Co.default.vErrors,(0,Pr._)`${Co.default.vErrors} === null ? ${e} : ${Co.default.vErrors}.concat(${e})`).assign(Co.default.errors,(0,Pr._)`${Co.default.vErrors}.length`),(0,dH.extendErrors)(t)},()=>t.error())}function fH({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function kR(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Pr.stringify)(r)})}function gH(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}mi.validSchemaType=gH;function yH({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}mi.validateKeywordUsage=yH});var TR=P(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.extendSubschemaMode=Na.extendSubschemaData=Na.getSubschema=void 0;var hi=Ee(),ER=We();function bH(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}${(0,hi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,ER.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Na.getSubschema=bH;function vH(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,hi._)`${e.data}${(0,hi.getProperty)(r)}`,!0);l(m),t.errorPath=(0,hi.str)`${c}${(0,ER.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,hi._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof hi.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Na.extendSubschemaData=vH;function _H(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Na.extendSubschemaMode=_H});var $u=P(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.getSchemaRefs=Hr.resolveUrl=Hr.normalizeId=Hr._getFullPath=Hr.getFullPath=Hr.inlineRef=void 0;var SH=We(),wH=ou(),kH=g_(),xH=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function EH(t,e=!0){return typeof t=="boolean"?!0:e===!0?!aw(t):e?CR(t)<=e:!1}Hr.inlineRef=EH;var TH=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function aw(t){for(let e in t){if(TH.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(aw)||typeof r=="object"&&aw(r))return!0}return!1}function CR(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!xH.has(r)&&(typeof t[r]=="object"&&(0,SH.eachItem)(t[r],n=>e+=CR(n)),e===1/0))return 1/0}return e}function IR(t,e="",r){r!==!1&&(e=yl(e));let n=t.parse(e);return AR(t,n)}Hr.getFullPath=IR;function AR(t,e){return t.serialize(e).split("#")[0]+"#"}Hr._getFullPath=AR;var CH=/#\/?$/;function yl(t){return t?t.replace(CH,""):""}Hr.normalizeId=yl;function IH(t,e,r){return r=yl(r),t.resolve(e,r)}Hr.resolveUrl=IH;var AH=/^[a-z_][-a-z0-9._]*$/i;function PH(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=yl(t[r]||e),a={"":i},o=IR(n,i,!1),s={},l=new Set;return kH(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=yl(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==yl(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function S(v){if(typeof v=="string"){if(!AH.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!wH(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Hr.getSchemaRefs=PH});var Fu=P(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.getData=Oa.KeywordCxt=Oa.validateFunctionCode=void 0;var DR=pR(),PR=Mu(),sw=YS(),wh=Mu(),RH=vR(),zu=xR(),ow=TR(),ne=Ee(),ge=Wi(),NH=$u(),Zi=We(),Lu=Ou();function OH(t){if(LR(t)&&(zR(t),$R(t))){$H(t);return}MR(t,()=>(0,DR.topBoolOrEmptySchema)(t))}Oa.validateFunctionCode=OH;function MR({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,ne._)`${ge.default.data}, ${ge.default.valCxt}`,n.$async,()=>{t.code((0,ne._)`"use strict"; ${RR(r,i)}`),MH(t,i),t.code(a)}):t.func(e,(0,ne._)`${ge.default.data}, ${DH(i)}`,n.$async,()=>t.code(RR(r,i)).code(a))}function DH(t){return(0,ne._)`{${ge.default.instancePath}="", ${ge.default.parentData}, ${ge.default.parentDataProperty}, ${ge.default.rootData}=${ge.default.data}${t.dynamicRef?(0,ne._)`, ${ge.default.dynamicAnchors}={}`:ne.nil}}={}`}function MH(t,e){t.if(ge.default.valCxt,()=>{t.var(ge.default.instancePath,(0,ne._)`${ge.default.valCxt}.${ge.default.instancePath}`),t.var(ge.default.parentData,(0,ne._)`${ge.default.valCxt}.${ge.default.parentData}`),t.var(ge.default.parentDataProperty,(0,ne._)`${ge.default.valCxt}.${ge.default.parentDataProperty}`),t.var(ge.default.rootData,(0,ne._)`${ge.default.valCxt}.${ge.default.rootData}`),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`${ge.default.valCxt}.${ge.default.dynamicAnchors}`)},()=>{t.var(ge.default.instancePath,(0,ne._)`""`),t.var(ge.default.parentData,(0,ne._)`undefined`),t.var(ge.default.parentDataProperty,(0,ne._)`undefined`),t.var(ge.default.rootData,ge.default.data),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`{}`)})}function $H(t){let{schema:e,opts:r,gen:n}=t;MR(t,()=>{r.$comment&&e.$comment&&BR(t),jH(t),n.let(ge.default.vErrors,null),n.let(ge.default.errors,0),r.unevaluated&&LH(t),FR(t),VH(t)})}function LH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ne._)`${r}.evaluated`),e.if((0,ne._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ne._)`${t.evaluated}.props`,(0,ne._)`undefined`)),e.if((0,ne._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ne._)`${t.evaluated}.items`,(0,ne._)`undefined`))}function RR(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ne._)`/*# sourceURL=${r} */`:ne.nil}function zH(t,e){if(LR(t)&&(zR(t),$R(t))){FH(t,e);return}(0,DR.boolOrEmptySchema)(t,e)}function $R({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function LR(t){return typeof t.schema!="boolean"}function FH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&BR(t),UH(t),GH(t);let a=n.const("_errs",ge.default.errors);FR(t,a),n.var(e,(0,ne._)`${a} === ${ge.default.errors}`)}function zR(t){(0,Zi.checkUnknownRules)(t),BH(t)}function FR(t,e){if(t.opts.jtd)return NR(t,[],!1,e);let r=(0,PR.getSchemaTypes)(t.schema),n=(0,PR.coerceAndCheckDataType)(t,r);NR(t,r,!n,e)}function BH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function jH(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zi.checkStrictMode)(t,"default is ignored in the schema root")}function UH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,NH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function GH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function BR({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,ne._)`${ge.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,ne.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,ne._)`${ge.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function VH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,ne._)`${ge.default.errors} === 0`,()=>e.return(ge.default.data),()=>e.throw((0,ne._)`new ${i}(${ge.default.vErrors})`)):(e.assign((0,ne._)`${n}.errors`,ge.default.vErrors),a.unevaluated&&HH(t),e.return((0,ne._)`${ge.default.errors} === 0`))}function HH({gen:t,evaluated:e,props:r,items:n}){r instanceof ne.Name&&t.assign((0,ne._)`${e}.props`,r),n instanceof ne.Name&&t.assign((0,ne._)`${e}.items`,n)}function NR(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Zi.schemaHasRulesButRef)(a,u))){i.block(()=>UR(t,"$ref",u.all.$ref.definition));return}l.jtd||qH(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,sw.shouldUseGroup)(a,m)&&(m.type?(i.if((0,wh.checkDataType)(m.type,o,l.strictNumbers)),OR(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,wh.reportTypeError)(t)),i.endIf()):OR(t,m),s||i.if((0,ne._)`${ge.default.errors} === ${n||0}`))}}function OR(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,RH.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,sw.shouldUseRule)(n,a)&&UR(t,a.keyword,a.definition,e.type)})}function qH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(WH(t,e),t.opts.allowUnionTypes||ZH(t,e),KH(t,t.dataTypes))}function WH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{jR(t.dataTypes,r)||lw(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),XH(t,e)}}function ZH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&lw(t,"use allowUnionTypes to allow union type keyword")}function KH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,sw.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>JH(e,o))&&lw(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function JH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function jR(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function XH(t,e){let r=[];for(let n of t.dataTypes)jR(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function lw(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Zi.checkStrictMode)(t,e,t.opts.strictTypes)}var kh=class{constructor(e,r,n){if((0,zu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",GR(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,zu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ge.default.errors))}result(e,r,n){this.failResult((0,ne.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ne.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ne._)`${r} !== undefined && (${(0,ne.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Lu.reportExtraError:Lu.reportError)(this,this.def.error,r)}$dataError(){(0,Lu.reportError)(this,this.def.$dataError||Lu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Lu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ne.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ne.nil,r=ne.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,ne.or)((0,ne._)`${i} === undefined`,r)),e!==ne.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,ne.or)(o(),s());function o(){if(n.length){if(!(r instanceof ne.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,ne._)`${(0,wh.checkDataTypes)(l,r,a.opts.strictNumbers,wh.DataType.Wrong)}`}return ne.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ne._)`!${l}(${r})`}return ne.nil}}subschema(e,r){let n=(0,ow.getSubschema)(this.it,e);(0,ow.extendSubschemaData)(n,this.it,e),(0,ow.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return zH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Zi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ne.Name)),!0}};Oa.KeywordCxt=kh;function UR(t,e,r,n){let i=new kh(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,zu.funcKeywordCode)(i,r):"macro"in r?(0,zu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,zu.funcKeywordCode)(i,r)}var YH=/^\/(?:[^~]|~0|~1)*$/,QH=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GR(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return ge.default.rootData;if(t[0]==="/"){if(!YH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=ge.default.rootData}else{let c=QH.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,ne._)`${a}${(0,ne.getProperty)((0,Zi.unescapeJsonPointer)(c))}`,o=(0,ne._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Oa.getData=GR});var xh=P(uw=>{"use strict";Object.defineProperty(uw,"__esModule",{value:!0});var cw=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};uw.default=cw});var Eh=P(mw=>{"use strict";Object.defineProperty(mw,"__esModule",{value:!0});var dw=$u(),pw=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dw.resolveUrl)(e,r,n),this.missingSchema=(0,dw.normalizeId)((0,dw.getFullPath)(e,this.missingRef))}};mw.default=pw});var Ch=P(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.resolveSchema=Tn.getCompilingSchema=Tn.resolveRef=Tn.compileSchema=Tn.SchemaEnv=void 0;var Hn=Ee(),eq=xh(),Io=Wi(),qn=$u(),VR=We(),tq=Fu(),bl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Tn.SchemaEnv=bl;function fw(t){let e=HR.call(this,t);if(e)return e;let r=(0,qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new Hn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:eq.default,code:(0,Hn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:Io.default.data,parentData:Io.default.parentData,parentDataProperty:Io.default.parentDataProperty,dataNames:[Io.default.data],dataPathArr:[Hn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Hn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Hn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Hn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,tq.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Io.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Io.default.self}`,`${Io.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof Hn.Name?void 0:h,items:f instanceof Hn.Name?void 0:f,dynamicProps:h instanceof Hn.Name,dynamicItems:f instanceof Hn.Name},p.source&&(p.source.evaluated=(0,Hn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Tn.compileSchema=fw;function rq(t,e,r){var n;r=(0,qn.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=aq.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new bl({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=nq.call(this,a)}Tn.resolveRef=rq;function nq(t){return(0,qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:fw.call(this,t)}function HR(t){for(let e of this._compilations)if(iq(e,t))return e}Tn.getCompilingSchema=HR;function iq(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function aq(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Th.call(this,t,e)}function Th(t,e){let r=this.opts.uriResolver.parse(e),n=(0,qn._getFullPath)(this.opts.uriResolver,r),i=(0,qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return hw.call(this,r,t);let a=(0,qn.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=Th.call(this,t,o);return typeof s?.schema!="object"?void 0:hw.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||fw.call(this,o),a===(0,qn.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,qn.resolveUrl)(this.opts.uriResolver,i,c)),new bl({schema:s,schemaId:l,root:t,baseId:i})}return hw.call(this,r,o)}}Tn.resolveSchema=Th;var oq=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function hw(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,VR.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!oq.has(s)&&c&&(e=(0,qn.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,VR.schemaHasRulesButRef)(r,this.RULES)){let s=(0,qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=Th.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new bl({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var qR=P((jue,sq)=>{sq.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 ZR=P((Ih,WR)=>{"use strict";(function(t,e){typeof Ih=="object"&&typeof WR<"u"?e(Ih):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Ih,function(t){"use strict";function e(){for(var _=arguments.length,b=Array(_),E=0;E<_;E++)b[E]=arguments[E];if(b.length>1){b[0]=b[0].slice(0,-1);for(var A=b.length-1,R=1;R<A;++R)b[R]=b[R].slice(1,-1);return b[A]=b[A].slice(1),b.join("")}else return b[0]}function r(_){return"(?:"+_+")"}function n(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function i(_){return _.toUpperCase()}function a(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,b){var E=_;if(b)for(var A in b)E[A]=b[A];return E}function s(_){var b="[A-Za-z]",E="[\\x0D]",A="[0-9]",R="[\\x22]",J=e(A,"[A-Fa-f]"),we="[\\x0A]",Ge="[\\x20]",Ye=r(r("%[EFef]"+J+"%"+J+J+"%"+J+J)+"|"+r("%[89A-Fa-f]"+J+"%"+J+J)+"|"+r("%"+J+J)),Ft="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",xt=e(Ft,Be),Bt=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",vt=_?"[\\uE000-\\uF8FF]":"[]",Ze=e(b,A,"[\\-\\.\\_\\~]",Bt),Et=r(b+e(b,A,"[\\+\\-\\.]")+"*"),rt=r(r(Ye+"|"+e(Ze,Be,"[\\:]"))+"*"),Ha=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("[1-9]"+A)+"|"+A),Jr=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("0?[1-9]"+A)+"|0?0?"+A),pn=r(Jr+"\\."+Jr+"\\."+Jr+"\\."+Jr),ot=r(J+"{1,4}"),Xr=r(r(ot+"\\:"+ot)+"|"+pn),mn=r(r(ot+"\\:")+"{6}"+Xr),Qn=r("\\:\\:"+r(ot+"\\:")+"{5}"+Xr),qa=r(r(ot)+"?\\:\\:"+r(ot+"\\:")+"{4}"+Xr),wi=r(r(r(ot+"\\:")+"{0,1}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{3}"+Xr),Jl=r(r(r(ot+"\\:")+"{0,2}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{2}"+Xr),Zd=r(r(r(ot+"\\:")+"{0,3}"+ot)+"?\\:\\:"+ot+"\\:"+Xr),Kd=r(r(r(ot+"\\:")+"{0,4}"+ot)+"?\\:\\:"+Xr),Ko=r(r(r(ot+"\\:")+"{0,5}"+ot)+"?\\:\\:"+ot),Jo=r(r(r(ot+"\\:")+"{0,6}"+ot)+"?\\:\\:"),ki=r([mn,Qn,qa,wi,Jl,Zd,Kd,Ko,Jo].join("|")),Xo=r(r(Ze+"|"+Ye)+"+"),dg=r(ki+"\\%25"+Xo),Wa=r(ki+r("\\%25|\\%(?!"+J+"{2})")+Xo),xM=r("[vV]"+J+"+\\."+e(Ze,Be,"[\\:]")+"+"),EM=r("\\["+r(Wa+"|"+ki+"|"+xM)+"\\]"),Vx=r(r(Ye+"|"+e(Ze,Be))+"*"),Xl=r(EM+"|"+pn+"(?!"+Vx+")|"+Vx),Yl=r(A+"*"),Hx=r(r(rt+"@")+"?"+Xl+r("\\:"+Yl)+"?"),Ql=r(Ye+"|"+e(Ze,Be,"[\\:\\@]")),TM=r(Ql+"*"),qx=r(Ql+"+"),CM=r(r(Ye+"|"+e(Ze,Be,"[\\@]"))+"+"),xi=r(r("\\/"+TM)+"*"),Yo=r("\\/"+r(qx+xi)+"?"),pg=r(CM+xi),Jd=r(qx+xi),Qo="(?!"+Ql+")",S7=r(xi+"|"+Yo+"|"+pg+"|"+Jd+"|"+Qo),es=r(r(Ql+"|"+e("[\\/\\?]",vt))+"*"),ec=r(r(Ql+"|[\\/\\?]")+"*"),Wx=r(r("\\/\\/"+Hx+xi)+"|"+Yo+"|"+Jd+"|"+Qo),IM=r(Et+"\\:"+Wx+r("\\?"+es)+"?"+r("\\#"+ec)+"?"),AM=r(r("\\/\\/"+Hx+xi)+"|"+Yo+"|"+pg+"|"+Qo),PM=r(AM+r("\\?"+es)+"?"+r("\\#"+ec)+"?"),w7=r(IM+"|"+PM),k7=r(Et+"\\:"+Wx+r("\\?"+es)+"?"),x7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Xl+")"+r("\\:("+Yl+")")+"?)")+"?("+xi+"|"+Yo+"|"+Jd+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+ec+")")+"?$",E7="^(){0}"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Xl+")"+r("\\:("+Yl+")")+"?)")+"?("+xi+"|"+Yo+"|"+pg+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+ec+")")+"?$",T7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Xl+")"+r("\\:("+Yl+")")+"?)")+"?("+xi+"|"+Yo+"|"+Jd+"|"+Qo+")")+r("\\?("+es+")")+"?$",C7="^"+r("\\#("+ec+")")+"?$",I7="^"+r("("+rt+")@")+"?("+Xl+")"+r("\\:("+Yl+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,A,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Ze,Be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Ze,Be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Ze,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Ze,Be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]",vt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Ze,Be),"g"),UNRESERVED:new RegExp(Ze,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Ze,xt),"g"),PCT_ENCODED:new RegExp(Ye,"g"),IPV4ADDRESS:new RegExp("^("+pn+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ki+")"+r(r("\\%25|\\%(?!"+J+"{2})")+"("+Xo+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function _(b,E){var A=[],R=!0,J=!1,we=void 0;try{for(var Ge=b[Symbol.iterator](),Ye;!(R=(Ye=Ge.next()).done)&&(A.push(Ye.value),!(E&&A.length===E));R=!0);}catch(Ft){J=!0,we=Ft}finally{try{!R&&Ge.return&&Ge.return()}finally{if(J)throw we}}return A}return function(b,E){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return _(b,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(_){if(Array.isArray(_)){for(var b=0,E=Array(_.length);b<_.length;b++)E[b]=_[b];return E}else return Array.from(_)},m=2147483647,p=36,h=1,f=26,y=38,g=700,S=72,v=128,I="-",T=/^xn--/,C=/[^\0-\x7E]/,$=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=p-h,B=Math.floor,Y=String.fromCharCode;function H(_){throw new RangeError(W[_])}function j(_,b){for(var E=[],A=_.length;A--;)E[A]=b(_[A]);return E}function Z(_,b){var E=_.split("@"),A="";E.length>1&&(A=E[0]+"@",_=E[1]),_=_.replace($,".");var R=_.split("."),J=j(R,b).join(".");return A+J}function ae(_){for(var b=[],E=0,A=_.length;E<A;){var R=_.charCodeAt(E++);if(R>=55296&&R<=56319&&E<A){var J=_.charCodeAt(E++);(J&64512)==56320?b.push(((R&1023)<<10)+(J&1023)+65536):(b.push(R),E--)}else b.push(R)}return b}var $e=function(b){return String.fromCodePoint.apply(String,d(b))},Xe=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:p},At=function(b,E){return b+22+75*(b<26)-((E!=0)<<5)},kt=function(b,E,A){var R=0;for(b=A?B(b/g):b>>1,b+=B(b/E);b>M*f>>1;R+=p)b=B(b/M);return B(R+(M+1)*b/(b+y))},w=function(b){var E=[],A=b.length,R=0,J=v,we=S,Ge=b.lastIndexOf(I);Ge<0&&(Ge=0);for(var Ye=0;Ye<Ge;++Ye)b.charCodeAt(Ye)>=128&&H("not-basic"),E.push(b.charCodeAt(Ye));for(var Ft=Ge>0?Ge+1:0;Ft<A;){for(var Be=R,xt=1,Bt=p;;Bt+=p){Ft>=A&&H("invalid-input");var vt=Xe(b.charCodeAt(Ft++));(vt>=p||vt>B((m-R)/xt))&&H("overflow"),R+=vt*xt;var Ze=Bt<=we?h:Bt>=we+f?f:Bt-we;if(vt<Ze)break;var Et=p-Ze;xt>B(m/Et)&&H("overflow"),xt*=Et}var rt=E.length+1;we=kt(R-Be,rt,Be==0),B(R/rt)>m-J&&H("overflow"),J+=B(R/rt),R%=rt,E.splice(R++,0,J)}return String.fromCodePoint.apply(String,E)},xr=function(b){var E=[];b=ae(b);var A=b.length,R=v,J=0,we=S,Ge=!0,Ye=!1,Ft=void 0;try{for(var Be=b[Symbol.iterator](),xt;!(Ge=(xt=Be.next()).done);Ge=!0){var Bt=xt.value;Bt<128&&E.push(Y(Bt))}}catch(Wa){Ye=!0,Ft=Wa}finally{try{!Ge&&Be.return&&Be.return()}finally{if(Ye)throw Ft}}var vt=E.length,Ze=vt;for(vt&&E.push(I);Ze<A;){var Et=m,rt=!0,Ha=!1,Jr=void 0;try{for(var pn=b[Symbol.iterator](),ot;!(rt=(ot=pn.next()).done);rt=!0){var Xr=ot.value;Xr>=R&&Xr<Et&&(Et=Xr)}}catch(Wa){Ha=!0,Jr=Wa}finally{try{!rt&&pn.return&&pn.return()}finally{if(Ha)throw Jr}}var mn=Ze+1;Et-R>B((m-J)/mn)&&H("overflow"),J+=(Et-R)*mn,R=Et;var Qn=!0,qa=!1,wi=void 0;try{for(var Jl=b[Symbol.iterator](),Zd;!(Qn=(Zd=Jl.next()).done);Qn=!0){var Kd=Zd.value;if(Kd<R&&++J>m&&H("overflow"),Kd==R){for(var Ko=J,Jo=p;;Jo+=p){var ki=Jo<=we?h:Jo>=we+f?f:Jo-we;if(Ko<ki)break;var Xo=Ko-ki,dg=p-ki;E.push(Y(At(ki+Xo%dg,0))),Ko=B(Xo/dg)}E.push(Y(At(Ko,0))),we=kt(J,mn,Ze==vt),J=0,++Ze}}}catch(Wa){qa=!0,wi=Wa}finally{try{!Qn&&Jl.return&&Jl.return()}finally{if(qa)throw wi}}++J,++R}return E.join("")},Pn=function(b){return Z(b,function(E){return T.test(E)?w(E.slice(4).toLowerCase()):E})},x=function(b){return Z(b,function(E){return C.test(E)?"xn--"+xr(E):E})},Lt={version:"2.1.0",ucs2:{decode:ae,encode:$e},decode:w,encode:xr,toASCII:x,toUnicode:Pn},zt={};function Mr(_){var b=_.charCodeAt(0),E=void 0;return b<16?E="%0"+b.toString(16).toUpperCase():b<128?E="%"+b.toString(16).toUpperCase():b<2048?E="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():E="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),E}function Rn(_){for(var b="",E=0,A=_.length;E<A;){var R=parseInt(_.substr(E+1,2),16);if(R<128)b+=String.fromCharCode(R),E+=3;else if(R>=194&&R<224){if(A-E>=6){var J=parseInt(_.substr(E+4,2),16);b+=String.fromCharCode((R&31)<<6|J&63)}else b+=_.substr(E,6);E+=6}else if(R>=224){if(A-E>=9){var we=parseInt(_.substr(E+4,2),16),Ge=parseInt(_.substr(E+7,2),16);b+=String.fromCharCode((R&15)<<12|(we&63)<<6|Ge&63)}else b+=_.substr(E,9);E+=9}else b+=_.substr(E,3),E+=3}return b}function Pt(_,b){function E(A){var R=Rn(A);return R.match(b.UNRESERVED)?R:A}return _.scheme&&(_.scheme=String(_.scheme).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(b.PCT_ENCODED,E).replace(b.NOT_USERINFO,Mr).replace(b.PCT_ENCODED,i)),_.host!==void 0&&(_.host=String(_.host).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_HOST,Mr).replace(b.PCT_ENCODED,i)),_.path!==void 0&&(_.path=String(_.path).replace(b.PCT_ENCODED,E).replace(_.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Mr).replace(b.PCT_ENCODED,i)),_.query!==void 0&&(_.query=String(_.query).replace(b.PCT_ENCODED,E).replace(b.NOT_QUERY,Mr).replace(b.PCT_ENCODED,i)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(b.PCT_ENCODED,E).replace(b.NOT_FRAGMENT,Mr).replace(b.PCT_ENCODED,i)),_}function _i(_){return _.replace(/^0*(.*)/,"$1")||"0"}function $r(_,b){var E=_.match(b.IPV4ADDRESS)||[],A=u(E,2),R=A[1];return R?R.split(".").map(_i).join("."):_}function Si(_,b){var E=_.match(b.IPV6ADDRESS)||[],A=u(E,3),R=A[1],J=A[2];if(R){for(var we=R.toLowerCase().split("::").reverse(),Ge=u(we,2),Ye=Ge[0],Ft=Ge[1],Be=Ft?Ft.split(":").map(_i):[],xt=Ye.split(":").map(_i),Bt=b.IPV4ADDRESS.test(xt[xt.length-1]),vt=Bt?7:8,Ze=xt.length-vt,Et=Array(vt),rt=0;rt<vt;++rt)Et[rt]=Be[rt]||xt[Ze+rt]||"";Bt&&(Et[vt-1]=$r(Et[vt-1],b));var Ha=Et.reduce(function(mn,Qn,qa){if(!Qn||Qn==="0"){var wi=mn[mn.length-1];wi&&wi.index+wi.length===qa?wi.length++:mn.push({index:qa,length:1})}return mn},[]),Jr=Ha.sort(function(mn,Qn){return Qn.length-mn.length})[0],pn=void 0;if(Jr&&Jr.length>1){var ot=Et.slice(0,Jr.index),Xr=Et.slice(Jr.index+Jr.length);pn=ot.join(":")+"::"+Xr.join(":")}else pn=Et.join(":");return J&&(pn+="%"+J),pn}else return _}var ra=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Wl="".match(/(){0}/)[1]===void 0;function cn(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},A=b.iri!==!1?c:l;b.reference==="suffix"&&(_=(b.scheme?b.scheme+":":"")+"//"+_);var R=_.match(ra);if(R){Wl?(E.scheme=R[1],E.userinfo=R[3],E.host=R[4],E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=R[7],E.fragment=R[8],isNaN(E.port)&&(E.port=R[5])):(E.scheme=R[1]||void 0,E.userinfo=_.indexOf("@")!==-1?R[3]:void 0,E.host=_.indexOf("//")!==-1?R[4]:void 0,E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=_.indexOf("?")!==-1?R[7]:void 0,E.fragment=_.indexOf("#")!==-1?R[8]:void 0,isNaN(E.port)&&(E.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),E.host&&(E.host=Si($r(E.host,A),A)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==E.reference&&(E.error=E.error||"URI is not a "+b.reference+" reference.");var J=zt[(b.scheme||E.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!J||!J.unicodeSupport)){if(E.host&&(b.domainHost||J&&J.domainHost))try{E.host=Lt.toASCII(E.host.replace(A.PCT_ENCODED,Rn).toLowerCase())}catch(we){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+we}Pt(E,l)}else Pt(E,A);J&&J.parse&&J.parse(E,b)}else E.error=E.error||"URI can not be parsed.";return E}function Vd(_,b){var E=b.iri!==!1?c:l,A=[];return _.userinfo!==void 0&&(A.push(_.userinfo),A.push("@")),_.host!==void 0&&A.push(Si($r(String(_.host),E),E).replace(E.IPV6ADDRESS,function(R,J,we){return"["+J+(we?"%25"+we:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(A.push(":"),A.push(String(_.port))),A.length?A.join(""):void 0}var Zl=/^\.\.?\//,Hd=/^\/\.(\/|$)/,Kl=/^\/\.\.(\/|$)/,qd=/^\/?(?:.|\n)*?(?=\/|$)/;function na(_){for(var b=[];_.length;)if(_.match(Zl))_=_.replace(Zl,"");else if(_.match(Hd))_=_.replace(Hd,"/");else if(_.match(Kl))_=_.replace(Kl,"/"),b.pop();else if(_==="."||_==="..")_="";else{var E=_.match(qd);if(E){var A=E[0];_=_.slice(A.length),b.push(A)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function un(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=b.iri?c:l,A=[],R=zt[(b.scheme||_.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(_,b),_.host&&!E.IPV6ADDRESS.test(_.host)){if(b.domainHost||R&&R.domainHost)try{_.host=b.iri?Lt.toUnicode(_.host):Lt.toASCII(_.host.replace(E.PCT_ENCODED,Rn).toLowerCase())}catch(Ge){_.error=_.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+Ge}}Pt(_,E),b.reference!=="suffix"&&_.scheme&&(A.push(_.scheme),A.push(":"));var J=Vd(_,b);if(J!==void 0&&(b.reference!=="suffix"&&A.push("//"),A.push(J),_.path&&_.path.charAt(0)!=="/"&&A.push("/")),_.path!==void 0){var we=_.path;!b.absolutePath&&(!R||!R.absolutePath)&&(we=na(we)),J===void 0&&(we=we.replace(/^\/\//,"/%2F")),A.push(we)}return _.query!==void 0&&(A.push("?"),A.push(_.query)),_.fragment!==void 0&&(A.push("#"),A.push(_.fragment)),A.join("")}function Wd(_,b){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=arguments[3],R={};return A||(_=cn(un(_,E),E),b=cn(un(b,E),E)),E=E||{},!E.tolerant&&b.scheme?(R.scheme=b.scheme,R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.path?(b.path.charAt(0)==="/"?R.path=na(b.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?R.path="/"+b.path:_.path?R.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+b.path:R.path=b.path,R.path=na(R.path)),R.query=b.query):(R.path=_.path,b.query!==void 0?R.query=b.query:R.query=_.query),R.userinfo=_.userinfo,R.host=_.host,R.port=_.port),R.scheme=_.scheme),R.fragment=b.fragment,R}function lg(_,b,E){var A=o({scheme:"null"},E);return un(Wd(cn(_,A),cn(b,A),A,!0),A)}function cg(_,b){return typeof _=="string"?_=un(cn(_,b),b):n(_)==="object"&&(_=cn(un(_,b),b)),_}function O(_,b,E){return typeof _=="string"?_=un(cn(_,E),E):n(_)==="object"&&(_=un(_,E)),typeof b=="string"?b=un(cn(b,E),E):n(b)==="object"&&(b=un(b,E)),_===b}function G(_,b){return _&&_.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Mr)}function oe(_,b){return _&&_.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,Rn)}var Se={scheme:"http",domainHost:!0,parse:function(b,E){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,E){var A=String(b.scheme).toLowerCase()==="https";return(b.port===(A?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Je={scheme:"https",domainHost:Se.domainHost,parse:Se.parse,serialize:Se.serialize};function Lr(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Kr={scheme:"ws",domainHost:!0,parse:function(b,E){var A=b;return A.secure=Lr(A),A.resourceName=(A.path||"/")+(A.query?"?"+A.query:""),A.path=void 0,A.query=void 0,A},serialize:function(b,E){if((b.port===(Lr(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var A=b.resourceName.split("?"),R=u(A,2),J=R[0],we=R[1];b.path=J&&J!=="/"?J:void 0,b.query=we,b.resourceName=void 0}return b.fragment=void 0,b}},dn={scheme:"wss",domainHost:Kr.domainHost,parse:Kr.parse,serialize:Kr.serialize},Ga={},Va=!0,cr="[A-Za-z0-9\\-\\.\\_\\~"+(Va?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xt="[0-9A-Fa-f]",Nn=r(r("%[EFef]"+Xt+"%"+Xt+Xt+"%"+Xt+Xt)+"|"+r("%[89A-Fa-f]"+Xt+"%"+Xt+Xt)+"|"+r("%"+Xt+Xt)),fM="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",gM="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",yM=e(gM,'[\\"\\\\]'),bM="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",vM=new RegExp(cr,"g"),Zo=new RegExp(Nn,"g"),_M=new RegExp(e("[^]",fM,"[\\.]",'[\\"]',yM),"g"),Bx=new RegExp(e("[^]",cr,bM),"g"),SM=Bx;function ug(_){var b=Rn(_);return b.match(vM)?b:_}var jx={scheme:"mailto",parse:function(b,E){var A=b,R=A.to=A.path?A.path.split(","):[];if(A.path=void 0,A.query){for(var J=!1,we={},Ge=A.query.split("&"),Ye=0,Ft=Ge.length;Ye<Ft;++Ye){var Be=Ge[Ye].split("=");switch(Be[0]){case"to":for(var xt=Be[1].split(","),Bt=0,vt=xt.length;Bt<vt;++Bt)R.push(xt[Bt]);break;case"subject":A.subject=oe(Be[1],E);break;case"body":A.body=oe(Be[1],E);break;default:J=!0,we[oe(Be[0],E)]=oe(Be[1],E);break}}J&&(A.headers=we)}A.query=void 0;for(var Ze=0,Et=R.length;Ze<Et;++Ze){var rt=R[Ze].split("@");if(rt[0]=oe(rt[0]),E.unicodeSupport)rt[1]=oe(rt[1],E).toLowerCase();else try{rt[1]=Lt.toASCII(oe(rt[1],E).toLowerCase())}catch(Ha){A.error=A.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ha}R[Ze]=rt.join("@")}return A},serialize:function(b,E){var A=b,R=a(b.to);if(R){for(var J=0,we=R.length;J<we;++J){var Ge=String(R[J]),Ye=Ge.lastIndexOf("@"),Ft=Ge.slice(0,Ye).replace(Zo,ug).replace(Zo,i).replace(_M,Mr),Be=Ge.slice(Ye+1);try{Be=E.iri?Lt.toUnicode(Be):Lt.toASCII(oe(Be,E).toLowerCase())}catch(Ze){A.error=A.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Ze}R[J]=Ft+"@"+Be}A.path=R.join(",")}var xt=b.headers=b.headers||{};b.subject&&(xt.subject=b.subject),b.body&&(xt.body=b.body);var Bt=[];for(var vt in xt)xt[vt]!==Ga[vt]&&Bt.push(vt.replace(Zo,ug).replace(Zo,i).replace(Bx,Mr)+"="+xt[vt].replace(Zo,ug).replace(Zo,i).replace(SM,Mr));return Bt.length&&(A.query=Bt.join("&")),A}},wM=/^([^\:]+)\:(.*)/,Ux={scheme:"urn",parse:function(b,E){var A=b.path&&b.path.match(wM),R=b;if(A){var J=E.scheme||R.scheme||"urn",we=A[1].toLowerCase(),Ge=A[2],Ye=J+":"+(E.nid||we),Ft=zt[Ye];R.nid=we,R.nss=Ge,R.path=void 0,Ft&&(R=Ft.parse(R,E))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(b,E){var A=E.scheme||b.scheme||"urn",R=b.nid,J=A+":"+(E.nid||R),we=zt[J];we&&(b=we.serialize(b,E));var Ge=b,Ye=b.nss;return Ge.path=(R||E.nid)+":"+Ye,Ge}},kM=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Gx={scheme:"urn:uuid",parse:function(b,E){var A=b;return A.uuid=A.nss,A.nss=void 0,!E.tolerant&&(!A.uuid||!A.uuid.match(kM))&&(A.error=A.error||"UUID is not valid."),A},serialize:function(b,E){var A=b;return A.nss=(b.uuid||"").toLowerCase(),A}};zt[Se.scheme]=Se,zt[Je.scheme]=Je,zt[Kr.scheme]=Kr,zt[dn.scheme]=dn,zt[jx.scheme]=jx,zt[Ux.scheme]=Ux,zt[Gx.scheme]=Gx,t.SCHEMES=zt,t.pctEncChar=Mr,t.pctDecChars=Rn,t.parse=cn,t.removeDotSegments=na,t.serialize=un,t.resolveComponents=Wd,t.resolve=lg,t.normalize=cg,t.equal=O,t.escapeComponent=G,t.unescapeComponent=oe,Object.defineProperty(t,"__esModule",{value:!0})})});var JR=P(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});var KR=ZR();KR.code='require("ajv/dist/runtime/uri").default';gw.default=KR});var iN=P(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.CodeGen=or.Name=or.nil=or.stringify=or.str=or._=or.KeywordCxt=void 0;var lq=Fu();Object.defineProperty(or,"KeywordCxt",{enumerable:!0,get:function(){return lq.KeywordCxt}});var vl=Ee();Object.defineProperty(or,"_",{enumerable:!0,get:function(){return vl._}});Object.defineProperty(or,"str",{enumerable:!0,get:function(){return vl.str}});Object.defineProperty(or,"stringify",{enumerable:!0,get:function(){return vl.stringify}});Object.defineProperty(or,"nil",{enumerable:!0,get:function(){return vl.nil}});Object.defineProperty(or,"Name",{enumerable:!0,get:function(){return vl.Name}});Object.defineProperty(or,"CodeGen",{enumerable:!0,get:function(){return vl.CodeGen}});var cq=xh(),tN=Eh(),uq=XS(),Bu=Ch(),dq=Ee(),ju=$u(),Ah=Mu(),bw=We(),XR=qR(),pq=JR(),rN=(t,e)=>new RegExp(t,e);rN.code="new RegExp";var mq=["removeAdditional","useDefaults","coerceTypes"],hq=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),fq={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."},gq={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},YR=200;function yq(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,S,v,I,T,C,$,W,M;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:rN,Z=(i=t.uriResolver)!==null&&i!==void 0?i:pq.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:YR,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:YR,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(S=t.messages)!==null&&S!==void 0?S:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:($=t.validateFormats)!==null&&$!==void 0?$:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:(M=t.int32range)!==null&&M!==void 0?M:!0,uriResolver:Z}}var Uu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...yq(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new dq.ValueScope({scope:{},prefixes:hq,es5:r,lines:n}),this.logger=kq(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,uq.getRules)(),QR.call(this,fq,e,"NOT SUPPORTED"),QR.call(this,gq,e,"DEPRECATED","warn"),this._metaOpts=Sq.call(this),e.formats&&vq.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_q.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),bq.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=XR;n==="id"&&(i={...XR},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof tN.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,ju.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=eN.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Bu.SchemaEnv({schema:{},schemaId:n});if(r=Bu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=eN.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,ju.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Eq.call(this,n,r),!r)return(0,bw.eachItem)(n,a=>yw.call(this,a)),this;Cq.call(this,r);let i={...r,type:(0,Ah.getJSONTypes)(r.type),schemaType:(0,Ah.getJSONTypes)(r.schemaType)};return(0,bw.eachItem)(n,i.type.length===0?a=>yw.call(this,a,i):a=>i.type.forEach(o=>yw.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=nN(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,ju.normalizeId)(o||n);let c=ju.getSchemaRefs.call(this,e,n);return l=new Bu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Bu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Bu.compileSchema.call(this,e)}finally{this.opts=r}}};or.default=Uu;Uu.ValidationError=cq.default;Uu.MissingRefError=tN.default;function QR(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function eN(t){return t=(0,ju.normalizeId)(t),this.schemas[t]||this.refs[t]}function bq(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function vq(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function _q(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Sq(){let t={...this.opts};for(let e of mq)delete t[e];return t}var wq={log(){},warn(){},error(){}};function kq(t){if(t===!1)return wq;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var xq=/^[a-z_$][a-z0-9_$:-]*$/i;function Eq(t,e){let{RULES:r}=this;if((0,bw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!xq.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function yw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Ah.getJSONTypes)(e.type),schemaType:(0,Ah.getJSONTypes)(e.schemaType)}};e.before?Tq.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function Tq(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Cq(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=nN(e)),t.validateSchema=this.compile(e,!0))}var Iq={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function nN(t){return{anyOf:[t,Iq]}}});var aN=P(vw=>{"use strict";Object.defineProperty(vw,"__esModule",{value:!0});var Aq={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};vw.default=Aq});var cN=P(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.callRef=Ao.getValidate=void 0;var Pq=Eh(),oN=En(),qr=Ee(),_l=Wi(),sN=Ch(),Ph=We(),Rq={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=sN.resolveRef.call(l,c,i,r);if(u===void 0)throw new Pq.default(n.opts.uriResolver,i,r);if(u instanceof sN.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return Rh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return Rh(t,(0,qr._)`${h}.validate`,c,c.$async)}function m(h){let f=lN(t,h);Rh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,qr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:qr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function lN(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ao.getValidate=lN;function Rh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?_l.default.this:qr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,qr._)`await ${(0,oN.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,qr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,oN.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,qr._)`${h}.errors`;i.assign(_l.default.vErrors,(0,qr._)`${_l.default.vErrors} === null ? ${f} : ${_l.default.vErrors}.concat(${f})`),i.assign(_l.default.errors,(0,qr._)`${_l.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=Ph.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,qr._)`${h}.evaluated.props`);a.props=Ph.mergeEvaluated.props(i,g,a.props,qr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=Ph.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,qr._)`${h}.evaluated.items`);a.items=Ph.mergeEvaluated.items(i,g,a.items,qr.Name)}}}Ao.callRef=Rh;Ao.default=Rq});var uN=P(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var Nq=aN(),Oq=cN(),Dq=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Nq.default,Oq.default];_w.default=Dq});var dN=P(Sw=>{"use strict";Object.defineProperty(Sw,"__esModule",{value:!0});var Nh=Ee(),Da=Nh.operators,Oh={maximum:{okStr:"<=",ok:Da.LTE,fail:Da.GT},minimum:{okStr:">=",ok:Da.GTE,fail:Da.LT},exclusiveMaximum:{okStr:"<",ok:Da.LT,fail:Da.GTE},exclusiveMinimum:{okStr:">",ok:Da.GT,fail:Da.LTE}},Mq={message:({keyword:t,schemaCode:e})=>(0,Nh.str)`must be ${Oh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Nh._)`{comparison: ${Oh[t].okStr}, limit: ${e}}`},$q={keyword:Object.keys(Oh),type:"number",schemaType:"number",$data:!0,error:Mq,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Nh._)`${r} ${Oh[e].fail} ${n} || isNaN(${r})`)}};Sw.default=$q});var pN=P(ww=>{"use strict";Object.defineProperty(ww,"__esModule",{value:!0});var Gu=Ee(),Lq={message:({schemaCode:t})=>(0,Gu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Gu._)`{multipleOf: ${t}}`},zq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Lq,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,Gu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,Gu._)`${o} !== parseInt(${o})`;t.fail$data((0,Gu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};ww.default=zq});var hN=P(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});function mN(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}kw.default=mN;mN.code='require("ajv/dist/runtime/ucs2length").default'});var fN=P(xw=>{"use strict";Object.defineProperty(xw,"__esModule",{value:!0});var Po=Ee(),Fq=We(),Bq=hN(),jq={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Po.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Po._)`{limit: ${t}}`},Uq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:jq,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?Po.operators.GT:Po.operators.LT,o=i.opts.unicode===!1?(0,Po._)`${r}.length`:(0,Po._)`${(0,Fq.useFunc)(t.gen,Bq.default)}(${r})`;t.fail$data((0,Po._)`${o} ${a} ${n}`)}};xw.default=Uq});var gN=P(Ew=>{"use strict";Object.defineProperty(Ew,"__esModule",{value:!0});var Gq=En(),Dh=Ee(),Vq={message:({schemaCode:t})=>(0,Dh.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Dh._)`{pattern: ${t}}`},Hq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Vq,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,Dh._)`(new RegExp(${i}, ${o}))`:(0,Gq.usePattern)(t,n);t.fail$data((0,Dh._)`!${s}.test(${e})`)}};Ew.default=Hq});var yN=P(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});var Vu=Ee(),qq={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Vu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Vu._)`{limit: ${t}}`},Wq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:qq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Vu.operators.GT:Vu.operators.LT;t.fail$data((0,Vu._)`Object.keys(${r}).length ${i} ${n}`)}};Tw.default=Wq});var bN=P(Cw=>{"use strict";Object.defineProperty(Cw,"__esModule",{value:!0});var Hu=En(),qu=Ee(),Zq=We(),Kq={message:({params:{missingProperty:t}})=>(0,qu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,qu._)`{missingProperty: ${t}}`},Jq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Kq,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,Zq.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(qu.nil,d);else for(let p of r)(0,Hu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,Hu.checkMissingProp)(t,r,p)),(0,Hu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Hu.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,Hu.propertyInData)(e,i,p,s.ownProperties)),e.if((0,qu.not)(h),()=>{t.error(),e.break()})},qu.nil)}}};Cw.default=Jq});var vN=P(Iw=>{"use strict";Object.defineProperty(Iw,"__esModule",{value:!0});var Wu=Ee(),Xq={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Wu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Wu._)`{limit: ${t}}`},Yq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Xq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Wu.operators.GT:Wu.operators.LT;t.fail$data((0,Wu._)`${r}.length ${i} ${n}`)}};Iw.default=Yq});var Mh=P(Aw=>{"use strict";Object.defineProperty(Aw,"__esModule",{value:!0});var _N=ou();_N.code='require("ajv/dist/runtime/equal").default';Aw.default=_N});var SN=P(Rw=>{"use strict";Object.defineProperty(Rw,"__esModule",{value:!0});var Pw=Mu(),sr=Ee(),Qq=We(),eW=Mh(),tW={message:({params:{i:t,j:e}})=>(0,sr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,sr._)`{i: ${t}, j: ${e}}`},rW={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:tW,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,Pw.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,sr._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,sr._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,sr._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,Pw.checkDataTypes)(c,y,s.opts.strictNumbers,Pw.DataType.Wrong),S=e.const("indices",(0,sr._)`{}`);e.for((0,sr._)`;${h}--;`,()=>{e.let(y,(0,sr._)`${r}[${h}]`),e.if(g,(0,sr._)`continue`),c.length>1&&e.if((0,sr._)`typeof ${y} == "string"`,(0,sr._)`${y} += "_"`),e.if((0,sr._)`typeof ${S}[${y}] == "number"`,()=>{e.assign(f,(0,sr._)`${S}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,sr._)`${S}[${y}] = ${h}`)})}function p(h,f){let y=(0,Qq.useFunc)(e,eW.default),g=e.name("outer");e.label(g).for((0,sr._)`;${h}--;`,()=>e.for((0,sr._)`${f} = ${h}; ${f}--;`,()=>e.if((0,sr._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};Rw.default=rW});var wN=P(Ow=>{"use strict";Object.defineProperty(Ow,"__esModule",{value:!0});var Nw=Ee(),nW=We(),iW=Mh(),aW={message:"must be equal to constant",params:({schemaCode:t})=>(0,Nw._)`{allowedValue: ${t}}`},oW={keyword:"const",$data:!0,error:aW,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,Nw._)`!${(0,nW.useFunc)(e,iW.default)}(${r}, ${i})`):t.fail((0,Nw._)`${a} !== ${r}`)}};Ow.default=oW});var kN=P(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});var Zu=Ee(),sW=We(),lW=Mh(),cW={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Zu._)`{allowedValues: ${t}}`},uW={keyword:"enum",schemaType:"array",$data:!0,error:cW,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,sW.useFunc)(e,lW.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,Zu.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,Zu._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,Zu._)`${c()}(${r}, ${p}[${h}])`:(0,Zu._)`${r} === ${f}`}}};Dw.default=uW});var xN=P(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});var dW=dN(),pW=pN(),mW=fN(),hW=gN(),fW=yN(),gW=bN(),yW=vN(),bW=SN(),vW=wN(),_W=kN(),SW=[dW.default,pW.default,mW.default,hW.default,fW.default,gW.default,yW.default,bW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},vW.default,_W.default];Mw.default=SW});var Lw=P(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.validateAdditionalItems=void 0;var Ro=Ee(),$w=We(),wW={message:({params:{len:t}})=>(0,Ro.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ro._)`{limit: ${t}}`},kW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:wW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,$w.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}EN(t,n)}};function EN(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,Ro._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ro._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,$w.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,Ro._)`${s} <= ${e.length}`);r.if((0,Ro.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:$w.Type.Num},c),o.allErrors||r.if((0,Ro.not)(c),()=>r.break())})}}Ku.validateAdditionalItems=EN;Ku.default=kW});var zw=P(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.validateTuple=void 0;var TN=Ee(),$h=We(),xW=En(),EW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return CN(t,"additionalItems",e);r.items=!0,!(0,$h.alwaysValidSchema)(r,e)&&t.ok((0,xW.validateArray)(t))}};function CN(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=$h.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,TN._)`${a}.length`);r.forEach((d,m)=>{(0,$h.alwaysValidSchema)(s,d)||(n.if((0,TN._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,$h.checkStrictMode)(s,y,m.strictTuples)}}}Ju.validateTuple=CN;Ju.default=EW});var IN=P(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var TW=zw(),CW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,TW.validateTuple)(t,"items")};Fw.default=CW});var PN=P(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});var AN=Ee(),IW=We(),AW=En(),PW=Lw(),RW={message:({params:{len:t}})=>(0,AN.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,AN._)`{limit: ${t}}`},NW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:RW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,IW.alwaysValidSchema)(n,e)&&(i?(0,PW.validateAdditionalItems)(t,i):t.ok((0,AW.validateArray)(t)))}};Bw.default=NW});var RN=P(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});var Cn=Ee(),Lh=We(),OW={message:({params:{min:t,max:e}})=>e===void 0?(0,Cn.str)`must contain at least ${t} valid item(s)`:(0,Cn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Cn._)`{minContains: ${t}}`:(0,Cn._)`{minContains: ${t}, maxContains: ${e}}`},DW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:OW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,Cn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,Lh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,Lh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Lh.alwaysValidSchema)(a,r)){let f=(0,Cn._)`${u} >= ${o}`;s!==void 0&&(f=(0,Cn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,Cn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Lh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,Cn._)`${f}++`),s===void 0?e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Cn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};jw.default=DW});var DN=P(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.validateSchemaDeps=fi.validatePropertyDeps=fi.error=void 0;var Uw=Ee(),MW=We(),Xu=En();fi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Uw.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Uw._)`{property: ${t},
|
|
12
|
+
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,xe._)`[${i}]`)}}}function K6({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,xe._)`${e} !== undefined`,()=>t.assign((0,xe._)`${e}[${r}]`,n))}function cw(t,e,r,n=Lu.Correct){let i=n===Lu.Correct?xe.operators.EQ:xe.operators.NEQ,a;switch(t){case"null":return(0,xe._)`${e} ${i} null`;case"array":a=(0,xe._)`Array.isArray(${e})`;break;case"object":a=(0,xe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=o((0,xe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=o();break;default:return(0,xe._)`typeof ${e} ${i} ${t}`}return n===Lu.Correct?a:(0,xe.not)(a);function o(s=xe.nil){return(0,xe.and)((0,xe._)`typeof ${e} == "number"`,s,r?(0,xe._)`isFinite(${e})`:xe.nil)}}or.checkDataType=cw;function uw(t,e,r,n){if(t.length===1)return cw(t[0],e,r,n);let i,a=(0,gR.toHash)(t);if(a.array&&a.object){let o=(0,xe._)`typeof ${e} != "object"`;i=a.null?o:(0,xe._)`!${e} || ${o}`,delete a.null,delete a.array,delete a.object}else i=xe.nil;a.number&&delete a.integer;for(let o in a)i=(0,xe.and)(i,cw(o,e,r,n));return i}or.checkDataTypes=uw;var J6={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,xe._)`{type: ${t}}`:(0,xe._)`{type: ${e}}`};function dw(t){let e=X6(t);(0,V6.reportError)(e,J6)}or.reportTypeError=dw;function X6(t){let{gen:e,data:r,schema:n}=t,i=(0,gR.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var _R=P(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.assignDefaults=void 0;var yl=Ee(),Y6=We();function Q6(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)vR(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,a)=>vR(t,a,i.default))}kh.assignDefaults=Q6;function vR(t,e,r){let{gen:n,compositeRule:i,data:a,opts:o}=t;if(r===void 0)return;let s=(0,yl._)`${a}${(0,yl.getProperty)(e)}`;if(i){(0,Y6.checkStrictMode)(t,`default is ignored for: ${s}`);return}let l=(0,yl._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,yl._)`${l} || ${s} === null || ${s} === ""`),n.if(l,(0,yl._)`${s} = ${(0,yl.stringify)(r)}`)}});var En=P(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateUnion=at.validateArray=at.usePattern=at.callValidateCode=at.schemaProperties=at.allSchemaProperties=at.noPropertyInData=at.propertyInData=at.isOwnProperty=at.hasPropFunc=at.reportMissingProp=at.checkMissingProp=at.checkReportMissingProp=void 0;var bt=Ee(),pw=We(),Ra=Wi(),eH=We();function tH(t,e){let{gen:r,data:n,it:i}=t;r.if(hw(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,bt._)`${e}`},!0),t.error()})}at.checkReportMissingProp=tH;function rH({gen:t,data:e,it:{opts:r}},n,i){return(0,bt.or)(...n.map(a=>(0,bt.and)(hw(t,e,a,r.ownProperties),(0,bt._)`${i} = ${a}`)))}at.checkMissingProp=rH;function nH(t,e){t.setParams({missingProperty:e},!0),t.error()}at.reportMissingProp=nH;function SR(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,bt._)`Object.prototype.hasOwnProperty`})}at.hasPropFunc=SR;function mw(t,e,r){return(0,bt._)`${SR(t)}.call(${e}, ${r})`}at.isOwnProperty=mw;function iH(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} !== undefined`;return n?(0,bt._)`${i} && ${mw(t,e,r)}`:i}at.propertyInData=iH;function hw(t,e,r,n){let i=(0,bt._)`${e}${(0,bt.getProperty)(r)} === undefined`;return n?(0,bt.or)(i,(0,bt.not)(mw(t,e,r))):i}at.noPropertyInData=hw;function wR(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}at.allSchemaProperties=wR;function aH(t,e){return wR(e).filter(r=>!(0,pw.alwaysValidSchema)(t,e[r]))}at.schemaProperties=aH;function oH({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,l,c){let u=c?(0,bt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ra.default.instancePath,(0,bt.strConcat)(Ra.default.instancePath,a)],[Ra.default.parentData,o.parentData],[Ra.default.parentDataProperty,o.parentDataProperty],[Ra.default.rootData,Ra.default.rootData]];o.opts.dynamicRef&&d.push([Ra.default.dynamicAnchors,Ra.default.dynamicAnchors]);let m=(0,bt._)`${u}, ${r.object(...d)}`;return l!==bt.nil?(0,bt._)`${s}.call(${l}, ${m})`:(0,bt._)`${s}(${m})`}at.callValidateCode=oH;var sH=(0,bt._)`new RegExp`;function lH({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,a=i(r,n);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,bt._)`${i.code==="new RegExp"?sH:(0,eH.useFunc)(t,i)}(${r}, ${n})`})}at.usePattern=lH;function cH(t){let{gen:e,data:r,keyword:n,it:i}=t,a=e.name("valid");if(i.allErrors){let s=e.let("valid",!0);return o(()=>e.assign(s,!1)),s}return e.var(a,!0),o(()=>e.break()),a;function o(s){let l=e.const("len",(0,bt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:pw.Type.Num},a),e.if((0,bt.not)(a),s)})}}at.validateArray=cH;function uH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,pw.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);e.assign(o,(0,bt._)`${o} || ${s}`),t.mergeValidEvaluated(u,s)||e.if((0,bt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}at.validateUnion=uH});var ER=P(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateKeywordUsage=mi.validSchemaType=mi.funcKeywordCode=mi.macroKeywordCode=void 0;var Pr=Ee(),Co=Wi(),dH=En(),pH=$u();function mH(t,e){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=t,s=e.macro.call(o.self,i,a,o),l=xR(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");t.subschema({schema:s,schemaPath:Pr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}mi.macroKeywordCode=mH;function hH(t,e){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:l}=t;gH(l,e);let c=!s&&e.compile?e.compile.call(l.self,a,o,l):e.validate,u=xR(n,i,c),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)f(),e.modifying&&kR(t),y(()=>t.error());else{let g=e.async?p():h();e.modifying&&kR(t),y(()=>fH(t,g))}}function p(){let g=n.let("ruleErrs",null);return n.try(()=>f((0,Pr._)`await `),x=>n.assign(d,!1).if((0,Pr._)`${x} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Pr._)`${x}.errors`),()=>n.throw(x))),g}function h(){let g=(0,Pr._)`${u}.errors`;return n.assign(g,null),f(Pr.nil),g}function f(g=e.async?(0,Pr._)`await `:Pr.nil){let x=l.opts.passContext?Co.default.this:Co.default.self,v=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Pr._)`${g}${(0,dH.callValidateCode)(t,u,x,v)}`,e.modifying)}function y(g){var x;n.if((0,Pr.not)((x=e.valid)!==null&&x!==void 0?x:d),g)}}mi.funcKeywordCode=hH;function kR(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Pr._)`${n.parentData}[${n.parentDataProperty}]`))}function fH(t,e){let{gen:r}=t;r.if((0,Pr._)`Array.isArray(${e})`,()=>{r.assign(Co.default.vErrors,(0,Pr._)`${Co.default.vErrors} === null ? ${e} : ${Co.default.vErrors}.concat(${e})`).assign(Co.default.errors,(0,Pr._)`${Co.default.vErrors}.length`),(0,pH.extendErrors)(t)},()=>t.error())}function gH({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function xR(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Pr.stringify)(r)})}function yH(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}mi.validSchemaType=yH;function bH({schema:t,opts:e,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}mi.validateKeywordUsage=bH});var CR=P(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.extendSubschemaMode=Na.extendSubschemaData=Na.getSubschema=void 0;var hi=Ee(),TR=We();function vH(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,hi._)`${t.schemaPath}${(0,hi.getProperty)(e)}${(0,hi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,TR.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Na.getSubschema=vH;function _H(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,m=s.let("data",(0,hi._)`${e.data}${(0,hi.getProperty)(r)}`,!0);l(m),t.errorPath=(0,hi.str)`${c}${(0,TR.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,hi._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof hi.Name?i:s.let("data",i,!0);l(c),o!==void 0&&(t.propertyName=o)}a&&(t.dataTypes=a);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Na.extendSubschemaData=_H;function SH(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=r}Na.extendSubschemaMode=SH});var Fu=P(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.getSchemaRefs=Hr.resolveUrl=Hr.normalizeId=Hr._getFullPath=Hr.getFullPath=Hr.inlineRef=void 0;var wH=We(),kH=cu(),xH=T_(),EH=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function TH(t,e=!0){return typeof t=="boolean"?!0:e===!0?!fw(t):e?IR(t)<=e:!1}Hr.inlineRef=TH;var CH=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fw(t){for(let e in t){if(CH.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(fw)||typeof r=="object"&&fw(r))return!0}return!1}function IR(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!EH.has(r)&&(typeof t[r]=="object"&&(0,wH.eachItem)(t[r],n=>e+=IR(n)),e===1/0))return 1/0}return e}function AR(t,e="",r){r!==!1&&(e=bl(e));let n=t.parse(e);return PR(t,n)}Hr.getFullPath=AR;function PR(t,e){return t.serialize(e).split("#")[0]+"#"}Hr._getFullPath=PR;var IH=/#\/?$/;function bl(t){return t?t.replace(IH,""):""}Hr.normalizeId=bl;function AH(t,e,r){return r=bl(r),t.resolve(e,r)}Hr.resolveUrl=AH;var PH=/^[a-z_][-a-z0-9._]*$/i;function RH(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=bl(t[r]||e),a={"":i},o=AR(n,i,!1),s={},l=new Set;return xH(t,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let f=o+m,y=a[h];typeof d[r]=="string"&&(y=g.call(this,d[r])),x.call(this,d.$anchor),x.call(this,d.$dynamicAnchor),a[m]=y;function g(v){let I=this.opts.uriResolver.resolve;if(v=bl(y?I(y,v):v),l.has(v))throw u(v);l.add(v);let T=this.refs[v];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?c(d,T.schema,v):v!==bl(f)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=f),v}function x(v){if(typeof v=="string"){if(!PH.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!kH(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Hr.getSchemaRefs=RH});var Uu=P(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.getData=Oa.KeywordCxt=Oa.validateFunctionCode=void 0;var MR=mR(),RR=zu(),yw=lw(),xh=zu(),NH=_R(),ju=ER(),gw=CR(),ne=Ee(),ge=Wi(),OH=Fu(),Zi=We(),Bu=$u();function DH(t){if(zR(t)&&(FR(t),LR(t))){LH(t);return}$R(t,()=>(0,MR.topBoolOrEmptySchema)(t))}Oa.validateFunctionCode=DH;function $R({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},a){i.code.es5?t.func(e,(0,ne._)`${ge.default.data}, ${ge.default.valCxt}`,n.$async,()=>{t.code((0,ne._)`"use strict"; ${NR(r,i)}`),$H(t,i),t.code(a)}):t.func(e,(0,ne._)`${ge.default.data}, ${MH(i)}`,n.$async,()=>t.code(NR(r,i)).code(a))}function MH(t){return(0,ne._)`{${ge.default.instancePath}="", ${ge.default.parentData}, ${ge.default.parentDataProperty}, ${ge.default.rootData}=${ge.default.data}${t.dynamicRef?(0,ne._)`, ${ge.default.dynamicAnchors}={}`:ne.nil}}={}`}function $H(t,e){t.if(ge.default.valCxt,()=>{t.var(ge.default.instancePath,(0,ne._)`${ge.default.valCxt}.${ge.default.instancePath}`),t.var(ge.default.parentData,(0,ne._)`${ge.default.valCxt}.${ge.default.parentData}`),t.var(ge.default.parentDataProperty,(0,ne._)`${ge.default.valCxt}.${ge.default.parentDataProperty}`),t.var(ge.default.rootData,(0,ne._)`${ge.default.valCxt}.${ge.default.rootData}`),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`${ge.default.valCxt}.${ge.default.dynamicAnchors}`)},()=>{t.var(ge.default.instancePath,(0,ne._)`""`),t.var(ge.default.parentData,(0,ne._)`undefined`),t.var(ge.default.parentDataProperty,(0,ne._)`undefined`),t.var(ge.default.rootData,ge.default.data),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,ne._)`{}`)})}function LH(t){let{schema:e,opts:r,gen:n}=t;$R(t,()=>{r.$comment&&e.$comment&&jR(t),UH(t),n.let(ge.default.vErrors,null),n.let(ge.default.errors,0),r.unevaluated&&zH(t),BR(t),HH(t)})}function zH(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ne._)`${r}.evaluated`),e.if((0,ne._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ne._)`${t.evaluated}.props`,(0,ne._)`undefined`)),e.if((0,ne._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ne._)`${t.evaluated}.items`,(0,ne._)`undefined`))}function NR(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ne._)`/*# sourceURL=${r} */`:ne.nil}function FH(t,e){if(zR(t)&&(FR(t),LR(t))){BH(t,e);return}(0,MR.boolOrEmptySchema)(t,e)}function LR({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function zR(t){return typeof t.schema!="boolean"}function BH(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&jR(t),GH(t),VH(t);let a=n.const("_errs",ge.default.errors);BR(t,a),n.var(e,(0,ne._)`${a} === ${ge.default.errors}`)}function FR(t){(0,Zi.checkUnknownRules)(t),jH(t)}function BR(t,e){if(t.opts.jtd)return OR(t,[],!1,e);let r=(0,RR.getSchemaTypes)(t.schema),n=(0,RR.coerceAndCheckDataType)(t,r);OR(t,r,!n,e)}function jH(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function UH(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zi.checkStrictMode)(t,"default is ignored in the schema root")}function GH(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,OH.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function VH(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function jR({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)t.code((0,ne._)`${ge.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,ne.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,ne._)`${ge.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function HH(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=t;r.$async?e.if((0,ne._)`${ge.default.errors} === 0`,()=>e.return(ge.default.data),()=>e.throw((0,ne._)`new ${i}(${ge.default.vErrors})`)):(e.assign((0,ne._)`${n}.errors`,ge.default.vErrors),a.unevaluated&&qH(t),e.return((0,ne._)`${ge.default.errors} === 0`))}function qH({gen:t,evaluated:e,props:r,items:n}){r instanceof ne.Name&&t.assign((0,ne._)`${e}.props`,r),n instanceof ne.Name&&t.assign((0,ne._)`${e}.items`,n)}function OR(t,e,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:l,self:c}=t,{RULES:u}=c;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Zi.schemaHasRulesButRef)(a,u))){i.block(()=>GR(t,"$ref",u.all.$ref.definition));return}l.jtd||WH(t,e),i.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,yw.shouldUseGroup)(a,m)&&(m.type?(i.if((0,xh.checkDataType)(m.type,o,l.strictNumbers)),DR(t,m),e.length===1&&e[0]===m.type&&r&&(i.else(),(0,xh.reportTypeError)(t)),i.endIf()):DR(t,m),s||i.if((0,ne._)`${ge.default.errors} === ${n||0}`))}}function DR(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,NH.assignDefaults)(t,e.type),r.block(()=>{for(let a of e.rules)(0,yw.shouldUseRule)(n,a)&&GR(t,a.keyword,a.definition,e.type)})}function WH(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(ZH(t,e),t.opts.allowUnionTypes||KH(t,e),JH(t,t.dataTypes))}function ZH(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{UR(t.dataTypes,r)||bw(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),YH(t,e)}}function KH(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&bw(t,"use allowUnionTypes to allow union type keyword")}function JH(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,yw.shouldUseRule)(t.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>XH(e,o))&&bw(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function XH(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function UR(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function YH(t,e){let r=[];for(let n of t.dataTypes)UR(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function bw(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Zi.checkStrictMode)(t,e,t.opts.strictTypes)}var Eh=class{constructor(e,r,n){if((0,ju.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",VR(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ju.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ge.default.errors))}result(e,r,n){this.failResult((0,ne.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ne.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ne._)`${r} !== undefined && (${(0,ne.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Bu.reportExtraError:Bu.reportError)(this,this.def.error,r)}$dataError(){(0,Bu.reportError)(this,this.def.$dataError||Bu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Bu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ne.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ne.nil,r=ne.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,ne.or)((0,ne._)`${i} === undefined`,r)),e!==ne.nil&&n.assign(e,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,ne.or)(o(),s());function o(){if(n.length){if(!(r instanceof ne.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,ne._)`${(0,xh.checkDataTypes)(l,r,a.opts.strictNumbers,xh.DataType.Wrong)}`}return ne.nil}function s(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ne._)`!${l}(${r})`}return ne.nil}}subschema(e,r){let n=(0,gw.getSubschema)(this.it,e);(0,gw.extendSubschemaData)(n,this.it,e),(0,gw.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return FH(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Zi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ne.Name)),!0}};Oa.KeywordCxt=Eh;function GR(t,e,r,n){let i=new Eh(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,ju.funcKeywordCode)(i,r):"macro"in r?(0,ju.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,ju.funcKeywordCode)(i,r)}var QH=/^\/(?:[^~]|~0|~1)*$/,eq=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function VR(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,a;if(t==="")return ge.default.rootData;if(t[0]==="/"){if(!QH.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,a=ge.default.rootData}else{let c=eq.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(a=r[e-u],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,ne._)`${a}${(0,ne.getProperty)((0,Zi.unescapeJsonPointer)(c))}`,o=(0,ne._)`${o} && ${a}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Oa.getData=VR});var Th=P(_w=>{"use strict";Object.defineProperty(_w,"__esModule",{value:!0});var vw=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};_w.default=vw});var Ch=P(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});var Sw=Fu(),ww=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Sw.resolveUrl)(e,r,n),this.missingSchema=(0,Sw.normalizeId)((0,Sw.getFullPath)(e,this.missingRef))}};kw.default=ww});var Ah=P(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.resolveSchema=Tn.getCompilingSchema=Tn.resolveRef=Tn.compileSchema=Tn.SchemaEnv=void 0;var Hn=Ee(),tq=Th(),Io=Wi(),qn=Fu(),HR=We(),rq=Uu(),vl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,qn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Tn.SchemaEnv=vl;function Ew(t){let e=qR.call(this,t);if(e)return e;let r=(0,qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new Hn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;t.$async&&(s=o.scopeValue("Error",{ref:tq.default,code:(0,Hn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");t.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:Io.default.data,parentData:Io.default.parentData,parentDataProperty:Io.default.parentDataProperty,dataNames:[Io.default.data],dataPathArr:[Hn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Hn.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Hn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Hn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,rq.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Io.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Io.default.self}`,`${Io.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:f}=c;p.evaluated={props:h instanceof Hn.Name?void 0:h,items:f instanceof Hn.Name?void 0:f,dynamicProps:h instanceof Hn.Name,dynamicItems:f instanceof Hn.Name},p.source&&(p.source.evaluated=(0,Hn.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Tn.compileSchema=Ew;function nq(t,e,r){var n;r=(0,qn.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let a=oq.call(this,t,r);if(a===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new vl({schema:o,schemaId:s,root:t,baseId:e}))}if(a!==void 0)return t.refs[r]=iq.call(this,a)}Tn.resolveRef=nq;function iq(t){return(0,qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Ew.call(this,t)}function qR(t){for(let e of this._compilations)if(aq(e,t))return e}Tn.getCompilingSchema=qR;function aq(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function oq(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ih.call(this,t,e)}function Ih(t,e){let r=this.opts.uriResolver.parse(e),n=(0,qn._getFullPath)(this.opts.uriResolver,r),i=(0,qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return xw.call(this,r,t);let a=(0,qn.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=Ih.call(this,t,o);return typeof s?.schema!="object"?void 0:xw.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||Ew.call(this,o),a===(0,qn.normalizeId)(e)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(i=(0,qn.resolveUrl)(this.opts.uriResolver,i,c)),new vl({schema:s,schemaId:l,root:t,baseId:i})}return xw.call(this,r,o)}}Tn.resolveSchema=Ih;var sq=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xw(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,HR.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!sq.has(s)&&c&&(e=(0,qn.resolveUrl)(this.opts.uriResolver,e,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,HR.schemaHasRulesButRef)(r,this.RULES)){let s=(0,qn.resolveUrl)(this.opts.uriResolver,e,r.$ref);a=Ih.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new vl({schema:r,schemaId:o,root:n,baseId:e}),a.schema!==a.root.schema)return a}});var WR=P((Uue,lq)=>{lq.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 KR=P((Ph,ZR)=>{"use strict";(function(t,e){typeof Ph=="object"&&typeof ZR<"u"?e(Ph):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Ph,function(t){"use strict";function e(){for(var _=arguments.length,b=Array(_),E=0;E<_;E++)b[E]=arguments[E];if(b.length>1){b[0]=b[0].slice(0,-1);for(var A=b.length-1,R=1;R<A;++R)b[R]=b[R].slice(1,-1);return b[A]=b[A].slice(1),b.join("")}else return b[0]}function r(_){return"(?:"+_+")"}function n(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function i(_){return _.toUpperCase()}function a(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,b){var E=_;if(b)for(var A in b)E[A]=b[A];return E}function s(_){var b="[A-Za-z]",E="[\\x0D]",A="[0-9]",R="[\\x22]",J=e(A,"[A-Fa-f]"),we="[\\x0A]",Ge="[\\x20]",Ye=r(r("%[EFef]"+J+"%"+J+J+"%"+J+J)+"|"+r("%[89A-Fa-f]"+J+"%"+J+J)+"|"+r("%"+J+J)),Ft="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",xt=e(Ft,Be),Bt=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",vt=_?"[\\uE000-\\uF8FF]":"[]",Ze=e(b,A,"[\\-\\.\\_\\~]",Bt),Et=r(b+e(b,A,"[\\+\\-\\.]")+"*"),rt=r(r(Ye+"|"+e(Ze,Be,"[\\:]"))+"*"),Ha=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("[1-9]"+A)+"|"+A),Jr=r(r("25[0-5]")+"|"+r("2[0-4]"+A)+"|"+r("1"+A+A)+"|"+r("0?[1-9]"+A)+"|0?0?"+A),pn=r(Jr+"\\."+Jr+"\\."+Jr+"\\."+Jr),ot=r(J+"{1,4}"),Xr=r(r(ot+"\\:"+ot)+"|"+pn),mn=r(r(ot+"\\:")+"{6}"+Xr),Qn=r("\\:\\:"+r(ot+"\\:")+"{5}"+Xr),qa=r(r(ot)+"?\\:\\:"+r(ot+"\\:")+"{4}"+Xr),wi=r(r(r(ot+"\\:")+"{0,1}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{3}"+Xr),Xl=r(r(r(ot+"\\:")+"{0,2}"+ot)+"?\\:\\:"+r(ot+"\\:")+"{2}"+Xr),Xd=r(r(r(ot+"\\:")+"{0,3}"+ot)+"?\\:\\:"+ot+"\\:"+Xr),Yd=r(r(r(ot+"\\:")+"{0,4}"+ot)+"?\\:\\:"+Xr),Ko=r(r(r(ot+"\\:")+"{0,5}"+ot)+"?\\:\\:"+ot),Jo=r(r(r(ot+"\\:")+"{0,6}"+ot)+"?\\:\\:"),ki=r([mn,Qn,qa,wi,Xl,Xd,Yd,Ko,Jo].join("|")),Xo=r(r(Ze+"|"+Ye)+"+"),mg=r(ki+"\\%25"+Xo),Wa=r(ki+r("\\%25|\\%(?!"+J+"{2})")+Xo),EM=r("[vV]"+J+"+\\."+e(Ze,Be,"[\\:]")+"+"),TM=r("\\["+r(Wa+"|"+ki+"|"+EM)+"\\]"),eE=r(r(Ye+"|"+e(Ze,Be))+"*"),Yl=r(TM+"|"+pn+"(?!"+eE+")|"+eE),Ql=r(A+"*"),tE=r(r(rt+"@")+"?"+Yl+r("\\:"+Ql)+"?"),ec=r(Ye+"|"+e(Ze,Be,"[\\:\\@]")),CM=r(ec+"*"),rE=r(ec+"+"),IM=r(r(Ye+"|"+e(Ze,Be,"[\\@]"))+"+"),xi=r(r("\\/"+CM)+"*"),Yo=r("\\/"+r(rE+xi)+"?"),hg=r(IM+xi),Qd=r(rE+xi),Qo="(?!"+ec+")",w7=r(xi+"|"+Yo+"|"+hg+"|"+Qd+"|"+Qo),es=r(r(ec+"|"+e("[\\/\\?]",vt))+"*"),tc=r(r(ec+"|[\\/\\?]")+"*"),nE=r(r("\\/\\/"+tE+xi)+"|"+Yo+"|"+Qd+"|"+Qo),AM=r(Et+"\\:"+nE+r("\\?"+es)+"?"+r("\\#"+tc)+"?"),PM=r(r("\\/\\/"+tE+xi)+"|"+Yo+"|"+hg+"|"+Qo),RM=r(PM+r("\\?"+es)+"?"+r("\\#"+tc)+"?"),k7=r(AM+"|"+RM),x7=r(Et+"\\:"+nE+r("\\?"+es)+"?"),E7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+Qd+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+tc+")")+"?$",T7="^(){0}"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+hg+"|"+Qo+")")+r("\\?("+es+")")+"?"+r("\\#("+tc+")")+"?$",C7="^("+Et+")\\:"+r(r("\\/\\/("+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?)")+"?("+xi+"|"+Yo+"|"+Qd+"|"+Qo+")")+r("\\?("+es+")")+"?$",I7="^"+r("\\#("+tc+")")+"?$",A7="^"+r("("+rt+")@")+"?("+Yl+")"+r("\\:("+Ql+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,A,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Ze,Be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Ze,Be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Ze,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Ze,Be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]",vt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Ze,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Ze,Be),"g"),UNRESERVED:new RegExp(Ze,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Ze,xt),"g"),PCT_ENCODED:new RegExp(Ye,"g"),IPV4ADDRESS:new RegExp("^("+pn+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ki+")"+r(r("\\%25|\\%(?!"+J+"{2})")+"("+Xo+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function _(b,E){var A=[],R=!0,J=!1,we=void 0;try{for(var Ge=b[Symbol.iterator](),Ye;!(R=(Ye=Ge.next()).done)&&(A.push(Ye.value),!(E&&A.length===E));R=!0);}catch(Ft){J=!0,we=Ft}finally{try{!R&&Ge.return&&Ge.return()}finally{if(J)throw we}}return A}return function(b,E){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return _(b,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(_){if(Array.isArray(_)){for(var b=0,E=Array(_.length);b<_.length;b++)E[b]=_[b];return E}else return Array.from(_)},m=2147483647,p=36,h=1,f=26,y=38,g=700,x=72,v=128,I="-",T=/^xn--/,C=/[^\0-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=p-h,B=Math.floor,Y=String.fromCharCode;function H(_){throw new RangeError(W[_])}function j(_,b){for(var E=[],A=_.length;A--;)E[A]=b(_[A]);return E}function Z(_,b){var E=_.split("@"),A="";E.length>1&&(A=E[0]+"@",_=E[1]),_=_.replace(M,".");var R=_.split("."),J=j(R,b).join(".");return A+J}function ae(_){for(var b=[],E=0,A=_.length;E<A;){var R=_.charCodeAt(E++);if(R>=55296&&R<=56319&&E<A){var J=_.charCodeAt(E++);(J&64512)==56320?b.push(((R&1023)<<10)+(J&1023)+65536):(b.push(R),E--)}else b.push(R)}return b}var $e=function(b){return String.fromCodePoint.apply(String,d(b))},Xe=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:p},At=function(b,E){return b+22+75*(b<26)-((E!=0)<<5)},kt=function(b,E,A){var R=0;for(b=A?B(b/g):b>>1,b+=B(b/E);b>$*f>>1;R+=p)b=B(b/$);return B(R+($+1)*b/(b+y))},S=function(b){var E=[],A=b.length,R=0,J=v,we=x,Ge=b.lastIndexOf(I);Ge<0&&(Ge=0);for(var Ye=0;Ye<Ge;++Ye)b.charCodeAt(Ye)>=128&&H("not-basic"),E.push(b.charCodeAt(Ye));for(var Ft=Ge>0?Ge+1:0;Ft<A;){for(var Be=R,xt=1,Bt=p;;Bt+=p){Ft>=A&&H("invalid-input");var vt=Xe(b.charCodeAt(Ft++));(vt>=p||vt>B((m-R)/xt))&&H("overflow"),R+=vt*xt;var Ze=Bt<=we?h:Bt>=we+f?f:Bt-we;if(vt<Ze)break;var Et=p-Ze;xt>B(m/Et)&&H("overflow"),xt*=Et}var rt=E.length+1;we=kt(R-Be,rt,Be==0),B(R/rt)>m-J&&H("overflow"),J+=B(R/rt),R%=rt,E.splice(R++,0,J)}return String.fromCodePoint.apply(String,E)},xr=function(b){var E=[];b=ae(b);var A=b.length,R=v,J=0,we=x,Ge=!0,Ye=!1,Ft=void 0;try{for(var Be=b[Symbol.iterator](),xt;!(Ge=(xt=Be.next()).done);Ge=!0){var Bt=xt.value;Bt<128&&E.push(Y(Bt))}}catch(Wa){Ye=!0,Ft=Wa}finally{try{!Ge&&Be.return&&Be.return()}finally{if(Ye)throw Ft}}var vt=E.length,Ze=vt;for(vt&&E.push(I);Ze<A;){var Et=m,rt=!0,Ha=!1,Jr=void 0;try{for(var pn=b[Symbol.iterator](),ot;!(rt=(ot=pn.next()).done);rt=!0){var Xr=ot.value;Xr>=R&&Xr<Et&&(Et=Xr)}}catch(Wa){Ha=!0,Jr=Wa}finally{try{!rt&&pn.return&&pn.return()}finally{if(Ha)throw Jr}}var mn=Ze+1;Et-R>B((m-J)/mn)&&H("overflow"),J+=(Et-R)*mn,R=Et;var Qn=!0,qa=!1,wi=void 0;try{for(var Xl=b[Symbol.iterator](),Xd;!(Qn=(Xd=Xl.next()).done);Qn=!0){var Yd=Xd.value;if(Yd<R&&++J>m&&H("overflow"),Yd==R){for(var Ko=J,Jo=p;;Jo+=p){var ki=Jo<=we?h:Jo>=we+f?f:Jo-we;if(Ko<ki)break;var Xo=Ko-ki,mg=p-ki;E.push(Y(At(ki+Xo%mg,0))),Ko=B(Xo/mg)}E.push(Y(At(Ko,0))),we=kt(J,mn,Ze==vt),J=0,++Ze}}}catch(Wa){qa=!0,wi=Wa}finally{try{!Qn&&Xl.return&&Xl.return()}finally{if(qa)throw wi}}++J,++R}return E.join("")},Pn=function(b){return Z(b,function(E){return T.test(E)?S(E.slice(4).toLowerCase()):E})},k=function(b){return Z(b,function(E){return C.test(E)?"xn--"+xr(E):E})},Lt={version:"2.1.0",ucs2:{decode:ae,encode:$e},decode:S,encode:xr,toASCII:k,toUnicode:Pn},zt={};function Mr(_){var b=_.charCodeAt(0),E=void 0;return b<16?E="%0"+b.toString(16).toUpperCase():b<128?E="%"+b.toString(16).toUpperCase():b<2048?E="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():E="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),E}function Rn(_){for(var b="",E=0,A=_.length;E<A;){var R=parseInt(_.substr(E+1,2),16);if(R<128)b+=String.fromCharCode(R),E+=3;else if(R>=194&&R<224){if(A-E>=6){var J=parseInt(_.substr(E+4,2),16);b+=String.fromCharCode((R&31)<<6|J&63)}else b+=_.substr(E,6);E+=6}else if(R>=224){if(A-E>=9){var we=parseInt(_.substr(E+4,2),16),Ge=parseInt(_.substr(E+7,2),16);b+=String.fromCharCode((R&15)<<12|(we&63)<<6|Ge&63)}else b+=_.substr(E,9);E+=9}else b+=_.substr(E,3),E+=3}return b}function Pt(_,b){function E(A){var R=Rn(A);return R.match(b.UNRESERVED)?R:A}return _.scheme&&(_.scheme=String(_.scheme).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(b.PCT_ENCODED,E).replace(b.NOT_USERINFO,Mr).replace(b.PCT_ENCODED,i)),_.host!==void 0&&(_.host=String(_.host).replace(b.PCT_ENCODED,E).toLowerCase().replace(b.NOT_HOST,Mr).replace(b.PCT_ENCODED,i)),_.path!==void 0&&(_.path=String(_.path).replace(b.PCT_ENCODED,E).replace(_.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Mr).replace(b.PCT_ENCODED,i)),_.query!==void 0&&(_.query=String(_.query).replace(b.PCT_ENCODED,E).replace(b.NOT_QUERY,Mr).replace(b.PCT_ENCODED,i)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(b.PCT_ENCODED,E).replace(b.NOT_FRAGMENT,Mr).replace(b.PCT_ENCODED,i)),_}function _i(_){return _.replace(/^0*(.*)/,"$1")||"0"}function $r(_,b){var E=_.match(b.IPV4ADDRESS)||[],A=u(E,2),R=A[1];return R?R.split(".").map(_i).join("."):_}function Si(_,b){var E=_.match(b.IPV6ADDRESS)||[],A=u(E,3),R=A[1],J=A[2];if(R){for(var we=R.toLowerCase().split("::").reverse(),Ge=u(we,2),Ye=Ge[0],Ft=Ge[1],Be=Ft?Ft.split(":").map(_i):[],xt=Ye.split(":").map(_i),Bt=b.IPV4ADDRESS.test(xt[xt.length-1]),vt=Bt?7:8,Ze=xt.length-vt,Et=Array(vt),rt=0;rt<vt;++rt)Et[rt]=Be[rt]||xt[Ze+rt]||"";Bt&&(Et[vt-1]=$r(Et[vt-1],b));var Ha=Et.reduce(function(mn,Qn,qa){if(!Qn||Qn==="0"){var wi=mn[mn.length-1];wi&&wi.index+wi.length===qa?wi.length++:mn.push({index:qa,length:1})}return mn},[]),Jr=Ha.sort(function(mn,Qn){return Qn.length-mn.length})[0],pn=void 0;if(Jr&&Jr.length>1){var ot=Et.slice(0,Jr.index),Xr=Et.slice(Jr.index+Jr.length);pn=ot.join(":")+"::"+Xr.join(":")}else pn=Et.join(":");return J&&(pn+="%"+J),pn}else return _}var ra=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Zl="".match(/(){0}/)[1]===void 0;function cn(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},A=b.iri!==!1?c:l;b.reference==="suffix"&&(_=(b.scheme?b.scheme+":":"")+"//"+_);var R=_.match(ra);if(R){Zl?(E.scheme=R[1],E.userinfo=R[3],E.host=R[4],E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=R[7],E.fragment=R[8],isNaN(E.port)&&(E.port=R[5])):(E.scheme=R[1]||void 0,E.userinfo=_.indexOf("@")!==-1?R[3]:void 0,E.host=_.indexOf("//")!==-1?R[4]:void 0,E.port=parseInt(R[5],10),E.path=R[6]||"",E.query=_.indexOf("?")!==-1?R[7]:void 0,E.fragment=_.indexOf("#")!==-1?R[8]:void 0,isNaN(E.port)&&(E.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),E.host&&(E.host=Si($r(E.host,A),A)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==E.reference&&(E.error=E.error||"URI is not a "+b.reference+" reference.");var J=zt[(b.scheme||E.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!J||!J.unicodeSupport)){if(E.host&&(b.domainHost||J&&J.domainHost))try{E.host=Lt.toASCII(E.host.replace(A.PCT_ENCODED,Rn).toLowerCase())}catch(we){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+we}Pt(E,l)}else Pt(E,A);J&&J.parse&&J.parse(E,b)}else E.error=E.error||"URI can not be parsed.";return E}function Wd(_,b){var E=b.iri!==!1?c:l,A=[];return _.userinfo!==void 0&&(A.push(_.userinfo),A.push("@")),_.host!==void 0&&A.push(Si($r(String(_.host),E),E).replace(E.IPV6ADDRESS,function(R,J,we){return"["+J+(we?"%25"+we:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(A.push(":"),A.push(String(_.port))),A.length?A.join(""):void 0}var Kl=/^\.\.?\//,Zd=/^\/\.(\/|$)/,Jl=/^\/\.\.(\/|$)/,Kd=/^\/?(?:.|\n)*?(?=\/|$)/;function na(_){for(var b=[];_.length;)if(_.match(Kl))_=_.replace(Kl,"");else if(_.match(Zd))_=_.replace(Zd,"/");else if(_.match(Jl))_=_.replace(Jl,"/"),b.pop();else if(_==="."||_==="..")_="";else{var E=_.match(Kd);if(E){var A=E[0];_=_.slice(A.length),b.push(A)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function un(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=b.iri?c:l,A=[],R=zt[(b.scheme||_.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(_,b),_.host&&!E.IPV6ADDRESS.test(_.host)){if(b.domainHost||R&&R.domainHost)try{_.host=b.iri?Lt.toUnicode(_.host):Lt.toASCII(_.host.replace(E.PCT_ENCODED,Rn).toLowerCase())}catch(Ge){_.error=_.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+Ge}}Pt(_,E),b.reference!=="suffix"&&_.scheme&&(A.push(_.scheme),A.push(":"));var J=Wd(_,b);if(J!==void 0&&(b.reference!=="suffix"&&A.push("//"),A.push(J),_.path&&_.path.charAt(0)!=="/"&&A.push("/")),_.path!==void 0){var we=_.path;!b.absolutePath&&(!R||!R.absolutePath)&&(we=na(we)),J===void 0&&(we=we.replace(/^\/\//,"/%2F")),A.push(we)}return _.query!==void 0&&(A.push("?"),A.push(_.query)),_.fragment!==void 0&&(A.push("#"),A.push(_.fragment)),A.join("")}function Jd(_,b){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=arguments[3],R={};return A||(_=cn(un(_,E),E),b=cn(un(b,E),E)),E=E||{},!E.tolerant&&b.scheme?(R.scheme=b.scheme,R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(R.userinfo=b.userinfo,R.host=b.host,R.port=b.port,R.path=na(b.path||""),R.query=b.query):(b.path?(b.path.charAt(0)==="/"?R.path=na(b.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?R.path="/"+b.path:_.path?R.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+b.path:R.path=b.path,R.path=na(R.path)),R.query=b.query):(R.path=_.path,b.query!==void 0?R.query=b.query:R.query=_.query),R.userinfo=_.userinfo,R.host=_.host,R.port=_.port),R.scheme=_.scheme),R.fragment=b.fragment,R}function ug(_,b,E){var A=o({scheme:"null"},E);return un(Jd(cn(_,A),cn(b,A),A,!0),A)}function dg(_,b){return typeof _=="string"?_=un(cn(_,b),b):n(_)==="object"&&(_=cn(un(_,b),b)),_}function O(_,b,E){return typeof _=="string"?_=un(cn(_,E),E):n(_)==="object"&&(_=un(_,E)),typeof b=="string"?b=un(cn(b,E),E):n(b)==="object"&&(b=un(b,E)),_===b}function G(_,b){return _&&_.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Mr)}function oe(_,b){return _&&_.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,Rn)}var Se={scheme:"http",domainHost:!0,parse:function(b,E){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,E){var A=String(b.scheme).toLowerCase()==="https";return(b.port===(A?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Je={scheme:"https",domainHost:Se.domainHost,parse:Se.parse,serialize:Se.serialize};function Lr(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Kr={scheme:"ws",domainHost:!0,parse:function(b,E){var A=b;return A.secure=Lr(A),A.resourceName=(A.path||"/")+(A.query?"?"+A.query:""),A.path=void 0,A.query=void 0,A},serialize:function(b,E){if((b.port===(Lr(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var A=b.resourceName.split("?"),R=u(A,2),J=R[0],we=R[1];b.path=J&&J!=="/"?J:void 0,b.query=we,b.resourceName=void 0}return b.fragment=void 0,b}},dn={scheme:"wss",domainHost:Kr.domainHost,parse:Kr.parse,serialize:Kr.serialize},Ga={},Va=!0,ur="[A-Za-z0-9\\-\\.\\_\\~"+(Va?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xt="[0-9A-Fa-f]",Nn=r(r("%[EFef]"+Xt+"%"+Xt+Xt+"%"+Xt+Xt)+"|"+r("%[89A-Fa-f]"+Xt+"%"+Xt+Xt)+"|"+r("%"+Xt+Xt)),gM="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yM="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bM=e(yM,'[\\"\\\\]'),vM="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_M=new RegExp(ur,"g"),Zo=new RegExp(Nn,"g"),SM=new RegExp(e("[^]",gM,"[\\.]",'[\\"]',bM),"g"),Jx=new RegExp(e("[^]",ur,vM),"g"),wM=Jx;function pg(_){var b=Rn(_);return b.match(_M)?b:_}var Xx={scheme:"mailto",parse:function(b,E){var A=b,R=A.to=A.path?A.path.split(","):[];if(A.path=void 0,A.query){for(var J=!1,we={},Ge=A.query.split("&"),Ye=0,Ft=Ge.length;Ye<Ft;++Ye){var Be=Ge[Ye].split("=");switch(Be[0]){case"to":for(var xt=Be[1].split(","),Bt=0,vt=xt.length;Bt<vt;++Bt)R.push(xt[Bt]);break;case"subject":A.subject=oe(Be[1],E);break;case"body":A.body=oe(Be[1],E);break;default:J=!0,we[oe(Be[0],E)]=oe(Be[1],E);break}}J&&(A.headers=we)}A.query=void 0;for(var Ze=0,Et=R.length;Ze<Et;++Ze){var rt=R[Ze].split("@");if(rt[0]=oe(rt[0]),E.unicodeSupport)rt[1]=oe(rt[1],E).toLowerCase();else try{rt[1]=Lt.toASCII(oe(rt[1],E).toLowerCase())}catch(Ha){A.error=A.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ha}R[Ze]=rt.join("@")}return A},serialize:function(b,E){var A=b,R=a(b.to);if(R){for(var J=0,we=R.length;J<we;++J){var Ge=String(R[J]),Ye=Ge.lastIndexOf("@"),Ft=Ge.slice(0,Ye).replace(Zo,pg).replace(Zo,i).replace(SM,Mr),Be=Ge.slice(Ye+1);try{Be=E.iri?Lt.toUnicode(Be):Lt.toASCII(oe(Be,E).toLowerCase())}catch(Ze){A.error=A.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Ze}R[J]=Ft+"@"+Be}A.path=R.join(",")}var xt=b.headers=b.headers||{};b.subject&&(xt.subject=b.subject),b.body&&(xt.body=b.body);var Bt=[];for(var vt in xt)xt[vt]!==Ga[vt]&&Bt.push(vt.replace(Zo,pg).replace(Zo,i).replace(Jx,Mr)+"="+xt[vt].replace(Zo,pg).replace(Zo,i).replace(wM,Mr));return Bt.length&&(A.query=Bt.join("&")),A}},kM=/^([^\:]+)\:(.*)/,Yx={scheme:"urn",parse:function(b,E){var A=b.path&&b.path.match(kM),R=b;if(A){var J=E.scheme||R.scheme||"urn",we=A[1].toLowerCase(),Ge=A[2],Ye=J+":"+(E.nid||we),Ft=zt[Ye];R.nid=we,R.nss=Ge,R.path=void 0,Ft&&(R=Ft.parse(R,E))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(b,E){var A=E.scheme||b.scheme||"urn",R=b.nid,J=A+":"+(E.nid||R),we=zt[J];we&&(b=we.serialize(b,E));var Ge=b,Ye=b.nss;return Ge.path=(R||E.nid)+":"+Ye,Ge}},xM=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Qx={scheme:"urn:uuid",parse:function(b,E){var A=b;return A.uuid=A.nss,A.nss=void 0,!E.tolerant&&(!A.uuid||!A.uuid.match(xM))&&(A.error=A.error||"UUID is not valid."),A},serialize:function(b,E){var A=b;return A.nss=(b.uuid||"").toLowerCase(),A}};zt[Se.scheme]=Se,zt[Je.scheme]=Je,zt[Kr.scheme]=Kr,zt[dn.scheme]=dn,zt[Xx.scheme]=Xx,zt[Yx.scheme]=Yx,zt[Qx.scheme]=Qx,t.SCHEMES=zt,t.pctEncChar=Mr,t.pctDecChars=Rn,t.parse=cn,t.removeDotSegments=na,t.serialize=un,t.resolveComponents=Jd,t.resolve=ug,t.normalize=dg,t.equal=O,t.escapeComponent=G,t.unescapeComponent=oe,Object.defineProperty(t,"__esModule",{value:!0})})});var XR=P(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});var JR=KR();JR.code='require("ajv/dist/runtime/uri").default';Tw.default=JR});var aN=P(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.CodeGen=sr.Name=sr.nil=sr.stringify=sr.str=sr._=sr.KeywordCxt=void 0;var cq=Uu();Object.defineProperty(sr,"KeywordCxt",{enumerable:!0,get:function(){return cq.KeywordCxt}});var _l=Ee();Object.defineProperty(sr,"_",{enumerable:!0,get:function(){return _l._}});Object.defineProperty(sr,"str",{enumerable:!0,get:function(){return _l.str}});Object.defineProperty(sr,"stringify",{enumerable:!0,get:function(){return _l.stringify}});Object.defineProperty(sr,"nil",{enumerable:!0,get:function(){return _l.nil}});Object.defineProperty(sr,"Name",{enumerable:!0,get:function(){return _l.Name}});Object.defineProperty(sr,"CodeGen",{enumerable:!0,get:function(){return _l.CodeGen}});var uq=Th(),rN=Ch(),dq=sw(),Gu=Ah(),pq=Ee(),Vu=Fu(),Rh=zu(),Iw=We(),YR=WR(),mq=XR(),nN=(t,e)=>new RegExp(t,e);nN.code="new RegExp";var hq=["removeAdditional","useDefaults","coerceTypes"],fq=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),gq={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."},yq={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},QR=200;function bq(t){var e,r,n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$;let B=t.strict,Y=(e=t.code)===null||e===void 0?void 0:e.optimize,H=Y===!0||Y===void 0?1:Y||0,j=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:nN,Z=(i=t.uriResolver)!==null&&i!==void 0?i:mq.default;return{strictSchema:(o=(a=t.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=t.strictNumbers)!==null&&s!==void 0?s:B)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:B)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:B)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=t.strictRequired)!==null&&p!==void 0?p:B)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:H,regExp:j}:{optimize:H,regExp:j},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:QR,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:QR,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(x=t.messages)!==null&&x!==void 0?x:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(I=t.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=t.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(W=t.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:($=t.int32range)!==null&&$!==void 0?$:!0,uriResolver:Z}}var Hu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...bq(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new pq.ValueScope({scope:{},prefixes:fq,es5:r,lines:n}),this.logger=xq(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,dq.getRules)(),eN.call(this,gq,e,"NOT SUPPORTED"),eN.call(this,yq,e,"DEPRECATED","warn"),this._metaOpts=wq.call(this),e.formats&&_q.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Sq.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),vq.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=YR;n==="id"&&(i={...YR},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await a.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function a(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof rN.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await a.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let a;if(typeof e=="object"){let{schemaId:o}=this.opts;if(a=e[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Vu.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(e){let r;for(;typeof(r=tN.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Gu.SchemaEnv({schema:{},schemaId:n});if(r=Gu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=tN.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Tq.call(this,n,r),!r)return(0,Iw.eachItem)(n,a=>Cw.call(this,a)),this;Iq.call(this,r);let i={...r,type:(0,Rh.getJSONTypes)(r.type),schemaType:(0,Rh.getJSONTypes)(r.schemaType)};return(0,Iw.eachItem)(n,i.type.length===0?a=>Cw.call(this,a,i):a=>i.type.forEach(o=>Cw.call(this,a,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let a=i.split("/").slice(1),o=e;for(let s of a)o=o[s];for(let s in n){let l=n[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=iN(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,Vu.normalizeId)(o||n);let c=Vu.getSchemaRefs.call(this,e,n);return l=new Gu.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Gu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Gu.compileSchema.call(this,e)}finally{this.opts=r}}};sr.default=Hu;Hu.ValidationError=uq.default;Hu.MissingRefError=rN.default;function eN(t,e,r,n="error"){for(let i in t){let a=i;a in e&&this.logger[n](`${r}: option ${i}. ${t[a]}`)}}function tN(t){return t=(0,Vu.normalizeId)(t),this.schemas[t]||this.refs[t]}function vq(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function _q(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Sq(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function wq(){let t={...this.opts};for(let e of hq)delete t[e];return t}var kq={log(){},warn(){},error(){}};function xq(t){if(t===!1)return kq;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Eq=/^[a-z_$][a-z0-9_$:-]*$/i;function Tq(t,e){let{RULES:r}=this;if((0,Iw.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Eq.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Cw(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Rh.getJSONTypes)(e.type),schemaType:(0,Rh.getJSONTypes)(e.schemaType)}};e.before?Cq.call(this,o,s,e.before):o.rules.push(s),a.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function Cq(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Iq(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=iN(e)),t.validateSchema=this.compile(e,!0))}var Aq={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function iN(t){return{anyOf:[t,Aq]}}});var oN=P(Aw=>{"use strict";Object.defineProperty(Aw,"__esModule",{value:!0});var Pq={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Aw.default=Pq});var uN=P(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.callRef=Ao.getValidate=void 0;var Rq=Ch(),sN=En(),qr=Ee(),Sl=Wi(),lN=Ah(),Nh=We(),Nq={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:l}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=lN.resolveRef.call(l,c,i,r);if(u===void 0)throw new Rq.default(n.opts.uriResolver,i,r);if(u instanceof lN.SchemaEnv)return m(u);return p(u);function d(){if(a===c)return Oh(t,o,a,a.$async);let h=e.scopeValue("root",{ref:c});return Oh(t,(0,qr._)`${h}.validate`,c,c.$async)}function m(h){let f=cN(t,h);Oh(t,f,h,h.$async)}function p(h){let f=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,qr.stringify)(h)}:{ref:h}),y=e.name("valid"),g=t.subschema({schema:h,dataTypes:[],schemaPath:qr.nil,topSchemaRef:f,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function cN(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ao.getValidate=cN;function Oh(t,e,r,n){let{gen:i,it:a}=t,{allErrors:o,schemaEnv:s,opts:l}=a,c=l.passContext?Sl.default.this:qr.nil;n?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,qr._)`await ${(0,sN.callValidateCode)(t,e,c)}`),p(e),o||i.assign(h,!0)},f=>{i.if((0,qr._)`!(${f} instanceof ${a.ValidationError})`,()=>i.throw(f)),m(f),o||i.assign(h,!1)}),t.ok(h)}function d(){t.result((0,sN.callValidateCode)(t,e,c),()=>p(e),()=>m(e))}function m(h){let f=(0,qr._)`${h}.errors`;i.assign(Sl.default.vErrors,(0,qr._)`${Sl.default.vErrors} === null ? ${f} : ${Sl.default.vErrors}.concat(${f})`),i.assign(Sl.default.errors,(0,qr._)`${Sl.default.vErrors}.length`)}function p(h){var f;if(!a.opts.unevaluated)return;let y=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(a.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(a.props=Nh.mergeEvaluated.props(i,y.props,a.props));else{let g=i.var("props",(0,qr._)`${h}.evaluated.props`);a.props=Nh.mergeEvaluated.props(i,g,a.props,qr.Name)}if(a.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(a.items=Nh.mergeEvaluated.items(i,y.items,a.items));else{let g=i.var("items",(0,qr._)`${h}.evaluated.items`);a.items=Nh.mergeEvaluated.items(i,g,a.items,qr.Name)}}}Ao.callRef=Oh;Ao.default=Nq});var dN=P(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});var Oq=oN(),Dq=uN(),Mq=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Oq.default,Dq.default];Pw.default=Mq});var pN=P(Rw=>{"use strict";Object.defineProperty(Rw,"__esModule",{value:!0});var Dh=Ee(),Da=Dh.operators,Mh={maximum:{okStr:"<=",ok:Da.LTE,fail:Da.GT},minimum:{okStr:">=",ok:Da.GTE,fail:Da.LT},exclusiveMaximum:{okStr:"<",ok:Da.LT,fail:Da.GTE},exclusiveMinimum:{okStr:">",ok:Da.GT,fail:Da.LTE}},$q={message:({keyword:t,schemaCode:e})=>(0,Dh.str)`must be ${Mh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Dh._)`{comparison: ${Mh[t].okStr}, limit: ${e}}`},Lq={keyword:Object.keys(Mh),type:"number",schemaType:"number",$data:!0,error:$q,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Dh._)`${r} ${Mh[e].fail} ${n} || isNaN(${r})`)}};Rw.default=Lq});var mN=P(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0});var qu=Ee(),zq={message:({schemaCode:t})=>(0,qu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,qu._)`{multipleOf: ${t}}`},Fq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:zq,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,a=i.opts.multipleOfPrecision,o=e.let("res"),s=a?(0,qu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,qu._)`${o} !== parseInt(${o})`;t.fail$data((0,qu._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};Nw.default=Fq});var fN=P(Ow=>{"use strict";Object.defineProperty(Ow,"__esModule",{value:!0});function hN(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}Ow.default=hN;hN.code='require("ajv/dist/runtime/ucs2length").default'});var gN=P(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});var Po=Ee(),Bq=We(),jq=fN(),Uq={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Po.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Po._)`{limit: ${t}}`},Gq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Uq,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,a=e==="maxLength"?Po.operators.GT:Po.operators.LT,o=i.opts.unicode===!1?(0,Po._)`${r}.length`:(0,Po._)`${(0,Bq.useFunc)(t.gen,jq.default)}(${r})`;t.fail$data((0,Po._)`${o} ${a} ${n}`)}};Dw.default=Gq});var yN=P(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});var Vq=En(),$h=Ee(),Hq={message:({schemaCode:t})=>(0,$h.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,$h._)`{pattern: ${t}}`},qq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Hq,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:a}=t,o=a.opts.unicodeRegExp?"u":"",s=r?(0,$h._)`(new RegExp(${i}, ${o}))`:(0,Vq.usePattern)(t,n);t.fail$data((0,$h._)`!${s}.test(${e})`)}};Mw.default=qq});var bN=P($w=>{"use strict";Object.defineProperty($w,"__esModule",{value:!0});var Wu=Ee(),Wq={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Wu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Wu._)`{limit: ${t}}`},Zq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Wq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Wu.operators.GT:Wu.operators.LT;t.fail$data((0,Wu._)`Object.keys(${r}).length ${i} ${n}`)}};$w.default=Zq});var vN=P(Lw=>{"use strict";Object.defineProperty(Lw,"__esModule",{value:!0});var Zu=En(),Ku=Ee(),Kq=We(),Jq={message:({params:{missingProperty:t}})=>(0,Ku.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ku._)`{missingProperty: ${t}}`},Xq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Jq,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:a,it:o}=t,{opts:s}=o;if(!a&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(p?.[f]===void 0&&!h.has(f)){let y=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${f}" is not defined at "${y}" (strictRequired)`;(0,Kq.checkStrictMode)(o,g,o.opts.strictRequired)}}function c(){if(l||a)t.block$data(Ku.nil,d);else for(let p of r)(0,Zu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(l||a){let h=e.let("valid",!0);t.block$data(h,()=>m(p,h)),t.ok(h)}else e.if((0,Zu.checkMissingProp)(t,r,p)),(0,Zu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Zu.noPropertyInData)(e,i,p,s.ownProperties),()=>t.error())})}function m(p,h){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(h,(0,Zu.propertyInData)(e,i,p,s.ownProperties)),e.if((0,Ku.not)(h),()=>{t.error(),e.break()})},Ku.nil)}}};Lw.default=Xq});var _N=P(zw=>{"use strict";Object.defineProperty(zw,"__esModule",{value:!0});var Ju=Ee(),Yq={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ju.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ju._)`{limit: ${t}}`},Qq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Yq,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Ju.operators.GT:Ju.operators.LT;t.fail$data((0,Ju._)`${r}.length ${i} ${n}`)}};zw.default=Qq});var Lh=P(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var SN=cu();SN.code='require("ajv/dist/runtime/equal").default';Fw.default=SN});var wN=P(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});var Bw=zu(),lr=Ee(),eW=We(),tW=Lh(),rW={message:({params:{i:t,j:e}})=>(0,lr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,lr._)`{i: ${t}, j: ${e}}`},nW={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rW,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=t;if(!n&&!i)return;let l=e.let("valid"),c=a.items?(0,Bw.getSchemaTypes)(a.items):[];t.block$data(l,u,(0,lr._)`${o} === false`),t.ok(l);function u(){let h=e.let("i",(0,lr._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(l,!0),e.if((0,lr._)`${h} > 1`,()=>(d()?m:p)(h,f))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function m(h,f){let y=e.name("item"),g=(0,Bw.checkDataTypes)(c,y,s.opts.strictNumbers,Bw.DataType.Wrong),x=e.const("indices",(0,lr._)`{}`);e.for((0,lr._)`;${h}--;`,()=>{e.let(y,(0,lr._)`${r}[${h}]`),e.if(g,(0,lr._)`continue`),c.length>1&&e.if((0,lr._)`typeof ${y} == "string"`,(0,lr._)`${y} += "_"`),e.if((0,lr._)`typeof ${x}[${y}] == "number"`,()=>{e.assign(f,(0,lr._)`${x}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,lr._)`${x}[${y}] = ${h}`)})}function p(h,f){let y=(0,eW.useFunc)(e,tW.default),g=e.name("outer");e.label(g).for((0,lr._)`;${h}--;`,()=>e.for((0,lr._)`${f} = ${h}; ${f}--;`,()=>e.if((0,lr._)`${y}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};jw.default=nW});var kN=P(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});var Uw=Ee(),iW=We(),aW=Lh(),oW={message:"must be equal to constant",params:({schemaCode:t})=>(0,Uw._)`{allowedValue: ${t}}`},sW={keyword:"const",$data:!0,error:oW,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:a}=t;n||a&&typeof a=="object"?t.fail$data((0,Uw._)`!${(0,iW.useFunc)(e,aW.default)}(${r}, ${i})`):t.fail((0,Uw._)`${a} !== ${r}`)}};Gw.default=sW});var xN=P(Vw=>{"use strict";Object.defineProperty(Vw,"__esModule",{value:!0});var Xu=Ee(),lW=We(),cW=Lh(),uW={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Xu._)`{allowedValues: ${t}}`},dW={keyword:"enum",schemaType:"array",$data:!0,error:uW,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:a,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,lW.useFunc)(e,cW.default)),u;if(s||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",a);u=(0,Xu.or)(...i.map((h,f)=>m(p,f)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",a,p=>e.if((0,Xu._)`${c()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function m(p,h){let f=i[h];return typeof f=="object"&&f!==null?(0,Xu._)`${c()}(${r}, ${p}[${h}])`:(0,Xu._)`${r} === ${f}`}}};Vw.default=dW});var EN=P(Hw=>{"use strict";Object.defineProperty(Hw,"__esModule",{value:!0});var pW=pN(),mW=mN(),hW=gN(),fW=yN(),gW=bN(),yW=vN(),bW=_N(),vW=wN(),_W=kN(),SW=xN(),wW=[pW.default,mW.default,hW.default,fW.default,gW.default,yW.default,bW.default,vW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},_W.default,SW.default];Hw.default=wW});var Ww=P(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.validateAdditionalItems=void 0;var Ro=Ee(),qw=We(),kW={message:({params:{len:t}})=>(0,Ro.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ro._)`{limit: ${t}}`},xW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:kW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,qw.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}TN(t,n)}};function TN(t,e){let{gen:r,schema:n,data:i,keyword:a,it:o}=t;o.items=!0;let s=r.const("len",(0,Ro._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ro._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,qw.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,Ro._)`${s} <= ${e.length}`);r.if((0,Ro.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,s,u=>{t.subschema({keyword:a,dataProp:u,dataPropType:qw.Type.Num},c),o.allErrors||r.if((0,Ro.not)(c),()=>r.break())})}}Yu.validateAdditionalItems=TN;Yu.default=xW});var Zw=P(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.validateTuple=void 0;var CN=Ee(),zh=We(),EW=En(),TW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return IN(t,"additionalItems",e);r.items=!0,!(0,zh.alwaysValidSchema)(r,e)&&t.ok((0,EW.validateArray)(t))}};function IN(t,e,r=t.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=t;u(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=zh.mergeEvaluated.items(n,r.length,s.items));let l=n.name("valid"),c=n.const("len",(0,CN._)`${a}.length`);r.forEach((d,m)=>{(0,zh.alwaysValidSchema)(s,d)||(n.if((0,CN._)`${c} > ${m}`,()=>t.subschema({keyword:o,schemaProp:m,dataProp:m},l)),t.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(m.strictTuples&&!f){let y=`"${o}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,zh.checkStrictMode)(s,y,m.strictTuples)}}}Qu.validateTuple=IN;Qu.default=TW});var AN=P(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});var CW=Zw(),IW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,CW.validateTuple)(t,"items")};Kw.default=IW});var RN=P(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});var PN=Ee(),AW=We(),PW=En(),RW=Ww(),NW={message:({params:{len:t}})=>(0,PN.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,PN._)`{limit: ${t}}`},OW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:NW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,AW.alwaysValidSchema)(n,e)&&(i?(0,RW.validateAdditionalItems)(t,i):t.ok((0,PW.validateArray)(t)))}};Jw.default=OW});var NN=P(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});var Cn=Ee(),Fh=We(),DW={message:({params:{min:t,max:e}})=>e===void 0?(0,Cn.str)`must contain at least ${t} valid item(s)`:(0,Cn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Cn._)`{minContains: ${t}}`:(0,Cn._)`{minContains: ${t}, maxContains: ${e}}`},MW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:DW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t,o,s,{minContains:l,maxContains:c}=n;a.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=e.const("len",(0,Cn._)`${i}.length`);if(t.setParams({min:o,max:s}),s===void 0&&o===0){(0,Fh.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,Fh.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Fh.alwaysValidSchema)(a,r)){let f=(0,Cn._)`${u} >= ${o}`;s!==void 0&&(f=(0,Cn._)`${f} && ${u} <= ${s}`),t.pass(f);return}a.items=!0;let d=e.name("valid");s===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),s!==void 0&&e.if((0,Cn._)`${i}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let f=e.name("_valid"),y=e.let("count",0);p(f,()=>e.if(f,()=>h(y)))}function p(f,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Fh.Type.Num,compositeRule:!0},f),y()})}function h(f){e.code((0,Cn._)`${f}++`),s===void 0?e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Cn._)`${f} > ${s}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Cn._)`${f} >= ${o}`,()=>e.assign(d,!0)))}}};Xw.default=MW});var MN=P(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.validateSchemaDeps=fi.validatePropertyDeps=fi.error=void 0;var Yw=Ee(),$W=We(),ed=En();fi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Yw.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Yw._)`{property: ${t},
|
|
13
13
|
missingProperty: ${n},
|
|
14
14
|
depsCount: ${e},
|
|
15
|
-
deps: ${r}}`};var $W={keyword:"dependencies",type:"object",schemaType:"object",error:fi.error,code(t){let[e,r]=LW(t);NN(t,e),ON(t,r)}};function LW({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function NN(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,Xu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,Xu.checkReportMissingProp)(t,c)}):(r.if((0,Uw._)`${l} && (${(0,Xu.checkMissingProp)(t,s,a)})`),(0,Xu.reportMissingProp)(t,a),r.else())}}fi.validatePropertyDeps=NN;function ON(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,MW.alwaysValidSchema)(a,e[s])||(r.if((0,Xu.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}fi.validateSchemaDeps=ON;fi.default=$W});var $N=P(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});var MN=Ee(),zW=We(),FW={message:"property name must be valid",params:({params:t})=>(0,MN._)`{propertyName: ${t.propertyName}}`},BW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:FW,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,zW.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,MN.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};Gw.default=BW});var Hw=P(Vw=>{"use strict";Object.defineProperty(Vw,"__esModule",{value:!0});var zh=En(),Wn=Ee(),jW=Wi(),Fh=We(),UW={message:"must NOT have additional properties",params:({params:t})=>(0,Wn._)`{additionalProperty: ${t.additionalProperty}}`},GW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:UW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,Fh.alwaysValidSchema)(o,r))return;let c=(0,zh.allSchemaProperties)(n.properties),u=(0,zh.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Wn._)`${a} === ${jW.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let S=(0,Fh.schemaRefOrVal)(o,n.properties,"properties");g=(0,zh.isOwnProperty)(e,S,y)}else c.length?g=(0,Wn.or)(...c.map(S=>(0,Wn._)`${y} === ${S}`)):g=Wn.nil;return u.length&&(g=(0,Wn.or)(g,...u.map(S=>(0,Wn._)`${(0,zh.usePattern)(t,S)}.test(${y})`))),(0,Wn.not)(g)}function p(y){e.code((0,Wn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,Fh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Wn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Wn.not)(g),()=>e.break()))}}function f(y,g,S){let v={keyword:"additionalProperties",dataProp:y,dataPropType:Fh.Type.Str};S===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};Vw.default=GW});var FN=P(Ww=>{"use strict";Object.defineProperty(Ww,"__esModule",{value:!0});var VW=Fu(),LN=En(),qw=We(),zN=Hw(),HW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&zN.default.code(new VW.KeywordCxt(a,zN.default,"additionalProperties"));let o=(0,LN.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=qw.mergeEvaluated.props(e,(0,qw.toHash)(o),a.props));let s=o.filter(d=>!(0,qw.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,LN.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};Ww.default=HW});var GN=P(Zw=>{"use strict";Object.defineProperty(Zw,"__esModule",{value:!0});var BN=En(),Bh=Ee(),jN=We(),UN=We(),qW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,BN.allSchemaProperties)(r),l=s.filter(f=>(0,jN.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof Bh.Name)&&(a.props=(0,UN.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,jN.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,Bh._)`${(0,BN.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:UN.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,Bh._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,Bh.not)(u),()=>e.break())})})}}};Zw.default=qW});var VN=P(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});var WW=We(),ZW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,WW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Kw.default=ZW});var HN=P(Jw=>{"use strict";Object.defineProperty(Jw,"__esModule",{value:!0});var KW=En(),JW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:KW.validateUnion,error:{message:"must match a schema in anyOf"}};Jw.default=JW});var qN=P(Xw=>{"use strict";Object.defineProperty(Xw,"__esModule",{value:!0});var jh=Ee(),XW=We(),YW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,jh._)`{passingSchemas: ${t.passing}}`},QW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:YW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,XW.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,jh._)`${l} && ${o}`).assign(o,!1).assign(s,(0,jh._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,jh.Name)})})}}};Xw.default=QW});var WN=P(Yw=>{"use strict";Object.defineProperty(Yw,"__esModule",{value:!0});var e5=We(),t5={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,e5.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};Yw.default=t5});var JN=P(Qw=>{"use strict";Object.defineProperty(Qw,"__esModule",{value:!0});var Uh=Ee(),KN=We(),r5={message:({params:t})=>(0,Uh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Uh._)`{failingKeyword: ${t.ifClause}}`},n5={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:r5,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,KN.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=ZN(n,"then"),a=ZN(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,Uh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,Uh._)`${u}`):t.setParams({ifClause:u})}}}};function ZN(t,e){let r=t.schema[e];return r!==void 0&&!(0,KN.alwaysValidSchema)(t,r)}Qw.default=n5});var XN=P(ek=>{"use strict";Object.defineProperty(ek,"__esModule",{value:!0});var i5=We(),a5={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,i5.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};ek.default=a5});var YN=P(tk=>{"use strict";Object.defineProperty(tk,"__esModule",{value:!0});var o5=Lw(),s5=IN(),l5=zw(),c5=PN(),u5=RN(),d5=DN(),p5=$N(),m5=Hw(),h5=FN(),f5=GN(),g5=VN(),y5=HN(),b5=qN(),v5=WN(),_5=JN(),S5=XN();function w5(t=!1){let e=[g5.default,y5.default,b5.default,v5.default,_5.default,S5.default,p5.default,m5.default,d5.default,h5.default,f5.default];return t?e.push(s5.default,c5.default):e.push(o5.default,l5.default),e.push(u5.default),e}tk.default=w5});var QN=P(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var Ot=Ee(),k5={message:({schemaCode:t})=>(0,Ot.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ot._)`{format: ${t}}`},x5={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:k5,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Ot._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Ot._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Ot._)`${f}.type || "string"`).assign(g,(0,Ot._)`${f}.validate`),()=>r.assign(y,(0,Ot._)`"string"`).assign(g,f)),t.fail$data((0,Ot.or)(S(),v()));function S(){return l.strictSchema===!1?Ot.nil:(0,Ot._)`${o} && !${g}`}function v(){let I=u.$async?(0,Ot._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Ot._)`${g}(${n})`,T=(0,Ot._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Ot._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){S();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function S(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Ot.regexpCode)(T):l.code.formats?(0,Ot._)`${l.code.formats}${(0,Ot.getProperty)(a)}`:void 0,$=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Ot._)`${$}.validate`]:["string",T,$]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ot._)`await ${g}(${n})`}return typeof y=="function"?(0,Ot._)`${g}(${n})`:(0,Ot._)`${g}.test(${n})`}}}};rk.default=x5});var eO=P(nk=>{"use strict";Object.defineProperty(nk,"__esModule",{value:!0});var E5=QN(),T5=[E5.default];nk.default=T5});var tO=P(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.contentVocabulary=Sl.metadataVocabulary=void 0;Sl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Sl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var nO=P(ik=>{"use strict";Object.defineProperty(ik,"__esModule",{value:!0});var C5=uN(),I5=xN(),A5=YN(),P5=eO(),rO=tO(),R5=[C5.default,I5.default,(0,A5.default)(),P5.default,rO.metadataVocabulary,rO.contentVocabulary];ik.default=R5});var iO=P(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.DiscrError=void 0;var N5;(function(t){t.Tag="tag",t.Mapping="mapping"})(N5=Yu.DiscrError||(Yu.DiscrError={}))});var oO=P(ok=>{"use strict";Object.defineProperty(ok,"__esModule",{value:!0});var wl=Ee(),ak=iO(),aO=Ch(),O5=We(),D5={message:({params:{discrError:t,tagName:e}})=>t===ak.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,wl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},M5={keyword:"discriminator",type:"object",schemaType:"object",error:D5,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,wl._)`${r}${(0,wl.getProperty)(s)}`);e.if((0,wl._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:ak.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,wl._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:ak.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,wl.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];T?.$ref&&!(0,O5.schemaHasRulesButRef)(T,a.self.RULES)&&(T=aO.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,T?.$ref),T instanceof aO.SchemaEnv&&(T=T.schema));let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),S(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function S(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};ok.default=M5});var sO=P((Ade,$5)=>{$5.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 uO=P((Ct,cO)=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.MissingRefError=Ct.ValidationError=Ct.CodeGen=Ct.Name=Ct.nil=Ct.stringify=Ct.str=Ct._=Ct.KeywordCxt=void 0;var L5=iN(),z5=nO(),F5=oO(),lO=sO(),B5=["/properties"],Gh="http://json-schema.org/draft-07/schema",Vh=class extends L5.default{_addVocabularies(){super._addVocabularies(),z5.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(F5.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(lO,B5):lO;this.addMetaSchema(e,Gh,!1),this.refs["http://json-schema.org/schema"]=Gh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Gh)?Gh:void 0)}};cO.exports=Ct=Vh;Object.defineProperty(Ct,"__esModule",{value:!0});Ct.default=Vh;var j5=Fu();Object.defineProperty(Ct,"KeywordCxt",{enumerable:!0,get:function(){return j5.KeywordCxt}});var kl=Ee();Object.defineProperty(Ct,"_",{enumerable:!0,get:function(){return kl._}});Object.defineProperty(Ct,"str",{enumerable:!0,get:function(){return kl.str}});Object.defineProperty(Ct,"stringify",{enumerable:!0,get:function(){return kl.stringify}});Object.defineProperty(Ct,"nil",{enumerable:!0,get:function(){return kl.nil}});Object.defineProperty(Ct,"Name",{enumerable:!0,get:function(){return kl.Name}});Object.defineProperty(Ct,"CodeGen",{enumerable:!0,get:function(){return kl.CodeGen}});var U5=xh();Object.defineProperty(Ct,"ValidationError",{enumerable:!0,get:function(){return U5.default}});var G5=Eh();Object.defineProperty(Ct,"MissingRefError",{enumerable:!0,get:function(){return G5.default}})});var dO=P(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.formatLimitDefinition=void 0;var V5=uO(),Zn=Ee(),Ma=Zn.operators,Hh={formatMaximum:{okStr:"<=",ok:Ma.LTE,fail:Ma.GT},formatMinimum:{okStr:">=",ok:Ma.GTE,fail:Ma.LT},formatExclusiveMaximum:{okStr:"<",ok:Ma.LT,fail:Ma.GTE},formatExclusiveMinimum:{okStr:">",ok:Ma.GT,fail:Ma.LTE}},H5={message:({keyword:t,schemaCode:e})=>(0,Zn.str)`should be ${Hh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Zn._)`{comparison: ${Hh[t].okStr}, limit: ${e}}`};xl.formatLimitDefinition={keyword:Object.keys(Hh),type:"string",schemaType:"string",$data:!0,error:H5,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:a}=t,{opts:o,self:s}=a;if(!o.validateFormats)return;let l=new V5.KeywordCxt(a,s.RULES.all.format.definition,"format");l.$data?c():u();function c(){let m=e.scopeValue("formats",{ref:s.formats,code:o.code.formats}),p=e.const("fmt",(0,Zn._)`${m}[${l.schemaCode}]`);t.fail$data((0,Zn.or)((0,Zn._)`typeof ${p} != "object"`,(0,Zn._)`${p} instanceof RegExp`,(0,Zn._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=l.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${m}" does not define "compare" function`);let h=e.scopeValue("formats",{key:m,ref:p,code:o.code.formats?(0,Zn._)`${o.code.formats}${(0,Zn.getProperty)(m)}`:void 0});t.fail$data(d(h))}function d(m){return(0,Zn._)`${m}.compare(${r}, ${n}) ${Hh[i].fail} 0`}},dependencies:["format"]};var q5=t=>(t.addKeyword(xl.formatLimitDefinition),t);xl.default=q5});var fO=P((Qu,hO)=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});var El=KP(),W5=dO(),sk=Ee(),pO=new sk.Name("fullFormats"),Z5=new sk.Name("fastFormats"),lk=(t,e={keywords:!0})=>{if(Array.isArray(e))return mO(t,e,El.fullFormats,pO),t;let[r,n]=e.mode==="fast"?[El.fastFormats,Z5]:[El.fullFormats,pO],i=e.formats||El.formatNames;return mO(t,i,r,n),e.keywords&&(0,W5.default)(t),t};lk.get=(t,e="full")=>{let n=(e==="fast"?El.fastFormats:El.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function mO(t,e,r,n){var i,a;(i=(a=t.opts.code).formats)!==null&&i!==void 0||(a.formats=(0,sk._)`require("ajv-formats/dist/formats").${n}`);for(let o of e)t.addFormat(o,r[o])}hO.exports=Qu=lk;Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=lk});var GD=P((PSe,UD)=>{"use strict";var Hf=Object.prototype.hasOwnProperty,jD=Object.prototype.toString,MD=Object.defineProperty,$D=Object.getOwnPropertyDescriptor,LD=function(e){return typeof Array.isArray=="function"?Array.isArray(e):jD.call(e)==="[object Array]"},zD=function(e){if(!e||jD.call(e)!=="[object Object]")return!1;var r=Hf.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Hf.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||Hf.call(e,i)},FD=function(e,r){MD&&r.name==="__proto__"?MD(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},BD=function(e,r){if(r==="__proto__")if(Hf.call(e,r)){if($D)return $D(e,r).value}else return;return e[r]};UD.exports=function t(){var e,r,n,i,a,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(r in e)n=BD(s,r),i=BD(e,r),s!==i&&(u&&i&&(zD(i)||(a=LD(i)))?(a?(a=!1,o=n&&LD(n)?n:[]):o=n&&zD(n)?n:{},FD(s,{name:r,newValue:t(u,o,i)})):typeof i<"u"&&FD(s,{name:r,newValue:i}));return s}});var pM=P(Me=>{"use strict";var Gd=Symbol.for("react.element"),o7=Symbol.for("react.portal"),s7=Symbol.for("react.fragment"),l7=Symbol.for("react.strict_mode"),c7=Symbol.for("react.profiler"),u7=Symbol.for("react.provider"),d7=Symbol.for("react.context"),p7=Symbol.for("react.forward_ref"),m7=Symbol.for("react.suspense"),h7=Symbol.for("react.memo"),f7=Symbol.for("react.lazy"),tM=Symbol.iterator;function g7(t){return t===null||typeof t!="object"?null:(t=tM&&t[tM]||t["@@iterator"],typeof t=="function"?t:null)}var iM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aM=Object.assign,oM={};function ql(t,e,r){this.props=t,this.context=e,this.refs=oM,this.updater=r||iM}ql.prototype.isReactComponent={};ql.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ql.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function sM(){}sM.prototype=ql.prototype;function $x(t,e,r){this.props=t,this.context=e,this.refs=oM,this.updater=r||iM}var Lx=$x.prototype=new sM;Lx.constructor=$x;aM(Lx,ql.prototype);Lx.isPureReactComponent=!0;var rM=Array.isArray,lM=Object.prototype.hasOwnProperty,zx={current:null},cM={key:!0,ref:!0,__self:!0,__source:!0};function uM(t,e,r){var n,i={},a=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(a=""+e.key),e)lM.call(e,n)&&!cM.hasOwnProperty(n)&&(i[n]=e[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)i[n]===void 0&&(i[n]=s[n]);return{$$typeof:Gd,type:t,key:a,ref:o,props:i,_owner:zx.current}}function y7(t,e){return{$$typeof:Gd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Fx(t){return typeof t=="object"&&t!==null&&t.$$typeof===Gd}function b7(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var nM=/\/+/g;function Mx(t,e){return typeof t=="object"&&t!==null&&t.key!=null?b7(""+t.key):e.toString(36)}function og(t,e,r,n,i){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Gd:case o7:o=!0}}if(o)return o=t,i=i(o),t=n===""?"."+Mx(o,0):n,rM(i)?(r="",t!=null&&(r=t.replace(nM,"$&/")+"/"),og(i,e,r,"",function(c){return c})):i!=null&&(Fx(i)&&(i=y7(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(nM,"$&/")+"/")+t)),e.push(i)),1;if(o=0,n=n===""?".":n+":",rM(t))for(var s=0;s<t.length;s++){a=t[s];var l=n+Mx(a,s);o+=og(a,e,r,l,i)}else if(l=g7(t),typeof l=="function")for(t=l.call(t),s=0;!(a=t.next()).done;)a=a.value,l=n+Mx(a,s++),o+=og(a,e,r,l,i);else if(a==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ag(t,e,r){if(t==null)return t;var n=[],i=0;return og(t,n,"","",function(a){return e.call(r,a,i++)}),n}function v7(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Dr={current:null},sg={transition:null},_7={ReactCurrentDispatcher:Dr,ReactCurrentBatchConfig:sg,ReactCurrentOwner:zx};function dM(){throw Error("act(...) is not supported in production builds of React.")}Me.Children={map:ag,forEach:function(t,e,r){ag(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return ag(t,function(){e++}),e},toArray:function(t){return ag(t,function(e){return e})||[]},only:function(t){if(!Fx(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Me.Component=ql;Me.Fragment=s7;Me.Profiler=c7;Me.PureComponent=$x;Me.StrictMode=l7;Me.Suspense=m7;Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_7;Me.act=dM;Me.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=aM({},t.props),i=t.key,a=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,o=zx.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(l in e)lM.call(e,l)&&!cM.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];n.children=s}return{$$typeof:Gd,type:t.type,key:i,ref:a,props:n,_owner:o}};Me.createContext=function(t){return t={$$typeof:d7,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:u7,_context:t},t.Consumer=t};Me.createElement=uM;Me.createFactory=function(t){var e=uM.bind(null,t);return e.type=t,e};Me.createRef=function(){return{current:null}};Me.forwardRef=function(t){return{$$typeof:p7,render:t}};Me.isValidElement=Fx;Me.lazy=function(t){return{$$typeof:f7,_payload:{_status:-1,_result:t},_init:v7}};Me.memo=function(t,e){return{$$typeof:h7,type:t,compare:e===void 0?null:e}};Me.startTransition=function(t){var e=sg.transition;sg.transition={};try{t()}finally{sg.transition=e}};Me.unstable_act=dM;Me.useCallback=function(t,e){return Dr.current.useCallback(t,e)};Me.useContext=function(t){return Dr.current.useContext(t)};Me.useDebugValue=function(){};Me.useDeferredValue=function(t){return Dr.current.useDeferredValue(t)};Me.useEffect=function(t,e){return Dr.current.useEffect(t,e)};Me.useId=function(){return Dr.current.useId()};Me.useImperativeHandle=function(t,e,r){return Dr.current.useImperativeHandle(t,e,r)};Me.useInsertionEffect=function(t,e){return Dr.current.useInsertionEffect(t,e)};Me.useLayoutEffect=function(t,e){return Dr.current.useLayoutEffect(t,e)};Me.useMemo=function(t,e){return Dr.current.useMemo(t,e)};Me.useReducer=function(t,e,r){return Dr.current.useReducer(t,e,r)};Me.useRef=function(t){return Dr.current.useRef(t)};Me.useState=function(t){return Dr.current.useState(t)};Me.useSyncExternalStore=function(t,e,r){return Dr.current.useSyncExternalStore(t,e,r)};Me.useTransition=function(){return Dr.current.useTransition()};Me.version="18.3.1"});var hM=P((lke,mM)=>{"use strict";mM.exports=pM()});var Yt=[];for(Qd=0;Qd<256;++Qd)Yt.push((Qd+256).toString(16).slice(1));var Qd;function Zx(t,e=0){return(Yt[t[e+0]]+Yt[t[e+1]]+Yt[t[e+2]]+Yt[t[e+3]]+"-"+Yt[t[e+4]]+Yt[t[e+5]]+"-"+Yt[t[e+6]]+Yt[t[e+7]]+"-"+Yt[t[e+8]]+Yt[t[e+9]]+"-"+Yt[t[e+10]]+Yt[t[e+11]]+Yt[t[e+12]]+Yt[t[e+13]]+Yt[t[e+14]]+Yt[t[e+15]]).toLowerCase()}var ep,RM=new Uint8Array(16);function mg(){if(!ep&&(ep=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ep))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ep(RM)}var NM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hg={randomUUID:NM};function OM(t,e,r){if(hg.randomUUID&&!e&&!t)return hg.randomUUID();t=t||{};var n=t.random||(t.rng||mg)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Zx(n)}var _t=OM;function fg(t){let e=(t||"").split(`
|
|
15
|
+
deps: ${r}}`};var LW={keyword:"dependencies",type:"object",schemaType:"object",error:fi.error,code(t){let[e,r]=zW(t);ON(t,e),DN(t,r)}};function zW({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function ON(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let a=r.let("missing");for(let o in e){let s=e[o];if(s.length===0)continue;let l=(0,ed.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of s)(0,ed.checkReportMissingProp)(t,c)}):(r.if((0,Yw._)`${l} && (${(0,ed.checkMissingProp)(t,s,a)})`),(0,ed.reportMissingProp)(t,a),r.else())}}fi.validatePropertyDeps=ON;function DN(t,e=t.schema){let{gen:r,data:n,keyword:i,it:a}=t,o=r.name("valid");for(let s in e)(0,$W.alwaysValidSchema)(a,e[s])||(r.if((0,ed.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:s},o);t.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),t.ok(o))}fi.validateSchemaDeps=DN;fi.default=LW});var LN=P(Qw=>{"use strict";Object.defineProperty(Qw,"__esModule",{value:!0});var $N=Ee(),FW=We(),BW={message:"property name must be valid",params:({params:t})=>(0,$N._)`{propertyName: ${t.propertyName}}`},jW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:BW,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,FW.alwaysValidSchema)(i,r))return;let a=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),e.if((0,$N.not)(a),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(a)}};Qw.default=jW});var tk=P(ek=>{"use strict";Object.defineProperty(ek,"__esModule",{value:!0});var Bh=En(),Wn=Ee(),UW=Wi(),jh=We(),GW={message:"must NOT have additional properties",params:({params:t})=>(0,Wn._)`{additionalProperty: ${t.additionalProperty}}`},VW={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:GW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,jh.alwaysValidSchema)(o,r))return;let c=(0,Bh.allSchemaProperties)(n.properties),u=(0,Bh.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Wn._)`${a} === ${UW.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?h(y):e.if(m(y),()=>h(y))})}function m(y){let g;if(c.length>8){let x=(0,jh.schemaRefOrVal)(o,n.properties,"properties");g=(0,Bh.isOwnProperty)(e,x,y)}else c.length?g=(0,Wn.or)(...c.map(x=>(0,Wn._)`${y} === ${x}`)):g=Wn.nil;return u.length&&(g=(0,Wn.or)(g,...u.map(x=>(0,Wn._)`${(0,Bh.usePattern)(t,x)}.test(${y})`))),(0,Wn.not)(g)}function p(y){e.code((0,Wn._)`delete ${i}[${y}]`)}function h(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,jh.alwaysValidSchema)(o,r)){let g=e.name("valid");l.removeAdditional==="failing"?(f(y,g,!1),e.if((0,Wn.not)(g),()=>{t.reset(),p(y)})):(f(y,g),s||e.if((0,Wn.not)(g),()=>e.break()))}}function f(y,g,x){let v={keyword:"additionalProperties",dataProp:y,dataPropType:jh.Type.Str};x===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};ek.default=VW});var BN=P(nk=>{"use strict";Object.defineProperty(nk,"__esModule",{value:!0});var HW=Uu(),zN=En(),rk=We(),FN=tk(),qW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:a}=t;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&FN.default.code(new HW.KeywordCxt(a,FN.default,"additionalProperties"));let o=(0,zN.allSchemaProperties)(r);for(let d of o)a.definedProperties.add(d);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=rk.mergeEvaluated.props(e,(0,rk.toHash)(o),a.props));let s=o.filter(d=>!(0,rk.alwaysValidSchema)(a,r[d]));if(s.length===0)return;let l=e.name("valid");for(let d of s)c(d)?u(d):(e.if((0,zN.propertyInData)(e,i,d,a.opts.ownProperties)),u(d),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return a.opts.useDefaults&&!a.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};nk.default=qW});var VN=P(ik=>{"use strict";Object.defineProperty(ik,"__esModule",{value:!0});var jN=En(),Uh=Ee(),UN=We(),GN=We(),WW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:a}=t,{opts:o}=a,s=(0,jN.allSchemaProperties)(r),l=s.filter(f=>(0,UN.alwaysValidSchema)(a,r[f]));if(s.length===0||l.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");a.props!==!0&&!(a.props instanceof Uh.Name)&&(a.props=(0,GN.evaluatedPropsToName)(e,a.props));let{props:d}=a;m();function m(){for(let f of s)c&&p(f),a.allErrors?h(f):(e.var(u,!0),h(f),e.if(u))}function p(f){for(let y in c)new RegExp(f).test(y)&&(0,UN.checkStrictMode)(a,`property ${y} matches pattern ${f} (use allowMatchingProperties)`)}function h(f){e.forIn("key",n,y=>{e.if((0,Uh._)`${(0,jN.usePattern)(t,f)}.test(${y})`,()=>{let g=l.includes(f);g||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:y,dataPropType:GN.Type.Str},u),a.opts.unevaluated&&d!==!0?e.assign((0,Uh._)`${d}[${y}]`,!0):!g&&!a.allErrors&&e.if((0,Uh.not)(u),()=>e.break())})})}}};ik.default=WW});var HN=P(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});var ZW=We(),KW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,ZW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ak.default=KW});var qN=P(ok=>{"use strict";Object.defineProperty(ok,"__esModule",{value:!0});var JW=En(),XW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:JW.validateUnion,error:{message:"must match a schema in anyOf"}};ok.default=XW});var WN=P(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});var Gh=Ee(),YW=We(),QW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Gh._)`{passingSchemas: ${t.passing}}`},e5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:QW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=e.let("valid",!1),s=e.let("passing",null),l=e.name("_valid");t.setParams({passing:s}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){a.forEach((u,d)=>{let m;(0,YW.alwaysValidSchema)(i,u)?e.var(l,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Gh._)`${l} && ${o}`).assign(o,!1).assign(s,(0,Gh._)`[${s}, ${d}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(s,d),m&&t.mergeEvaluated(m,Gh.Name)})})}}};sk.default=e5});var ZN=P(lk=>{"use strict";Object.defineProperty(lk,"__esModule",{value:!0});var t5=We(),r5={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((a,o)=>{if((0,t5.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(s)})}};lk.default=r5});var XN=P(ck=>{"use strict";Object.defineProperty(ck,"__esModule",{value:!0});var Vh=Ee(),JN=We(),n5={message:({params:t})=>(0,Vh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Vh._)`{failingKeyword: ${t.ifClause}}`},i5={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:n5,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,JN.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=KN(n,"then"),a=KN(n,"else");if(!i&&!a)return;let o=e.let("valid",!0),s=e.name("_valid");if(l(),t.reset(),i&&a){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(s,c("then",u),c("else",u))}else i?e.if(s,c("then")):e.if((0,Vh.not)(s),c("else"));t.pass(o,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(u)}function c(u,d){return()=>{let m=t.subschema({keyword:u},s);e.assign(o,s),t.mergeValidEvaluated(m,o),d?e.assign(d,(0,Vh._)`${u}`):t.setParams({ifClause:u})}}}};function KN(t,e){let r=t.schema[e];return r!==void 0&&!(0,JN.alwaysValidSchema)(t,r)}ck.default=i5});var YN=P(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});var a5=We(),o5={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,a5.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};uk.default=o5});var QN=P(dk=>{"use strict";Object.defineProperty(dk,"__esModule",{value:!0});var s5=Ww(),l5=AN(),c5=Zw(),u5=RN(),d5=NN(),p5=MN(),m5=LN(),h5=tk(),f5=BN(),g5=VN(),y5=HN(),b5=qN(),v5=WN(),_5=ZN(),S5=XN(),w5=YN();function k5(t=!1){let e=[y5.default,b5.default,v5.default,_5.default,S5.default,w5.default,m5.default,h5.default,p5.default,f5.default,g5.default];return t?e.push(l5.default,u5.default):e.push(s5.default,c5.default),e.push(d5.default),e}dk.default=k5});var eO=P(pk=>{"use strict";Object.defineProperty(pk,"__esModule",{value:!0});var Ot=Ee(),x5={message:({schemaCode:t})=>(0,Ot.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ot._)`{format: ${t}}`},E5={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:x5,code(t,e){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;i?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),f=r.const("fDef",(0,Ot._)`${h}[${o}]`),y=r.let("fType"),g=r.let("format");r.if((0,Ot._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(y,(0,Ot._)`${f}.type || "string"`).assign(g,(0,Ot._)`${f}.validate`),()=>r.assign(y,(0,Ot._)`"string"`).assign(g,f)),t.fail$data((0,Ot.or)(x(),v()));function x(){return l.strictSchema===!1?Ot.nil:(0,Ot._)`${o} && !${g}`}function v(){let I=u.$async?(0,Ot._)`(${f}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Ot._)`${g}(${n})`,T=(0,Ot._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,Ot._)`${g} && ${g} !== true && ${y} === ${e} && !${T}`}}function p(){let h=d.formats[a];if(!h){x();return}if(h===!0)return;let[f,y,g]=v(h);f===e&&t.pass(I());function x(){if(l.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function v(T){let C=T instanceof RegExp?(0,Ot.regexpCode)(T):l.code.formats?(0,Ot._)`${l.code.formats}${(0,Ot.getProperty)(a)}`:void 0,M=r.scopeValue("formats",{key:a,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Ot._)`${M}.validate`]:["string",T,M]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ot._)`await ${g}(${n})`}return typeof y=="function"?(0,Ot._)`${g}(${n})`:(0,Ot._)`${g}.test(${n})`}}}};pk.default=E5});var tO=P(mk=>{"use strict";Object.defineProperty(mk,"__esModule",{value:!0});var T5=eO(),C5=[T5.default];mk.default=C5});var rO=P(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.contentVocabulary=wl.metadataVocabulary=void 0;wl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var iO=P(hk=>{"use strict";Object.defineProperty(hk,"__esModule",{value:!0});var I5=dN(),A5=EN(),P5=QN(),R5=tO(),nO=rO(),N5=[I5.default,A5.default,(0,P5.default)(),R5.default,nO.metadataVocabulary,nO.contentVocabulary];hk.default=N5});var aO=P(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.DiscrError=void 0;var O5;(function(t){t.Tag="tag",t.Mapping="mapping"})(O5=td.DiscrError||(td.DiscrError={}))});var sO=P(gk=>{"use strict";Object.defineProperty(gk,"__esModule",{value:!0});var kl=Ee(),fk=aO(),oO=Ah(),D5=We(),M5={message:({params:{discrError:t,tagName:e}})=>t===fk.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,kl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},$5={keyword:"discriminator",type:"object",schemaType:"object",error:M5,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:a}=t,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,kl._)`${r}${(0,kl.getProperty)(s)}`);e.if((0,kl._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:fk.DiscrError.Tag,tag:c,tagName:s})),t.ok(l);function u(){let p=m();e.if(!1);for(let h in p)e.elseIf((0,kl._)`${c} === ${h}`),e.assign(l,d(p[h]));e.else(),t.error(!1,{discrError:fk.DiscrError.Mapping,tag:c,tagName:s}),e.endIf()}function d(p){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(f,kl.Name),h}function m(){var p;let h={},f=g(i),y=!0;for(let I=0;I<o.length;I++){let T=o[I];T?.$ref&&!(0,D5.schemaHasRulesButRef)(T,a.self.RULES)&&(T=oO.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,T?.$ref),T instanceof oO.SchemaEnv&&(T=T.schema));let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(f||g(T)),x(C,I)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function g({required:I}){return Array.isArray(I)&&I.includes(s)}function x(I,T){if(I.const)v(I.const,T);else if(I.enum)for(let C of I.enum)v(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(I,T){if(typeof I!="string"||I in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[I]=T}}}};gk.default=$5});var lO=P((Pde,L5)=>{L5.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 dO=P((Ct,uO)=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.MissingRefError=Ct.ValidationError=Ct.CodeGen=Ct.Name=Ct.nil=Ct.stringify=Ct.str=Ct._=Ct.KeywordCxt=void 0;var z5=aN(),F5=iO(),B5=sO(),cO=lO(),j5=["/properties"],Hh="http://json-schema.org/draft-07/schema",qh=class extends z5.default{_addVocabularies(){super._addVocabularies(),F5.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(B5.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(cO,j5):cO;this.addMetaSchema(e,Hh,!1),this.refs["http://json-schema.org/schema"]=Hh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Hh)?Hh:void 0)}};uO.exports=Ct=qh;Object.defineProperty(Ct,"__esModule",{value:!0});Ct.default=qh;var U5=Uu();Object.defineProperty(Ct,"KeywordCxt",{enumerable:!0,get:function(){return U5.KeywordCxt}});var xl=Ee();Object.defineProperty(Ct,"_",{enumerable:!0,get:function(){return xl._}});Object.defineProperty(Ct,"str",{enumerable:!0,get:function(){return xl.str}});Object.defineProperty(Ct,"stringify",{enumerable:!0,get:function(){return xl.stringify}});Object.defineProperty(Ct,"nil",{enumerable:!0,get:function(){return xl.nil}});Object.defineProperty(Ct,"Name",{enumerable:!0,get:function(){return xl.Name}});Object.defineProperty(Ct,"CodeGen",{enumerable:!0,get:function(){return xl.CodeGen}});var G5=Th();Object.defineProperty(Ct,"ValidationError",{enumerable:!0,get:function(){return G5.default}});var V5=Ch();Object.defineProperty(Ct,"MissingRefError",{enumerable:!0,get:function(){return V5.default}})});var pO=P(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.formatLimitDefinition=void 0;var H5=dO(),Zn=Ee(),Ma=Zn.operators,Wh={formatMaximum:{okStr:"<=",ok:Ma.LTE,fail:Ma.GT},formatMinimum:{okStr:">=",ok:Ma.GTE,fail:Ma.LT},formatExclusiveMaximum:{okStr:"<",ok:Ma.LT,fail:Ma.GTE},formatExclusiveMinimum:{okStr:">",ok:Ma.GT,fail:Ma.LTE}},q5={message:({keyword:t,schemaCode:e})=>(0,Zn.str)`should be ${Wh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Zn._)`{comparison: ${Wh[t].okStr}, limit: ${e}}`};El.formatLimitDefinition={keyword:Object.keys(Wh),type:"string",schemaType:"string",$data:!0,error:q5,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:a}=t,{opts:o,self:s}=a;if(!o.validateFormats)return;let l=new H5.KeywordCxt(a,s.RULES.all.format.definition,"format");l.$data?c():u();function c(){let m=e.scopeValue("formats",{ref:s.formats,code:o.code.formats}),p=e.const("fmt",(0,Zn._)`${m}[${l.schemaCode}]`);t.fail$data((0,Zn.or)((0,Zn._)`typeof ${p} != "object"`,(0,Zn._)`${p} instanceof RegExp`,(0,Zn._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=l.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${m}" does not define "compare" function`);let h=e.scopeValue("formats",{key:m,ref:p,code:o.code.formats?(0,Zn._)`${o.code.formats}${(0,Zn.getProperty)(m)}`:void 0});t.fail$data(d(h))}function d(m){return(0,Zn._)`${m}.compare(${r}, ${n}) ${Wh[i].fail} 0`}},dependencies:["format"]};var W5=t=>(t.addKeyword(El.formatLimitDefinition),t);El.default=W5});var gO=P((rd,fO)=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var Tl=JP(),Z5=pO(),yk=Ee(),mO=new yk.Name("fullFormats"),K5=new yk.Name("fastFormats"),bk=(t,e={keywords:!0})=>{if(Array.isArray(e))return hO(t,e,Tl.fullFormats,mO),t;let[r,n]=e.mode==="fast"?[Tl.fastFormats,K5]:[Tl.fullFormats,mO],i=e.formats||Tl.formatNames;return hO(t,i,r,n),e.keywords&&(0,Z5.default)(t),t};bk.get=(t,e="full")=>{let n=(e==="fast"?Tl.fastFormats:Tl.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function hO(t,e,r,n){var i,a;(i=(a=t.opts.code).formats)!==null&&i!==void 0||(a.formats=(0,yk._)`require("ajv-formats/dist/formats").${n}`);for(let o of e)t.addFormat(o,r[o])}fO.exports=rd=bk;Object.defineProperty(rd,"__esModule",{value:!0});rd.default=bk});var VD=P((RSe,GD)=>{"use strict";var Wf=Object.prototype.hasOwnProperty,UD=Object.prototype.toString,$D=Object.defineProperty,LD=Object.getOwnPropertyDescriptor,zD=function(e){return typeof Array.isArray=="function"?Array.isArray(e):UD.call(e)==="[object Array]"},FD=function(e){if(!e||UD.call(e)!=="[object Object]")return!1;var r=Wf.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Wf.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||Wf.call(e,i)},BD=function(e,r){$D&&r.name==="__proto__"?$D(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},jD=function(e,r){if(r==="__proto__")if(Wf.call(e,r)){if(LD)return LD(e,r).value}else return;return e[r]};GD.exports=function t(){var e,r,n,i,a,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(r in e)n=jD(s,r),i=jD(e,r),s!==i&&(u&&i&&(FD(i)||(a=zD(i)))?(a?(a=!1,o=n&&zD(n)?n:[]):o=n&&FD(n)?n:{},BD(s,{name:r,newValue:t(u,o,i)})):typeof i<"u"&&BD(s,{name:r,newValue:i}));return s}});var mM=P(Me=>{"use strict";var qd=Symbol.for("react.element"),s7=Symbol.for("react.portal"),l7=Symbol.for("react.fragment"),c7=Symbol.for("react.strict_mode"),u7=Symbol.for("react.profiler"),d7=Symbol.for("react.provider"),p7=Symbol.for("react.context"),m7=Symbol.for("react.forward_ref"),h7=Symbol.for("react.suspense"),f7=Symbol.for("react.memo"),g7=Symbol.for("react.lazy"),rM=Symbol.iterator;function y7(t){return t===null||typeof t!="object"?null:(t=rM&&t[rM]||t["@@iterator"],typeof t=="function"?t:null)}var aM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oM=Object.assign,sM={};function Wl(t,e,r){this.props=t,this.context=e,this.refs=sM,this.updater=r||aM}Wl.prototype.isReactComponent={};Wl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Wl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lM(){}lM.prototype=Wl.prototype;function qx(t,e,r){this.props=t,this.context=e,this.refs=sM,this.updater=r||aM}var Wx=qx.prototype=new lM;Wx.constructor=qx;oM(Wx,Wl.prototype);Wx.isPureReactComponent=!0;var nM=Array.isArray,cM=Object.prototype.hasOwnProperty,Zx={current:null},uM={key:!0,ref:!0,__self:!0,__source:!0};function dM(t,e,r){var n,i={},a=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(a=""+e.key),e)cM.call(e,n)&&!uM.hasOwnProperty(n)&&(i[n]=e[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)i[n]===void 0&&(i[n]=s[n]);return{$$typeof:qd,type:t,key:a,ref:o,props:i,_owner:Zx.current}}function b7(t,e){return{$$typeof:qd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Kx(t){return typeof t=="object"&&t!==null&&t.$$typeof===qd}function v7(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var iM=/\/+/g;function Hx(t,e){return typeof t=="object"&&t!==null&&t.key!=null?v7(""+t.key):e.toString(36)}function lg(t,e,r,n,i){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case qd:case s7:o=!0}}if(o)return o=t,i=i(o),t=n===""?"."+Hx(o,0):n,nM(i)?(r="",t!=null&&(r=t.replace(iM,"$&/")+"/"),lg(i,e,r,"",function(c){return c})):i!=null&&(Kx(i)&&(i=b7(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(iM,"$&/")+"/")+t)),e.push(i)),1;if(o=0,n=n===""?".":n+":",nM(t))for(var s=0;s<t.length;s++){a=t[s];var l=n+Hx(a,s);o+=lg(a,e,r,l,i)}else if(l=y7(t),typeof l=="function")for(t=l.call(t),s=0;!(a=t.next()).done;)a=a.value,l=n+Hx(a,s++),o+=lg(a,e,r,l,i);else if(a==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function sg(t,e,r){if(t==null)return t;var n=[],i=0;return lg(t,n,"","",function(a){return e.call(r,a,i++)}),n}function _7(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Dr={current:null},cg={transition:null},S7={ReactCurrentDispatcher:Dr,ReactCurrentBatchConfig:cg,ReactCurrentOwner:Zx};function pM(){throw Error("act(...) is not supported in production builds of React.")}Me.Children={map:sg,forEach:function(t,e,r){sg(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return sg(t,function(){e++}),e},toArray:function(t){return sg(t,function(e){return e})||[]},only:function(t){if(!Kx(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Me.Component=Wl;Me.Fragment=l7;Me.Profiler=u7;Me.PureComponent=qx;Me.StrictMode=c7;Me.Suspense=h7;Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=S7;Me.act=pM;Me.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=oM({},t.props),i=t.key,a=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(a=e.ref,o=Zx.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(l in e)cM.call(e,l)&&!uM.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];n.children=s}return{$$typeof:qd,type:t.type,key:i,ref:a,props:n,_owner:o}};Me.createContext=function(t){return t={$$typeof:p7,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:d7,_context:t},t.Consumer=t};Me.createElement=dM;Me.createFactory=function(t){var e=dM.bind(null,t);return e.type=t,e};Me.createRef=function(){return{current:null}};Me.forwardRef=function(t){return{$$typeof:m7,render:t}};Me.isValidElement=Kx;Me.lazy=function(t){return{$$typeof:g7,_payload:{_status:-1,_result:t},_init:_7}};Me.memo=function(t,e){return{$$typeof:f7,type:t,compare:e===void 0?null:e}};Me.startTransition=function(t){var e=cg.transition;cg.transition={};try{t()}finally{cg.transition=e}};Me.unstable_act=pM;Me.useCallback=function(t,e){return Dr.current.useCallback(t,e)};Me.useContext=function(t){return Dr.current.useContext(t)};Me.useDebugValue=function(){};Me.useDeferredValue=function(t){return Dr.current.useDeferredValue(t)};Me.useEffect=function(t,e){return Dr.current.useEffect(t,e)};Me.useId=function(){return Dr.current.useId()};Me.useImperativeHandle=function(t,e,r){return Dr.current.useImperativeHandle(t,e,r)};Me.useInsertionEffect=function(t,e){return Dr.current.useInsertionEffect(t,e)};Me.useLayoutEffect=function(t,e){return Dr.current.useLayoutEffect(t,e)};Me.useMemo=function(t,e){return Dr.current.useMemo(t,e)};Me.useReducer=function(t,e,r){return Dr.current.useReducer(t,e,r)};Me.useRef=function(t){return Dr.current.useRef(t)};Me.useState=function(t){return Dr.current.useState(t)};Me.useSyncExternalStore=function(t,e,r){return Dr.current.useSyncExternalStore(t,e,r)};Me.useTransition=function(){return Dr.current.useTransition()};Me.version="18.3.1"});var fM=P((cke,hM)=>{"use strict";hM.exports=mM()});var Yt=[];for(tp=0;tp<256;++tp)Yt.push((tp+256).toString(16).slice(1));var tp;function iE(t,e=0){return(Yt[t[e+0]]+Yt[t[e+1]]+Yt[t[e+2]]+Yt[t[e+3]]+"-"+Yt[t[e+4]]+Yt[t[e+5]]+"-"+Yt[t[e+6]]+Yt[t[e+7]]+"-"+Yt[t[e+8]]+Yt[t[e+9]]+"-"+Yt[t[e+10]]+Yt[t[e+11]]+Yt[t[e+12]]+Yt[t[e+13]]+Yt[t[e+14]]+Yt[t[e+15]]).toLowerCase()}var rp,NM=new Uint8Array(16);function fg(){if(!rp&&(rp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rp))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rp(NM)}var OM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gg={randomUUID:OM};function DM(t,e,r){if(gg.randomUUID&&!e&&!t)return gg.randomUUID();t=t||{};var n=t.random||(t.rng||fg)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return iE(n)}var _t=DM;function yg(t){let e=(t||"").split(`
|
|
16
16
|
`);for(;e.length>0&&e[0].trim()=="";)e.shift();for(;e.length>0&&e[e.length-1].trim()=="";)e.pop();let r=1/0;for(let n of e){let i=n.match(/^\s*/)?.[0].length||0;r=Math.min(r,i)}return r>0&&r<1/0&&(e=e.map(n=>n.substring(r))),e.join(`
|
|
17
|
-
`)}var
|
|
17
|
+
`)}var MM={};function ia(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:MM}function ht(){return ia().intelliweave=ia().intelliweave||ia().webWeaver||{},ia().intelliweave}async function*aE(t){let e="",r=function*(){for(;;){let a=e.indexOf(`
|
|
18
18
|
|
|
19
19
|
`);if(a==-1)break;let o=e.slice(0,a);e=e.slice(a+2);let s={},l=o.split(`
|
|
20
20
|
`);for(let c of l){a=c.indexOf(": ");let u=c.slice(0,a),d=c.slice(a+2);a==-1&&(u=c,d=""),u&&(s[u]!==void 0?s[u]+=`
|
|
21
21
|
`+d:s[u]=d)}yield s}},n=new TextDecoder,i=t.getReader();for(;;){let{done:a,value:o}=await i.read();if(a)break;e+=n.decode(o,{stream:!0}),yield*r()}e+=n.decode()+`
|
|
22
22
|
|
|
23
|
-
`,yield*r()}function
|
|
23
|
+
`,yield*r()}function oE(){if(ht().userID)return ht().userID||"";if(typeof localStorage<"u"){let t=localStorage.getItem("intelliweave.uid")||"";return t||(t=_t(),localStorage.setItem("intelliweave.uid",t),t)}else return _t()}function sE(t){let e=t;if(e?.type=="object"&&e.properties)return t;let r={type:"object",properties:{},required:[]};if(t&&Array.isArray(t)){let n=t;for(let i of n)r.properties[i.name]={type:i.type||"string",description:i.description||""}}return r}var np=class np{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return np.debug?!0:typeof window<"u"&&ht().debug}log(...e){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...e)}debug(...e){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...e)}info(...e){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...e)}warn(...e){console.warn(`[IntelliWeave > ${this.module}]`,...e)}error(...e){console.error(`[IntelliWeave > ${this.module}]`,...e)}timer(e,...r){let n=Date.now();return this.debug(`[${e} 0ms] Started`,...r),(...i)=>this.debug(`[${e} ${Math.floor(Date.now()-n)}ms]`,...i)}};np.debug=!1;var Re=np;var lE=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~",[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],"\0","","","","","","","\x07","\b"," ",`
|
|
24
24
|
`,"\v","\f","\r","","","","","","","","","","","","","","\x1B","","","",""," ","\x7F",[128],[129],[130],[131],[132],[133],[134],[135],[136],[137],[138],[139],[140],[141],[142],[143],[144],[145],[146],[147],[148],[149],[150],[151],[152],[153],[154],[155],[156],[157],[158],[159],[160],[173]," "," ","in"," t"," ","er"," ","on"," a","re","at","st","en","or"," th",`
|
|
25
25
|
|
|
26
26
|
`," c","le"," s","it","an","ar","al"," the",`;
|
|
@@ -3250,7 +3250,7 @@ import{b as P,c as Xd,d as Yd,e as ct}from"./chunk-AIYMQX7V.js";var Yc=P(Ve=>{"u
|
|
|
3250
3250
|
|
|
3251
3251
|
|
|
3252
3252
|
|
|
3253
|
-
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],
|
|
3253
|
+
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],cE=["IClient","ISODE","Issuer",`)}\r
|
|
3254
3254
|
`,",but"," Uph","(Sub"," t\xE9l\xE9phone"," onDataChange"," marshaller","-analytics",",content"," debacle","_ValueChanged"," fauna"," #=>"," foyer","'utilisation"," M\xFCller"," Fetish"," defaultManager"," backtrack","Bah","Explicit","_ASCII"," mActivity","(Msg"," \uAC8C"," TERMS"," Angie","HSV"," Mosque",".Names","\uD2BC","reste","_parms"," gaping"," cropping","DataFrame"," responsiveness","_undo","_tran",".terminate"," italiane"," walkthrough"," attractiveness","\u0434\u0435","_STS","_learn"," chocolates","ierarchical","-thinking"," )))","ishments",".Logf"," TMZ"," Canary","foil"," Vaccine",".vx"," Surround","Intermediate"," iov","vais",`';";
|
|
3255
3255
|
`,`\uFF5E
|
|
3256
3256
|
|
|
@@ -3260,37 +3260,37 @@ import{b as P,c as Xd,d as Yd,e as ct}from"./chunk-AIYMQX7V.js";var Yc=P(Ve=>{"u
|
|
|
3260
3260
|
`," spac"," rookies","(describing","ngen",[224,174,191,224,174],".rdf",".Mutex"," kneeling"," QE","setMax","ReadStream"," ventas","sut","cmpeq",".WriteAllText"," Experienced","$__"," kaum"," LIS"," documentos","_HEALTH","icontains"," artisans","OWNER"," blinked","getDisplay"," toen"," rowNum"," avril"," invis"," Kear","toBeInTheDocument","apur"," racked"," McMaster","_ATTRIB","Haz"," factura","/ts"," \u0440\u0430\u0437\u043C\u0435\u0440"," zf"," shortfall",".fasta"," CONSTANT",".managed","gems","SharedPointer"," blurry","brightness","(components",` ..."
|
|
3261
3261
|
|
|
3262
3262
|
`,"SELL"," Illustrator",".getChannel"," trouv\xE9","ysters"," vois"," Linden"," emojis"," brawl"," MSR"," Elo"," Croatian","PopupMenu","Lewis",".JWT"," astonished","Bush","(itemId"," detachment"," Encore","\u5C14"," rekl"," cram",")$/",".getHost","_recommend","-HT","_calibration","Authenticate",".firebaseapp","UNIX"," Camera"," HEAP","Ideal",".office"," goofy","(Symbol"," jouer","_partitions"," rapidement"," GNUNET","idUser"," supervise","(Contact","AWN","\u3058"," naam"," aust","\u5728\u7EBF","_softmax","AllowAnonymous","ammable","ROUTE","*D"," aden"," Cristina"," Cristiano"," bloodstream","subclass","_persona","CHILD","-know"," navigationOptions"," Zukunft"," Pixar","Tyler"," underworld"," sincerity"," dispenser"," kter","idders",".addNode","-checked"," keyst"," WTO",".signals"," adventurer"," Pang","\\R","=pos"," dispensaries"," Closet",'("{\\"',"ideon"," n\xE9cessaire",`()"
|
|
3263
|
-
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],MM=Yx.concat(Qx);Yx.length=0;Qx.length=0;var eE=MM;var ts="all";var tE=t=>t<=127;function gg(t){if(t.length===0)return!1;let e=t.charCodeAt(t.length-1);return e>=55296&&e<=56319}function $M(t){let e=0;for(;e<t.length;){let r=t[e],n=0,i=0;if(r<=127)n=1,i=r;else if((r&224)===192){if(n=2,i=r&31,r<=193)return!1}else if((r&240)===224)n=3,i=r&15;else if((r&248)===240){if(n=4,i=r&7,r>244)return!1}else return!1;if(e+n>t.length)return!1;for(let a=1;a<n;a++){let o=t[e+a];if(o===void 0||(o&192)!==128)return!1;i=i<<6|o&63}if(n===2&&i<128||n===3&&i<2048||n===4&&i<65536||i>=55296&&i<=57343||i>1114111)return!1;e+=n}return!0}var LM=new TextDecoder("utf8",{fatal:!1});function rE(t){if($M(t))return LM.decode(t)}function nE(t,e){let r=Math.min(t.length,e.length);for(let n=0;n<r;n++)if(t[n]!==e[n])return t[n]-e[n];return t.length-e.length}function iE(t){let e=0;return t.forEach(r=>{e=Math.max(e,r)}),e}function yg(t){return t.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function bg(t){let r=[...t].map(yg).join("|");return new RegExp(`(${r})`)}var rp=new Uint8Array(0),rs=new TextDecoder("utf8"),np=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:r,tokenSplitRegex:n,mergeCacheSize:i=1e5}){ct(this,"mergeableBytePairRankCount");ct(this,"bytePairRankDecoder");ct(this,"bytePairNonUtfRankDecoder",new Map);ct(this,"bytePairNonUtfSortedEncoder");ct(this,"bytePairStringRankEncoder");ct(this,"tokenSplitRegex");ct(this,"specialTokensEncoder");ct(this,"specialTokensDecoder");ct(this,"specialTokenPatternRegex");ct(this,"textEncoder",new TextEncoder);ct(this,"mergeCache");ct(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=i,i>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let a=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>nE(l[0],c[0])),this.specialTokensEncoder=r??new Map,this.specialTokensDecoder=r?new Map([...r].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=n;let s=[...this.specialTokensEncoder.keys()].map(yg).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i=1,yield[u];continue}let d=this.bytePairEncode(c);i=d.length,yield d}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],n=o+c.length,i=1}else break}return i}encodeNative(e,r){let n=0,i=[];for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i.push(u);continue}let d=this.bytePairEncode(c);i.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i.push(u),n=o+c.length}else break}return i}countNative(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){i++;continue}let d=this.bytePairEncode(c);i+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i++,n=o+c.length}else break}return i}*decodeNativeGenerator(e){for(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}decodeNative(e){let r="",n=rp;for(let i of e){let a=this.tryDecodeToken(i);if(a===void 0)throw new Error(`Token ${i} is not in the byte pair encoder.`);if(typeof a=="string")n!==rp&&(r+=rs.decode(n,{stream:!0}),n=rp),r+=a;else{let o=new Uint8Array(n.length+a.length);o.set(n),o.set(a,n.length),n=o}}return n!==rp&&(r+=rs.decode(n,{stream:!0})),r}async*decodeNativeAsyncIterable(e){for await(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let r=this.getBpeRankFromString(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return r}getBpeRankFromBytes(e){let r=rE(e);if(r!==void 0)return this.getBpeRankFromString(r);let n=this.binarySearch(e);if(n!==-1)return this.bytePairNonUtfSortedEncoder[n][1]}getBpeRankFromBytesOrThrow(e){let r=this.getBpeRankFromBytes(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return r}binarySearch(e){let r=0,n=this.bytePairNonUtfSortedEncoder.length-1;for(;r<=n;){let i=r+n>>>1,a=this.bytePairNonUtfSortedEncoder[i][0],o=0,s=Math.min(a.length,e.length);for(let l=0;l<s&&(o=a[l]-e[l],o===0);l++);if(o===0&&(o=a.length-e.length),o===0)return i;o<0?r=i+1:n=i-1}return-1}findNextSpecialToken(e,r,n){let i=n;for(;;){this.specialTokenPatternRegex.lastIndex=i;let a=this.specialTokenPatternRegex.exec(e);if(!a)return;let o=a[0];if(r?.has(o))return[a.index+i,o];i=a.index+i+1}}tryDecodeToken(e){let r=this.bytePairRankDecoder[e];if(typeof r=="string")return r;if(typeof r=="object"){let n=this.bytePairNonUtfRankDecoder.get(e);if(n)return n}return this.specialTokensDecoder.get(e)}addToMergeCache(e,r){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let n=this.mergeCache.keys().next().value;this.mergeCache.delete(n)}this.mergeCache.set(e,r)}}bytePairEncode(e){if(e.length===1&&tE(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let i=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,i),i}let r=this.textEncoder.encode(e),n=this.bytePairMerge(r);return this.addToMergeCache(e,n),n}bytePairMerge(e){let r=[],n=[],i=(o,s=r[o],l=r[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)r.push(o),o<e.length-1?n.push(i(o,o,o+2)):n.push(Number.POSITIVE_INFINITY);for(;r.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<n.length-1;l++){let c=n[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;r.splice(s+1,1),n.splice(s,1),n[s]=i(s),s>0&&(n[s-1]=i(s-1))}let a=[];for(let o=0;o<r.length-1;o++){let s=r[o],l=r[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));a.push(c)}return a}};var aE={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},FM={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},BM={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},oE={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},sE={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},lE={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},cE={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},jM={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},UM={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},GM={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},VM={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},HM={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},qM={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},WM={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},uE={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},ZM={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},KM={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},JM={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},dE={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},XM={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},YM={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},QM={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},pE={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},e$={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},mE={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},t$={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},hE={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},vg={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},r$={...vg,humanName:"GPT-4 1106 Preview"},fE={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},gE={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},n$={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},i$={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},a$={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},o$={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},s$={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},_g={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},vE={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},l$=vE,c$={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},u$={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},d$={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},p$={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},m$={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},h$={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},f$={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},g$={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},y$={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},b$={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},v$={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},_$={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},S$={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},yE={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},w$={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},k$={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},bE={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},x$={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},E$={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},T$={..._g,humanName:"GPT-4 32k 0314"},C$={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},I$={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},A$={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},P$={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},R$={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},N$={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},O$={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},D$={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},M$={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},$$={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},L$={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},z$={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},F$={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},B$={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},j$={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},U$={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},G$={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Sg={o1:sE,"o1-2024-12-17":sE,"o1-preview":lE,"o1-preview-2024-09-12":lE,"o1-mini":cE,"o1-mini-2024-09-12":cE,"o3-mini":jM,"chatgpt-4o-latest":t$,"gpt-4o":aE,"gpt-4o-2024-11-20":FM,"gpt-4o-2024-08-06":aE,"gpt-4o-2024-05-13":BM,"gpt-4o-mini":oE,"gpt-4o-mini-2024-07-18":oE,"gpt-4o-realtime-preview":HM,"gpt-4o-realtime-preview-2024-10-01":qM,"gpt-4o-realtime-preview-2024-12-17":WM,"gpt-4o-mini-realtime-preview":uE,"gpt-4o-mini-realtime-preview-2024-12-17":uE,"gpt-4o-audio-preview":ZM,"gpt-4o-audio-preview-2024-10-01":KM,"gpt-4o-audio-preview-2024-12-17":JM,"gpt-4o-mini-audio-preview":dE,"gpt-4o-mini-audio-preview-2024-12-17":dE,"gpt-4o-2024-08-06-finetune":XM,"gpt-4o-mini-2024-07-18-finetune":YM,"gpt-4o-mini-training":pE,"gpt-4o-mini-training-2024-07-18":pE,"davinci-002-finetune":a$,"babbage-002-finetune":s$,"gpt-4-turbo":mE,"gpt-4-turbo-2024-04-09":mE,"gpt-4-turbo-preview":vg,"gpt-4-0125-preview":vg,"gpt-4-1106-preview":r$,"gpt-4":hE,"gpt-4-0613":hE,"gpt-3.5-turbo":fE,"gpt-3.5-turbo-0125":fE,"gpt-3.5-turbo-1106":n$,"gpt-3.5-turbo-finetune":QM,"gpt-3.5-turbo-16k":e$,"gpt-4-32k":_g,"gpt-4-32k-0613":_g,"gpt-4-vision-preview":vE,"gpt-4-1106-vision-preview":l$,"gpt-4-0314":x$,"gpt-4-32k-0314":T$,"gpt-3.5-turbo-0613":c$,"gpt-3.5-turbo-16k-0613":u$,"gpt-3.5-turbo-0301":E$},ip={...Sg,"text-embedding-3-small":UM,"text-embedding-3-large":GM,"text-embedding-ada-002":VM,"gpt-3.5-turbo-instruct":gE,"gpt-3.5-turbo-instruct-0914":gE,"davinci-002":i$,"babbage-002":o$,"text-ada-001":d$,"text-babbage-001":p$,"text-curie-001":m$,"text-davinci-001":h$,"text-davinci-002":f$,"text-davinci-003":g$,ada:y$,babbage:b$,curie:v$,davinci:_$,"code-davinci-002":S$,"code-davinci-001":yE,"davinci-codex":yE,"code-davinci-edit-001":w$,"code-cushman-002":k$,"code-cushman-001":bE,"cushman-codex":bE,"code-search-ada-code-001":P$,"code-search-ada-text-001":R$,"text-davinci-edit-001":N$,"text-similarity-ada-001":C$,"text-search-ada-doc-001":I$,"text-search-ada-query-001":A$,"text-similarity-babbage-001":O$,"text-search-babbage-doc-001":D$,"text-search-babbage-query-001":M$,"code-search-babbage-code-001":$$,"code-search-babbage-text-001":L$,"text-similarity-curie-001":z$,"text-search-curie-doc-001":F$,"text-search-curie-query-001":B$,"text-similarity-davinci-001":j$,"text-search-davinci-doc-001":U$,"text-search-davinci-query-001":G$};var hn="<|endoftext|>",aa="<|fim_prefix|>",oa="<|fim_middle|>",sa="<|fim_suffix|>",ns="<|im_start|>",is="<|im_end|>",la="<|im_sep|>",as="<|endofprompt|>";var _E=Object.fromEntries(Object.entries(Sg).map(([t,e])=>[t,e.encoding])),SE=Object.fromEntries(Object.entries(ip).map(([t,e])=>[t,e.encoding])),V$={messageSeparator:`
|
|
3263
|
+
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],$M=lE.concat(cE);lE.length=0;cE.length=0;var uE=$M;var ts="all";var dE=t=>t<=127;function bg(t){if(t.length===0)return!1;let e=t.charCodeAt(t.length-1);return e>=55296&&e<=56319}function LM(t){let e=0;for(;e<t.length;){let r=t[e],n=0,i=0;if(r<=127)n=1,i=r;else if((r&224)===192){if(n=2,i=r&31,r<=193)return!1}else if((r&240)===224)n=3,i=r&15;else if((r&248)===240){if(n=4,i=r&7,r>244)return!1}else return!1;if(e+n>t.length)return!1;for(let a=1;a<n;a++){let o=t[e+a];if(o===void 0||(o&192)!==128)return!1;i=i<<6|o&63}if(n===2&&i<128||n===3&&i<2048||n===4&&i<65536||i>=55296&&i<=57343||i>1114111)return!1;e+=n}return!0}var zM=new TextDecoder("utf8",{fatal:!1});function pE(t){if(LM(t))return zM.decode(t)}function mE(t,e){let r=Math.min(t.length,e.length);for(let n=0;n<r;n++)if(t[n]!==e[n])return t[n]-e[n];return t.length-e.length}function hE(t){let e=0;return t.forEach(r=>{e=Math.max(e,r)}),e}function vg(t){return t.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function _g(t){let r=[...t].map(vg).join("|");return new RegExp(`(${r})`)}var ip=new Uint8Array(0),rs=new TextDecoder("utf8"),ap=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:r,tokenSplitRegex:n,mergeCacheSize:i=1e5}){ct(this,"mergeableBytePairRankCount");ct(this,"bytePairRankDecoder");ct(this,"bytePairNonUtfRankDecoder",new Map);ct(this,"bytePairNonUtfSortedEncoder");ct(this,"bytePairStringRankEncoder");ct(this,"tokenSplitRegex");ct(this,"specialTokensEncoder");ct(this,"specialTokensDecoder");ct(this,"specialTokenPatternRegex");ct(this,"textEncoder",new TextEncoder);ct(this,"mergeCache");ct(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=i,i>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let a=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>mE(l[0],c[0])),this.specialTokensEncoder=r??new Map,this.specialTokensDecoder=r?new Map([...r].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=n;let s=[...this.specialTokensEncoder.keys()].map(vg).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i=1,yield[u];continue}let d=this.bytePairEncode(c);i=d.length,yield d}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],n=o+c.length,i=1}else break}return i}encodeNative(e,r){let n=0,i=[];for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){i.push(u);continue}let d=this.bytePairEncode(c);i.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i.push(u),n=o+c.length}else break}return i}countNative(e,r){let n=0,i=0;for(;;){let a=this.findNextSpecialToken(e,r,n),o=a?.[0],s=o??e.length,l=n===0&&s===e.length?e:e.slice(n,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){i++;continue}let d=this.bytePairEncode(c);i+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);i++,n=o+c.length}else break}return i}*decodeNativeGenerator(e){for(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}decodeNative(e){let r="",n=ip;for(let i of e){let a=this.tryDecodeToken(i);if(a===void 0)throw new Error(`Token ${i} is not in the byte pair encoder.`);if(typeof a=="string")n!==ip&&(r+=rs.decode(n,{stream:!0}),n=ip),r+=a;else{let o=new Uint8Array(n.length+a.length);o.set(n),o.set(a,n.length),n=o}}return n!==ip&&(r+=rs.decode(n,{stream:!0})),r}async*decodeNativeAsyncIterable(e){for await(let r of e){let n=this.tryDecodeToken(r);n&&(yield n)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let r=this.getBpeRankFromString(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return r}getBpeRankFromBytes(e){let r=pE(e);if(r!==void 0)return this.getBpeRankFromString(r);let n=this.binarySearch(e);if(n!==-1)return this.bytePairNonUtfSortedEncoder[n][1]}getBpeRankFromBytesOrThrow(e){let r=this.getBpeRankFromBytes(e);if(r===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return r}binarySearch(e){let r=0,n=this.bytePairNonUtfSortedEncoder.length-1;for(;r<=n;){let i=r+n>>>1,a=this.bytePairNonUtfSortedEncoder[i][0],o=0,s=Math.min(a.length,e.length);for(let l=0;l<s&&(o=a[l]-e[l],o===0);l++);if(o===0&&(o=a.length-e.length),o===0)return i;o<0?r=i+1:n=i-1}return-1}findNextSpecialToken(e,r,n){let i=n;for(;;){this.specialTokenPatternRegex.lastIndex=i;let a=this.specialTokenPatternRegex.exec(e);if(!a)return;let o=a[0];if(r?.has(o))return[a.index+i,o];i=a.index+i+1}}tryDecodeToken(e){let r=this.bytePairRankDecoder[e];if(typeof r=="string")return r;if(typeof r=="object"){let n=this.bytePairNonUtfRankDecoder.get(e);if(n)return n}return this.specialTokensDecoder.get(e)}addToMergeCache(e,r){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let n=this.mergeCache.keys().next().value;this.mergeCache.delete(n)}this.mergeCache.set(e,r)}}bytePairEncode(e){if(e.length===1&&dE(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let i=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,i),i}let r=this.textEncoder.encode(e),n=this.bytePairMerge(r);return this.addToMergeCache(e,n),n}bytePairMerge(e){let r=[],n=[],i=(o,s=r[o],l=r[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)r.push(o),o<e.length-1?n.push(i(o,o,o+2)):n.push(Number.POSITIVE_INFINITY);for(;r.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<n.length-1;l++){let c=n[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;r.splice(s+1,1),n.splice(s,1),n[s]=i(s),s>0&&(n[s-1]=i(s-1))}let a=[];for(let o=0;o<r.length-1;o++){let s=r[o],l=r[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));a.push(c)}return a}};var fE={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},BM={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},jM={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},gE={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},yE={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},bE={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},vE={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},UM={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},GM={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},VM={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},HM={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},qM={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},WM={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},ZM={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},_E={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},KM={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},JM={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},XM={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},SE={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},YM={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},QM={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},e$={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},wE={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},t$={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},kE={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},r$={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},xE={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Sg={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},n$={...Sg,humanName:"GPT-4 1106 Preview"},EE={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},TE={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},i$={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},a$={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},o$={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},s$={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},l$={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},wg={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},AE={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},c$=AE,u$={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},d$={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},p$={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},m$={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},h$={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},f$={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},g$={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},y$={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},b$={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},v$={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},_$={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},S$={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},w$={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},CE={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},k$={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},x$={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},IE={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},E$={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},T$={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},C$={...wg,humanName:"GPT-4 32k 0314"},I$={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},A$={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},P$={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},R$={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},N$={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},O$={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},D$={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},M$={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},$$={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},L$={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},z$={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},F$={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},B$={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},j$={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},U$={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},G$={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},V$={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},kg={o1:yE,"o1-2024-12-17":yE,"o1-preview":bE,"o1-preview-2024-09-12":bE,"o1-mini":vE,"o1-mini-2024-09-12":vE,"o3-mini":UM,"chatgpt-4o-latest":r$,"gpt-4o":fE,"gpt-4o-2024-11-20":BM,"gpt-4o-2024-08-06":fE,"gpt-4o-2024-05-13":jM,"gpt-4o-mini":gE,"gpt-4o-mini-2024-07-18":gE,"gpt-4o-realtime-preview":qM,"gpt-4o-realtime-preview-2024-10-01":WM,"gpt-4o-realtime-preview-2024-12-17":ZM,"gpt-4o-mini-realtime-preview":_E,"gpt-4o-mini-realtime-preview-2024-12-17":_E,"gpt-4o-audio-preview":KM,"gpt-4o-audio-preview-2024-10-01":JM,"gpt-4o-audio-preview-2024-12-17":XM,"gpt-4o-mini-audio-preview":SE,"gpt-4o-mini-audio-preview-2024-12-17":SE,"gpt-4o-2024-08-06-finetune":YM,"gpt-4o-mini-2024-07-18-finetune":QM,"gpt-4o-mini-training":wE,"gpt-4o-mini-training-2024-07-18":wE,"davinci-002-finetune":o$,"babbage-002-finetune":l$,"gpt-4-turbo":kE,"gpt-4-turbo-2024-04-09":kE,"gpt-4-turbo-preview":Sg,"gpt-4-0125-preview":Sg,"gpt-4-1106-preview":n$,"gpt-4":xE,"gpt-4-0613":xE,"gpt-3.5-turbo":EE,"gpt-3.5-turbo-0125":EE,"gpt-3.5-turbo-1106":i$,"gpt-3.5-turbo-finetune":e$,"gpt-3.5-turbo-16k":t$,"gpt-4-32k":wg,"gpt-4-32k-0613":wg,"gpt-4-vision-preview":AE,"gpt-4-1106-vision-preview":c$,"gpt-4-0314":E$,"gpt-4-32k-0314":C$,"gpt-3.5-turbo-0613":u$,"gpt-3.5-turbo-16k-0613":d$,"gpt-3.5-turbo-0301":T$},op={...kg,"text-embedding-3-small":GM,"text-embedding-3-large":VM,"text-embedding-ada-002":HM,"gpt-3.5-turbo-instruct":TE,"gpt-3.5-turbo-instruct-0914":TE,"davinci-002":a$,"babbage-002":s$,"text-ada-001":p$,"text-babbage-001":m$,"text-curie-001":h$,"text-davinci-001":f$,"text-davinci-002":g$,"text-davinci-003":y$,ada:b$,babbage:v$,curie:_$,davinci:S$,"code-davinci-002":w$,"code-davinci-001":CE,"davinci-codex":CE,"code-davinci-edit-001":k$,"code-cushman-002":x$,"code-cushman-001":IE,"cushman-codex":IE,"code-search-ada-code-001":R$,"code-search-ada-text-001":N$,"text-davinci-edit-001":O$,"text-similarity-ada-001":I$,"text-search-ada-doc-001":A$,"text-search-ada-query-001":P$,"text-similarity-babbage-001":D$,"text-search-babbage-doc-001":M$,"text-search-babbage-query-001":$$,"code-search-babbage-code-001":L$,"code-search-babbage-text-001":z$,"text-similarity-curie-001":F$,"text-search-curie-doc-001":B$,"text-search-curie-query-001":j$,"text-similarity-davinci-001":U$,"text-search-davinci-doc-001":G$,"text-search-davinci-query-001":V$};var hn="<|endoftext|>",aa="<|fim_prefix|>",oa="<|fim_middle|>",sa="<|fim_suffix|>",ns="<|im_start|>",is="<|im_end|>",la="<|im_sep|>",as="<|endofprompt|>";var PE=Object.fromEntries(Object.entries(kg).map(([t,e])=>[t,e.encoding])),RE=Object.fromEntries(Object.entries(op).map(([t,e])=>[t,e.encoding])),H$={messageSeparator:`
|
|
3264
3264
|
`,roleSeparator:`
|
|
3265
|
-
`},
|
|
3266
|
-
`;this.itemPadding=0;this.sortFunction=(e,r)=>e.sortOrder!==r.sortOrder?e.sortOrder-r.sortOrder:e.dateAdded!==r.dateAdded?e.dateAdded-r.dateAdded:e.content.localeCompare(r.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,r)=>(r.tokenCount=Za(r.content)+Za(this.separator)+this.itemPadding,e+r.tokenCount),0)}add(e){typeof e=="string"&&(e={content:e});let r=e;r.id===void 0&&(r.id=_t());let n=this.items.find(i=>i.id===r.id);return n?(this.tokenCount-=n.tokenCount,Object.assign(n,r),r=n):this.items.push(r),r.dateAdded===void 0&&(r.dateAdded=Date.now()),r.sortOrder===void 0&&(r.sortOrder=0),r.disabled===void 0&&(r.disabled=!1),r.tokenCount=r.disabled?0:Za(e.content)+Za(this.separator)+this.itemPadding,this.tokenCount+=r.tokenCount,this.items.sort(this.sortFunction),r}getAllAsString(){return this.getAll().map(e=>e.content).join(this.separator)}getAll(){return this.items.filter(e=>!e.disabled)}empty(){this.items=[],this.tokenCount=0}};var ss=class{constructor(e){this.id="";this.metadata={};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let e=new
|
|
3265
|
+
`},q$={messageSeparator:"",roleSeparator:la},NE=Object.fromEntries(Object.keys(PE).flatMap(t=>t.startsWith("gpt-4")?[[t,q$]]:t.startsWith("gpt-3.5-turbo")?[[t,H$]]:[])),rJ=Object.keys(PE);var os=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,sp=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function OE(t){return{tokenSplitRegex:sp,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,100257],[aa,100258],[oa,100259],[sa,100260],[ns,100264],[is,100265],[la,100266],[as,100276]])}}function DE(t){return{tokenSplitRegex:sp,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,199999],[aa,2e5],[oa,200001],[sa,200002],[ns,200003],[is,200004],[la,200005],[as,200006]])}}function ME(t){return{expectedVocabularySize:50281,tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256]])}}function $E(t){return{tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256],[aa,50281],[oa,50282],[sa,50283]])}}function LE(t){return{expectedVocabularySize:50257,tokenSplitRegex:os,bytePairRankDecoder:t,specialTokensEncoder:new Map([[hn,50256]])}}function xg(t,e){let r=e(t);switch(t.toLowerCase()){case"r50k_base":return LE(r);case"p50k_base":return ME(r);case"p50k_edit":return $E(r);case"cl100k_base":return OE(r);case"o200k_base":return DE(r);default:throw new Error(`Unknown encoding name: ${t}`)}}var Ei=class Ei{constructor({bytePairRankDecoder:e,specialTokensEncoder:r,expectedVocabularySize:n,modelName:i,...a}){ct(this,"modelName");ct(this,"bytePairEncodingCoreProcessor");ct(this,"specialTokensEncoder");ct(this,"specialTokensSet");ct(this,"allSpecialTokenRegex");ct(this,"defaultSpecialTokenConfig");ct(this,"vocabularySize");this.specialTokensEncoder=r,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=_g(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new ap({bytePairRankDecoder:e,specialTokensEncoder:r,...a}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(e.length-1,hE(r));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+r.size,n!==void 0){if(this.vocabularySize!==n)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==n-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${n-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=i}static getEncodingApi(e,r){let n=xg(e,r);return new Ei(n)}static getEncodingApiForModel(e,r){let n=RE[e],i=xg(n,r);return new Ei({...i,modelName:e})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:r}={}){let n;if(e===ts||e?.has(ts)){e=new Set(this.specialTokensSet);let i=e;if(r===ts)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof r=="object"?r.forEach(a=>i.delete(a)):r=new Set}if(!r||r===ts||r.has(ts)){r=new Set(this.specialTokensSet);let i=r;e?.size?(e.forEach(a=>i.delete(a)),r.forEach(a=>e.delete(a)),r.size>0&&(n=_g(r))):n=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:n}}encodeGenerator(e,r){let n=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(n.regexPattern){let i=e.match(n.regexPattern);if(i!==null)throw new Error(`Disallowed special token found: ${i[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,n.allowedSpecial)}encode(e,r){let n=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(n.regexPattern){let i=e.match(n.regexPattern);if(i!==null)throw new Error(`Disallowed special token found: ${i[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,n.allowedSpecial)}*encodeChatGenerator(e,r=this.modelName){if(!r)throw new Error("Model name must be provided either during initialization or passed in to the method.");let n=NE[r],i=this.specialTokensEncoder.get(ns),a=this.specialTokensEncoder.get(is);if(!n||i===void 0||a===void 0)throw new Error(`Model '${r}' does not support chat.`);let o=new Set([la]),{messageSeparator:s,roleSeparator:l}=n,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],d=new Map;for(let{role:m="system",name:p=m,content:h}of e){if(h===void 0)throw new Error("Content must be defined for all messages.");yield[i];let f=d.get(p)??this.encode(p);d.set(p,f),yield f,u.length>0&&(yield u),yield*this.encodeGenerator(h),yield[a],yield c}yield[i],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(e,r=this.modelName){return[...this.encodeChatGenerator(e,r)].flat()}isWithinTokenLimit(e,r){let n=typeof e=="string"?this.encodeGenerator(e):this.encodeChatGenerator(e),i=0;for(let a of n)if(i+=a.length,i>r)return!1;return i}countTokens(e,r){if(typeof e=="string"){let a=r?this.processSpecialTokens(r):this.defaultSpecialTokenConfig;if(a.regexPattern){let o=e.match(a.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,a.allowedSpecial)}let n=this.encodeChatGenerator(e),i=0;for(let a of n)i+=a.length;return i}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),n="";for(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0}),!(n.length===0||bg(n))&&(yield n,n="");n.length>0&&(yield n)}async*decodeAsyncGenerator(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n="";for await(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0}),!(n.length===0||bg(n))&&(yield n,n="");n.length>0&&(yield n)}async decodeAsync(e){let r=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n="";for await(let i of r)n+=typeof i=="string"?i:rs.decode(i,{stream:!0});return n}estimateCost(e,r=this.modelName){if(!r)throw new Error("Model name must be provided either during initialization or passed in to the method.");let n=op[r];if(!n)throw new Error(`Unknown model: ${r}`);if(!n.cost)throw new Error(`No cost information available for model: ${r}`);let i=n.cost,a={},o=e/1e6;return i.input!==void 0&&(a.input=i.input*o),i.output!==void 0&&(a.output=i.output*o),i.batchInput!==void 0&&(a.batchInput=i.batchInput*o),i.batchOutput!==void 0&&(a.batchOutput=i.batchOutput*o),a}};ct(Ei,"EndOfPrompt",as),ct(Ei,"EndOfText",hn),ct(Ei,"FimMiddle",oa),ct(Ei,"FimPrefix",aa),ct(Ei,"FimSuffix",sa);var lp=Ei;var W$=lp.getEncodingApi("cl100k_base",()=>uE),{decode:jJ,decodeAsyncGenerator:UJ,decodeGenerator:GJ,encode:VJ,encodeGenerator:HJ,isWithinTokenLimit:qJ,countTokens:Za,encodeChat:WJ,encodeChatGenerator:ZJ,vocabularySize:KJ,setMergeCacheSize:JJ,clearMergeCache:XJ,estimateCost:YJ}=W$;var cp=class{constructor(){this.size=4096;this.groups=[]}createGroup(e){let r=new Eg;return r.id=e,this.groups.push(r),r}group(e){return this.groups.find(r=>r.id===e)}countTokens(){return this.groups.reduce((e,r)=>e+r.tokenCount,0)}removeOverflow(){let e=this.countTokens(),r=this.groups.reduce((n,i)=>n+i.weight,0);for(;e>this.size;){let n=this.groups.slice().sort((a,o)=>{let s=Math.floor(a.weight/r*this.size),l=Math.floor(o.weight/r*this.size),c=a.tokenCount-s;return o.tokenCount-l-c}),i=this.removeOneItem(n);if(!i)throw new Error("Too many items in the token window that cannot be removed.");e-=i.tokenCount}}removeOneItem(e){for(let r of e){let n=r.items.findIndex(a=>!a.cannotRemove);if(n===-1)continue;let i=r.items[n];return r.items.splice(n,1),r.tokenCount-=i.tokenCount,i}return null}},Eg=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
|
|
3266
|
+
`;this.itemPadding=0;this.sortFunction=(e,r)=>e.sortOrder!==r.sortOrder?e.sortOrder-r.sortOrder:e.dateAdded!==r.dateAdded?e.dateAdded-r.dateAdded:e.content.localeCompare(r.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,r)=>(r.tokenCount=Za(r.content)+Za(this.separator)+this.itemPadding,e+r.tokenCount),0)}add(e){typeof e=="string"&&(e={content:e});let r=e;r.id===void 0&&(r.id=_t());let n=this.items.find(i=>i.id===r.id);return n?(this.tokenCount-=n.tokenCount,Object.assign(n,r),r=n):this.items.push(r),r.dateAdded===void 0&&(r.dateAdded=Date.now()),r.sortOrder===void 0&&(r.sortOrder=0),r.disabled===void 0&&(r.disabled=!1),r.tokenCount=r.disabled?0:Za(e.content)+Za(this.separator)+this.itemPadding,this.tokenCount+=r.tokenCount,this.items.sort(this.sortFunction),r}getAllAsString(){return this.getAll().map(e=>e.content).join(this.separator)}getAll(){return this.items.filter(e=>!e.disabled)}empty(){this.items=[],this.tokenCount=0}};var ss=class{constructor(e){this.id="";this.metadata={};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let e=new cp;return e.createGroup("context").setSeparator(`
|
|
3267
3267
|
|
|
3268
|
-
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config=e,this.tokenWindow.size=this.config.maxTokens||16e3}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){throw new Error("Not implemented")}addUserMessage(e){throw new Error("Not implemented")}addAssistantMessage(e){throw new Error("Not implemented")}onBeforeIncomingMessage(e){}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}async trimMessages(){this.tokenWindow.removeOverflow()}registerTool(e){return this.toolGroup.add({id:e.name,customData:e,cannotRemove:e.isContext,sortOrder:101,disabled:e.disabled,content:JSON.stringify(e)})}};var Ti=new Re("ChatGPT"),lp=class extends ss{async sendMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r}),await this.processMessages();let i=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return i?.role=="assistant"&&i.content||""}addAssistantMessage(e){let r={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}addUserMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ti.debugEnabled&&Ti.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(n=>n.customData),messages:this.messageGroup.items.map(n=>n.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(r?.role=="user"||r?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(r?.role=="assistant"&&r?.tool_calls?.length){for(let n of r.tool_calls)await this.processToolCall(n);await this.processMessages()}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendRequest(e){let r={};return r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(e)})}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let r=0;for(let s=this.messageGroup.items.length-1;s>=0;s--){let l=this.messageGroup.items[s].customData;if(l.role=="assistant"&&l.tool_calls){if(r+=1,r>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(l.role=="user")break}Ti.debugEnabled&&Ti.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(s=>s.customData),messages:this.messageGroup.items.map(s=>s.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let n={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(s=>s.customData)]};for(let s of this.toolGroup.getAll()){let l=s.customData;l.description&&l.description.length>1024&&Ti.warn(`Tool description for "${l.name}" is too long, it will be truncated.`);let c={type:"function",function:{name:l.name,description:(l.description||"").substring(0,1024),parameters:l.params}};n.tools.push(c)}if(n.user||delete n.user,n.tools.length||delete n.tools,e)return n;let i=await this.sendRequest(n);if(!i.ok){let s=`${i.status} ${i.statusText}`;try{let c=await i.json();s=c.errorText||c.error?.message||c.error||s}catch{}let l=new Error(s);throw l.code=i.status,l}let a=null,o=null;if(this.config.stream){for await(let l of Kx(i.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(o){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&o[u]==c.choices[0].delta[u])continue;o[u]=(o[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(o.tool_calls||(o.tool_calls=[]),!o.tool_calls[u.index]){o.tool_calls[u.index]=u;continue}let d=o.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.function.arguments||"")+(u.function?.arguments||"")}}else o={chunkID:c.id,...c.choices[0].delta};o?.content&&!o.content.startsWith("{")&&this.config.onAIMessage?.(o.content,!0)}let s=Za(JSON.stringify(n)+JSON.stringify(o)||"");this.stats.tokensUsed+=s,Ti.debug(`Estimated ${s} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else a=await i.json(),this.stats.tokensUsed+=a?.usage?.total_tokens||0,Ti.debug(`Used ${a?.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),o=a?.choices?.[0]?.message;if(o||(Ti.warn("No response block in API response."),o={role:"assistant",content:""}),o.role=="user")throw new Error("API returned a user message, which is not allowed.");this.onBeforeIncomingMessage(o),this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o}),o.content&&this.config.onAIMessage?.(o.content,!1)}async processToolCall(e){try{let n=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!n)throw new Error(`Tool "${e.function.name}" not found.`);let i=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,i);let a=await n.callback(i);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o})}catch(r){Ti.warn(`Unable to process tool call for "${e?.function?.name}"`,r);let n={role:"tool",content:`Error: ${r.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(n),customData:n})}}};function ce(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function D(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var xg=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return xg=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Ci(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var tc=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var se=class extends Error{},qt=class t extends se{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("request-id"),this.error=r}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new ca({message:n,cause:tc(r)});let a=r;return e===400?new cs(e,a,n,i):e===401?new us(e,a,n,i):e===403?new ds(e,a,n,i):e===404?new ps(e,a,n,i):e===409?new ms(e,a,n,i):e===422?new hs(e,a,n,i):e===429?new fs(e,a,n,i):e>=500?new gs(e,a,n,i):new t(e,a,n,i)}},Qt=class extends qt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ca=class extends qt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ls=class extends ca{constructor({message:e}={}){super({message:e??"Request timed out."})}},cs=class extends qt{},us=class extends qt{},ds=class extends qt{},ps=class extends qt{},ms=class extends qt{},hs=class extends qt{},fs=class extends qt{},gs=class extends qt{};var Z$=/^[a-z][a-z0-9+.-]*:/i,IE=t=>Z$.test(t),Eg=t=>(Eg=Array.isArray,Eg(t)),Tg=Eg;function Cg(t){return typeof t!="object"?{}:t??{}}function AE(t){if(!t)return!0;for(let e in t)return!1;return!0}function PE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var RE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new se(`${t} must be an integer`);if(e<0)throw new se(`${t} must be a positive integer`);return e};var cp=t=>{try{return JSON.parse(t)}catch{return}};var NE=t=>new Promise(e=>setTimeout(e,t));var ua="0.60.0";var $E=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function K$(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var J$=()=>{let t=K$();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":DE(Deno.build.os),"X-Stainless-Arch":OE(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":DE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":OE(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=X$();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function X$(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,a=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${a}.${o}`}}}return null}var OE=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",DE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),ME,LE=()=>ME??(ME=J$());function zE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ig(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function up(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Ig({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function rc(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function FE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var BE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function GE(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var jE;function nc(t){let e;return(jE??(e=new globalThis.TextEncoder,jE=e.encode.bind(e)))(t)}var UE;function Ag(t){let e;return(UE??(e=new globalThis.TextDecoder,UE=e.decode.bind(e)))(t)}var Yr,Qr,Ii=class{constructor(){Yr.set(this,void 0),Qr.set(this,void 0),ce(this,Yr,new Uint8Array,"f"),ce(this,Qr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?nc(e):e;ce(this,Yr,GE([D(this,Yr,"f"),r]),"f");let n=[],i;for(;(i=eL(D(this,Yr,"f"),D(this,Qr,"f")))!=null;){if(i.carriage&&D(this,Qr,"f")==null){ce(this,Qr,i.index,"f");continue}if(D(this,Qr,"f")!=null&&(i.index!==D(this,Qr,"f")+1||i.carriage)){n.push(Ag(D(this,Yr,"f").subarray(0,D(this,Qr,"f")-1))),ce(this,Yr,D(this,Yr,"f").subarray(D(this,Qr,"f")),"f"),ce(this,Qr,null,"f");continue}let a=D(this,Qr,"f")!==null?i.preceding-1:i.preceding,o=Ag(D(this,Yr,"f").subarray(0,a));n.push(o),ce(this,Yr,D(this,Yr,"f").subarray(i.index),"f"),ce(this,Qr,null,"f")}return n}flush(){return D(this,Yr,"f").length?this.decode(`
|
|
3268
|
+
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config=e,this.tokenWindow.size=this.config.maxTokens||16e3}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){throw new Error("Not implemented")}addUserMessage(e){throw new Error("Not implemented")}addAssistantMessage(e){throw new Error("Not implemented")}onBeforeIncomingMessage(e){}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}async trimMessages(){this.tokenWindow.removeOverflow()}registerTool(e){return this.toolGroup.add({id:e.name,customData:e,cannotRemove:e.isContext,sortOrder:101,disabled:e.disabled,content:JSON.stringify(e)})}};var Ti=new Re("ChatGPT"),up=class extends ss{async sendMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r}),await this.processMessages();let i=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return i?.role=="assistant"&&i.content||""}addAssistantMessage(e){let r={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}addUserMessage(e){let r={role:"user",content:e};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ti.debugEnabled&&Ti.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(n=>n.customData),messages:this.messageGroup.items.map(n=>n.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(r?.role=="user"||r?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(r?.role=="assistant"&&r?.tool_calls?.length){for(let n of r.tool_calls)await this.processToolCall(n);await this.processMessages()}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendRequest(e){let r={};return r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(e)})}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let r=0;for(let s=this.messageGroup.items.length-1;s>=0;s--){let l=this.messageGroup.items[s].customData;if(l.role=="assistant"&&l.tool_calls){if(r+=1,r>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(l.role=="user")break}Ti.debugEnabled&&Ti.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(s=>s.customData),messages:this.messageGroup.items.map(s=>s.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let n={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(s=>s.customData)]};for(let s of this.toolGroup.getAll()){let l=s.customData;l.description&&l.description.length>1024&&Ti.warn(`Tool description for "${l.name}" is too long, it will be truncated.`);let c={type:"function",function:{name:l.name,description:(l.description||"").substring(0,1024),parameters:l.params}};n.tools.push(c)}if(n.user||delete n.user,n.tools.length||delete n.tools,e)return n;let i=await this.sendRequest(n);if(!i.ok){let s=`${i.status} ${i.statusText}`;try{let c=await i.json();s=c.errorText||c.error?.message||c.error||s}catch{}let l=new Error(s);throw l.code=i.status,l}let a=null,o=null;if(this.config.stream){for await(let l of aE(i.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(o){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&o[u]==c.choices[0].delta[u])continue;o[u]=(o[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(o.tool_calls||(o.tool_calls=[]),!o.tool_calls[u.index]){o.tool_calls[u.index]=u;continue}let d=o.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.function.arguments||"")+(u.function?.arguments||"")}}else o={chunkID:c.id,...c.choices[0].delta};o?.content&&!o.content.startsWith("{")&&this.config.onAIMessage?.(o.content,!0)}let s=Za(JSON.stringify(n)+JSON.stringify(o)||"");this.stats.tokensUsed+=s,Ti.debug(`Estimated ${s} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else a=await i.json(),this.stats.tokensUsed+=a?.usage?.total_tokens||0,Ti.debug(`Used ${a?.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),o=a?.choices?.[0]?.message;if(o||(Ti.warn("No response block in API response."),o={role:"assistant",content:""}),o.role=="user")throw new Error("API returned a user message, which is not allowed.");this.onBeforeIncomingMessage(o),this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o}),o.content&&this.config.onAIMessage?.(o.content,!1)}async processToolCall(e){try{let n=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!n)throw new Error(`Tool "${e.function.name}" not found.`);let i=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,i);let a=await n.callback(i);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(o),customData:o})}catch(r){Ti.warn(`Unable to process tool call for "${e?.function?.name}"`,r);let n={role:"tool",content:`Error: ${r.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(n),customData:n})}}};function ce(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function D(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var Tg=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Tg=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Ci(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var nc=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var se=class extends Error{},qt=class t extends se{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("request-id"),this.error=r}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new ca({message:n,cause:nc(r)});let a=r;return e===400?new cs(e,a,n,i):e===401?new us(e,a,n,i):e===403?new ds(e,a,n,i):e===404?new ps(e,a,n,i):e===409?new ms(e,a,n,i):e===422?new hs(e,a,n,i):e===429?new fs(e,a,n,i):e>=500?new gs(e,a,n,i):new t(e,a,n,i)}},Qt=class extends qt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ca=class extends qt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ls=class extends ca{constructor({message:e}={}){super({message:e??"Request timed out."})}},cs=class extends qt{},us=class extends qt{},ds=class extends qt{},ps=class extends qt{},ms=class extends qt{},hs=class extends qt{},fs=class extends qt{},gs=class extends qt{};var K$=/^[a-z][a-z0-9+.-]*:/i,zE=t=>K$.test(t),Cg=t=>(Cg=Array.isArray,Cg(t)),Ig=Cg;function Ag(t){return typeof t!="object"?{}:t??{}}function FE(t){if(!t)return!0;for(let e in t)return!1;return!0}function BE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var jE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new se(`${t} must be an integer`);if(e<0)throw new se(`${t} must be a positive integer`);return e};var dp=t=>{try{return JSON.parse(t)}catch{return}};var UE=t=>new Promise(e=>setTimeout(e,t));var ua="0.60.0";var qE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function J$(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var X$=()=>{let t=J$();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":VE(Deno.build.os),"X-Stainless-Arch":GE(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":VE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":GE(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Y$();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ua,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Y$(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,a=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${a}.${o}`}}}return null}var GE=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",VE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),HE,WE=()=>HE??(HE=X$());function ZE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Pg(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function pp(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Pg({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function ic(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function KE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var JE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function QE(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var XE;function ac(t){let e;return(XE??(e=new globalThis.TextEncoder,XE=e.encode.bind(e)))(t)}var YE;function Rg(t){let e;return(YE??(e=new globalThis.TextDecoder,YE=e.decode.bind(e)))(t)}var Yr,Qr,Ii=class{constructor(){Yr.set(this,void 0),Qr.set(this,void 0),ce(this,Yr,new Uint8Array,"f"),ce(this,Qr,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?ac(e):e;ce(this,Yr,QE([D(this,Yr,"f"),r]),"f");let n=[],i;for(;(i=tL(D(this,Yr,"f"),D(this,Qr,"f")))!=null;){if(i.carriage&&D(this,Qr,"f")==null){ce(this,Qr,i.index,"f");continue}if(D(this,Qr,"f")!=null&&(i.index!==D(this,Qr,"f")+1||i.carriage)){n.push(Rg(D(this,Yr,"f").subarray(0,D(this,Qr,"f")-1))),ce(this,Yr,D(this,Yr,"f").subarray(D(this,Qr,"f")),"f"),ce(this,Qr,null,"f");continue}let a=D(this,Qr,"f")!==null?i.preceding-1:i.preceding,o=Rg(D(this,Yr,"f").subarray(0,a));n.push(o),ce(this,Yr,D(this,Yr,"f").subarray(i.index),"f"),ce(this,Qr,null,"f")}return n}flush(){return D(this,Yr,"f").length?this.decode(`
|
|
3269
3269
|
`):[]}};Yr=new WeakMap,Qr=new WeakMap;Ii.NEWLINE_CHARS=new Set([`
|
|
3270
|
-
`,"\r"]);Ii.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function
|
|
3271
|
-
`);n.enqueue(o)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*
|
|
3272
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=
|
|
3270
|
+
`,"\r"]);Ii.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function tL(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function eT(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var hp={off:0,error:200,warn:300,info:400,debug:500},Ng=(t,e,r)=>{if(t){if(BE(hp,t))return t;Wt(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(hp))}`)}};function oc(){}function mp(t,e,r){return!e||hp[t]>hp[r]?oc:e[t].bind(e)}var rL={error:oc,warn:oc,info:oc,debug:oc},tT=new WeakMap;function Wt(t){let e=t.logger,r=t.logLevel??"off";if(!e)return rL;let n=tT.get(e);if(n&&n[0]===r)return n[1];let i={error:mp("error",e,r),warn:mp("warn",e,r),info:mp("info",e,r),debug:mp("debug",e,r)};return tT.set(e,[r,i]),i}var Ai=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var sc,ei=class t{constructor(e,r,n){this.iterator=e,sc.set(this,void 0),this.controller=r,ce(this,sc,n,"f")}static fromSSEResponse(e,r,n){let i=!1,a=n?Wt(n):console;async function*o(){if(i)throw new se("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let l of nL(e,r)){if(l.event==="completion")try{yield JSON.parse(l.data)}catch(c){throw a.error("Could not parse message into JSON:",l.data),a.error("From chunk:",l.raw),c}if(l.event==="message_start"||l.event==="message_delta"||l.event==="message_stop"||l.event==="content_block_start"||l.event==="content_block_delta"||l.event==="content_block_stop")try{yield JSON.parse(l.data)}catch(c){throw a.error("Could not parse message into JSON:",l.data),a.error("From chunk:",l.raw),c}if(l.event!=="ping"&&l.event==="error")throw new qt(void 0,dp(l.data)??l.data,void 0,e.headers)}s=!0}catch(l){if(Ci(l))return;throw l}finally{s||r.abort()}}return new t(o,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*a(){let s=new Ii,l=ic(e);for await(let c of l)for(let u of s.decode(c))yield u;for(let c of s.flush())yield c}async function*o(){if(i)throw new se("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let l of a())s||l&&(yield JSON.parse(l));s=!0}catch(l){if(Ci(l))return;throw l}finally{s||r.abort()}}return new t(o,r,n)}[(sc=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=a=>({next:()=>{if(a.length===0){let o=n.next();e.push(o),r.push(o)}return a.shift()}});return[new t(()=>i(e),this.controller,D(this,sc,"f")),new t(()=>i(r),this.controller,D(this,sc,"f"))]}toReadableStream(){let e=this,r;return Pg({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:a}=await r.next();if(a)return n.close();let o=ac(JSON.stringify(i)+`
|
|
3271
|
+
`);n.enqueue(o)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*nL(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new se("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new se("Attempted to iterate over a response with no body");let r=new Og,n=new Ii,i=ic(t.body);for await(let a of iL(i))for(let o of n.decode(a)){let s=r.decode(o);s&&(yield s)}for(let a of n.flush()){let o=r.decode(a);o&&(yield o)}}async function*iL(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?ac(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let a;for(;(a=eT(e))!==-1;)yield e.slice(0,a),e=e.slice(a)}e.length>0&&(yield e)}var Og=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let a={event:this.event,data:this.data.join(`
|
|
3272
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=aL(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};function aL(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function fp(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:i,startTime:a}=e,o=await(async()=>{if(e.options.stream)return Wt(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):ei.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let l=r.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){let d=await r.json();return Dg(d,r)}return await r.text()})();return Wt(t).debug(`[${n}] response parsed`,Ai({retryOfRequestLogID:i,url:r.url,status:r.status,body:o,durationMs:Date.now()-a})),o}function Dg(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var lc,Ka=class t extends Promise{constructor(e,r,n=fp){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,lc.set(this,void 0),ce(this,lc,e,"f")}_thenUnwrap(e){return new t(D(this,lc,"f"),this.responsePromise,async(r,n)=>Dg(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(D(this,lc,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};lc=new WeakMap;var gp,Mg=class{constructor(e,r,n,i){gp.set(this,void 0),ce(this,gp,e,"f"),this.options=i,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new se("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,gp,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(gp=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},cc=class extends Ka{constructor(e,r,n){super(e,r,async(i,a)=>new n(i,a.response,await fp(i,a),a.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},fn=class extends Mg{constructor(e,r,n,i){super(e,r,n,i),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...Ag(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...Ag(this.options.query),after_id:e}}:null}};var Lg=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ja(t,e,r){return Lg(),new File(t,e??"unknown_file",r)}function uc(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var zg=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function";var nT=async(t,e)=>({...t,body:await lL(t.body,e)}),rT=new WeakMap;function sL(t){let e=typeof t=="function"?t:t.fetch,r=rT.get(e);if(r)return r;let n=(async()=>{try{let i="Response"in e?e.Response:(await e("data:,")).constructor,a=new FormData;return a.toString()!==await new i(a).text()}catch{return!0}})();return rT.set(e,n),n}var lL=async(t,e)=>{if(!await sL(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,i])=>$g(r,n,i))),r},cL=t=>t instanceof Blob&&"name"in t;var $g=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let n={},i=r.headers.get("Content-Type");i&&(n={type:i}),t.append(e,Ja([await r.blob()],uc(r),n))}else if(zg(r))t.append(e,Ja([await new Response(pp(r)).blob()],uc(r)));else if(cL(r))t.append(e,Ja([r],uc(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>$g(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,i])=>$g(t,`${e}[${n}]`,i)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var iT=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",uL=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&iT(t),dL=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function yp(t,e,r){if(Lg(),t=await t,e||(e=uc(t)),uL(t))return t instanceof File&&e==null&&r==null?t:Ja([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(dL(t)){let i=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ja(await Fg(i),e,r)}let n=await Fg(t);if(!r?.type){let i=n.find(a=>typeof a=="object"&&"type"in a&&a.type);typeof i=="string"&&(r={...r,type:i})}return Ja(n,e,r)}async function Fg(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(iT(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(zg(t))for await(let r of t)e.push(...await Fg(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${pL(t)}`)}return e}function pL(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var jt=class{constructor(e){this._client=e}};var aT=Symbol.for("brand.privateNullableHeaders");function*hL(t){if(!t)return;if(aT in t){let{values:n,nulls:i}=t;yield*n.entries();for(let a of i)yield[a,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Ig(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let i=n[0];if(typeof i!="string")throw new TypeError("expected header name to be a string");let a=Ig(n[1])?n[1]:[n[1]],o=!1;for(let s of a)s!==void 0&&(e&&!o&&(o=!0,yield[i,null]),yield[i,s])}}var Ke=t=>{let e=new Headers,r=new Set;for(let n of t){let i=new Set;for(let[a,o]of hL(n)){let s=a.toLowerCase();i.has(s)||(e.delete(a),i.add(s)),o===null?(e.delete(a),r.add(s)):(e.append(a,o),r.delete(s))}}return{[aT]:!0,values:e,nulls:r}};function sT(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var oT=Object.freeze(Object.create(null)),fL=(t=sT)=>function(r,...n){if(r.length===1)return r[0];let i=!1,a=[],o=r.reduce((u,d,m)=>{/[?#]/.test(d)&&(i=!0);let p=n[m],h=(i?encodeURIComponent:t)(""+p);return m!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??oT)??oT)?.toString)&&(h=p+"",a.push({start:u.length+d.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),u+d+(m===n.length?"":h)},""),s=o.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(s))!==null;)a.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(a.sort((u,d)=>u.start-d.start),a.length>0){let u=0,d=a.reduce((m,p)=>{let h=" ".repeat(p.start-u),f="^".repeat(p.length);return u=p.start+p.length,m+h+f},"");throw new se(`Path parameters result in path with invalid segments:
|
|
3273
3273
|
${a.map(m=>m.error).join(`
|
|
3274
3274
|
`)}
|
|
3275
3275
|
${o}
|
|
3276
|
-
${d}`)}return o},ur=hL(XE);var ys=class extends jt{list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/files",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(ur`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:i}=r??{};return this._client.get(ur`/v1/files/${e}/content`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:i}=r??{};return this._client.get(ur`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...i}=e;return this._client.post("/v1/files",WE({body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}};var bs=class extends jt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(ur`/v1/models/${e}?beta=true`,{...n,headers:Ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models?beta=true",fn,{query:i,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var vs=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new Ii;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new se("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new se("Attempted to iterate over a response with no body");return new t(rc(e.body),r)}};var _s=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/batches?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(ur`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(ur`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:i}=r??{};return this._client.post(ur`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let i=await this.retrieve(e);if(!i.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:a}=r??{};return this._client.get(i.results_url,{...n,headers:Ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,s)=>vs.fromResponse(s.response,s.controller))}};var bL=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",l=!1;for(n=t[++e];n!=='"';){if(e===t.length){l=!0;break}if(n==="\\"){if(e++,e===t.length){l=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],l||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let a=/[0-9]/;if(n&&a.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&a.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let o=/[a-z]/i;if(n&&o.test(n)){let s="";for(;n&&o.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},Ss=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Ss(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),Ss(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),Ss(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),Ss(t);break;case"delimiter":return t=t.slice(0,t.length-1),Ss(t);break}return t},vL=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},_L=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},gp=t=>JSON.parse(_L(vL(Ss(bL(t)))));var gn,da,cc,yp,uc,dc,bp,pc,Pi,mc,vp,_p,ws,Sp,wp,zg,YE,kp,Fg,Bg,jg,QE,eT="__json_buf";function tT(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var xp=class t{constructor(){gn.add(this),this.messages=[],this.receivedMessages=[],da.set(this,void 0),this.controller=new AbortController,cc.set(this,void 0),yp.set(this,()=>{}),uc.set(this,()=>{}),dc.set(this,void 0),bp.set(this,()=>{}),pc.set(this,()=>{}),Pi.set(this,{}),mc.set(this,!1),vp.set(this,!1),_p.set(this,!1),ws.set(this,!1),Sp.set(this,void 0),wp.set(this,void 0),kp.set(this,e=>{if(ce(this,vp,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,_p,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,cc,new Promise((e,r)=>{ce(this,yp,e,"f"),ce(this,uc,r,"f")}),"f"),ce(this,dc,new Promise((e,r)=>{ce(this,bp,e,"f"),ce(this,pc,r,"f")}),"f"),D(this,cc,"f").catch(()=>{}),D(this,dc,"f").catch(()=>{})}get response(){return D(this,Sp,"f")}get request_id(){return D(this,wp,"f")}async withResponse(){let e=await D(this,cc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,kp,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,gn,"m",Fg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,gn,"m",Bg).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,gn,"m",jg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,Sp,e,"f"),ce(this,wp,e?.headers.get("request-id"),"f"),D(this,yp,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,mc,"f")}get errored(){return D(this,vp,"f")}get aborted(){return D(this,_p,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Pi,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ws,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ws,!0,"f"),await D(this,dc,"f")}get currentMessage(){return D(this,da,"f")}async finalMessage(){return await this.done(),D(this,gn,"m",zg).call(this)}async finalText(){return await this.done(),D(this,gn,"m",YE).call(this)}_emit(e,...r){if(D(this,mc,"f"))return;e==="end"&&(ce(this,mc,!0,"f"),D(this,bp,"f").call(this));let n=D(this,Pi,"f")[e];if(n&&(D(this,Pi,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,uc,"f").call(this,i),D(this,pc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,uc,"f").call(this,i),D(this,pc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,gn,"m",zg).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,gn,"m",Fg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,gn,"m",Bg).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,gn,"m",jg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(da=new WeakMap,cc=new WeakMap,yp=new WeakMap,uc=new WeakMap,dc=new WeakMap,bp=new WeakMap,pc=new WeakMap,Pi=new WeakMap,mc=new WeakMap,vp=new WeakMap,_p=new WeakMap,ws=new WeakMap,Sp=new WeakMap,wp=new WeakMap,kp=new WeakMap,gn=new WeakSet,zg=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},YE=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},Fg=function(){this.ended||ce(this,da,void 0,"f")},Bg=function(r){if(this.ended)return;let n=D(this,gn,"m",QE).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{tT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,da,n,"f");break}case"content_block_start":case"message_delta":break}},jg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,da,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,da,void 0,"f"),r},QE=function(r){let n=D(this,da,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&tT(i)){let a=i[eT]||"";a+=r.delta.partial_json;let o={...i};if(Object.defineProperty(o,eT,{value:a,enumerable:!1,writable:!0}),a)try{o.input=gp(a)}catch(s){let l=new se(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${a}`);D(this,kp,"f").call(this,l)}n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Ep={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var rT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},Xa=class extends jt{constructor(){super(...arguments),this.batches=new _s(this._client)}create(e,r){let{betas:n,...i}=e;i.model in rT&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${rT[i.model]}
|
|
3277
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!i.stream&&a==null){let o=Ep[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,o)}return this._client.post("/v1/messages?beta=true",{body:i,timeout:a??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return xp.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}};Xa.Batches=_s;var ti=class extends jt{constructor(){super(...arguments),this.models=new bs(this._client),this.messages=new Xa(this._client),this.files=new ys(this._client)}};ti.Models=bs;ti.Messages=Xa;ti.Files=ys;var Ya=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/complete",{body:i,timeout:this._client._options.timeout??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};var yn,pa,hc,Tp,fc,gc,Cp,yc,Ri,bc,Ip,Ap,ks,Pp,Rp,Ug,nT,Gg,Vg,Hg,qg,iT,aT="__json_buf";function oT(t){return t.type==="tool_use"||t.type==="server_tool_use"}var Np=class t{constructor(){yn.add(this),this.messages=[],this.receivedMessages=[],pa.set(this,void 0),this.controller=new AbortController,hc.set(this,void 0),Tp.set(this,()=>{}),fc.set(this,()=>{}),gc.set(this,void 0),Cp.set(this,()=>{}),yc.set(this,()=>{}),Ri.set(this,{}),bc.set(this,!1),Ip.set(this,!1),Ap.set(this,!1),ks.set(this,!1),Pp.set(this,void 0),Rp.set(this,void 0),Gg.set(this,e=>{if(ce(this,Ip,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,Ap,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,hc,new Promise((e,r)=>{ce(this,Tp,e,"f"),ce(this,fc,r,"f")}),"f"),ce(this,gc,new Promise((e,r)=>{ce(this,Cp,e,"f"),ce(this,yc,r,"f")}),"f"),D(this,hc,"f").catch(()=>{}),D(this,gc,"f").catch(()=>{})}get response(){return D(this,Pp,"f")}get request_id(){return D(this,Rp,"f")}async withResponse(){let e=await D(this,hc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,Gg,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,yn,"m",Vg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,yn,"m",Hg).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,yn,"m",qg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,Pp,e,"f"),ce(this,Rp,e?.headers.get("request-id"),"f"),D(this,Tp,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,bc,"f")}get errored(){return D(this,Ip,"f")}get aborted(){return D(this,Ap,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Ri,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ks,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ks,!0,"f"),await D(this,gc,"f")}get currentMessage(){return D(this,pa,"f")}async finalMessage(){return await this.done(),D(this,yn,"m",Ug).call(this)}async finalText(){return await this.done(),D(this,yn,"m",nT).call(this)}_emit(e,...r){if(D(this,bc,"f"))return;e==="end"&&(ce(this,bc,!0,"f"),D(this,Cp,"f").call(this));let n=D(this,Ri,"f")[e];if(n&&(D(this,Ri,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,fc,"f").call(this,i),D(this,yc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,fc,"f").call(this,i),D(this,yc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,yn,"m",Ug).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,yn,"m",Vg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,yn,"m",Hg).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,yn,"m",qg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(pa=new WeakMap,hc=new WeakMap,Tp=new WeakMap,fc=new WeakMap,gc=new WeakMap,Cp=new WeakMap,yc=new WeakMap,Ri=new WeakMap,bc=new WeakMap,Ip=new WeakMap,Ap=new WeakMap,ks=new WeakMap,Pp=new WeakMap,Rp=new WeakMap,Gg=new WeakMap,yn=new WeakSet,Ug=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},nT=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},Vg=function(){this.ended||ce(this,pa,void 0,"f")},Hg=function(r){if(this.ended)return;let n=D(this,yn,"m",iT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{oT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,pa,n,"f");break}case"content_block_start":case"message_delta":break}},qg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,pa,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,pa,void 0,"f"),r},iT=function(r){let n=D(this,pa,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push({...r.content_block}),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&oT(i)){let a=i[aT]||"";a+=r.delta.partial_json;let o={...i};Object.defineProperty(o,aT,{value:a,enumerable:!1,writable:!0}),a&&(o.input=gp(a)),n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var xs=class extends jt{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(ur`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",fn,{query:e,...r})}delete(e,r){return this._client.delete(ur`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(ur`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:Ke([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,a)=>vs.fromResponse(a.response,a.controller))}};var ma=class extends jt{constructor(){super(...arguments),this.batches=new xs(this._client)}create(e,r){e.model in sT&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${sT[e.model]}
|
|
3278
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let n=this._client._options.timeout;if(!e.stream&&n==null){let i=
|
|
3276
|
+
${d}`)}return o},dr=fL(sT);var ys=class extends jt{list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/files",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(dr`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/files/${e}/content`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/files/${e}`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...i}=e;return this._client.post("/v1/files",nT({body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}};var bs=class extends jt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/models/${e}?beta=true`,{...n,headers:Ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models?beta=true",fn,{query:i,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var vs=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new Ii;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new se("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new se("Attempted to iterate over a response with no body");return new t(ic(e.body),r)}};var _s=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/batches?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",fn,{query:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(dr`/v1/messages/batches/${e}?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:i}=r??{};return this._client.post(dr`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:Ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let i=await this.retrieve(e);if(!i.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:a}=r??{};return this._client.get(i.results_url,{...n,headers:Ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,s)=>vs.fromResponse(s.response,s.controller))}};var vL=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",l=!1;for(n=t[++e];n!=='"';){if(e===t.length){l=!0;break}if(n==="\\"){if(e++,e===t.length){l=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],l||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let a=/[0-9]/;if(n&&a.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&a.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let o=/[a-z]/i;if(n&&o.test(n)){let s="";for(;n&&o.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},Ss=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Ss(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),Ss(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),Ss(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),Ss(t);break;case"delimiter":return t=t.slice(0,t.length-1),Ss(t);break}return t},_L=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},SL=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},bp=t=>JSON.parse(SL(_L(Ss(vL(t)))));var gn,da,dc,vp,pc,mc,_p,hc,Pi,fc,Sp,wp,ws,kp,xp,Bg,lT,Ep,jg,Ug,Gg,cT,uT="__json_buf";function dT(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var Tp=class t{constructor(){gn.add(this),this.messages=[],this.receivedMessages=[],da.set(this,void 0),this.controller=new AbortController,dc.set(this,void 0),vp.set(this,()=>{}),pc.set(this,()=>{}),mc.set(this,void 0),_p.set(this,()=>{}),hc.set(this,()=>{}),Pi.set(this,{}),fc.set(this,!1),Sp.set(this,!1),wp.set(this,!1),ws.set(this,!1),kp.set(this,void 0),xp.set(this,void 0),Ep.set(this,e=>{if(ce(this,Sp,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,wp,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,dc,new Promise((e,r)=>{ce(this,vp,e,"f"),ce(this,pc,r,"f")}),"f"),ce(this,mc,new Promise((e,r)=>{ce(this,_p,e,"f"),ce(this,hc,r,"f")}),"f"),D(this,dc,"f").catch(()=>{}),D(this,mc,"f").catch(()=>{})}get response(){return D(this,kp,"f")}get request_id(){return D(this,xp,"f")}async withResponse(){let e=await D(this,dc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,Ep,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,gn,"m",jg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,gn,"m",Ug).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,gn,"m",Gg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,kp,e,"f"),ce(this,xp,e?.headers.get("request-id"),"f"),D(this,vp,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,fc,"f")}get errored(){return D(this,Sp,"f")}get aborted(){return D(this,wp,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Pi,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Pi,"f")[e]||(D(this,Pi,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ws,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ws,!0,"f"),await D(this,mc,"f")}get currentMessage(){return D(this,da,"f")}async finalMessage(){return await this.done(),D(this,gn,"m",Bg).call(this)}async finalText(){return await this.done(),D(this,gn,"m",lT).call(this)}_emit(e,...r){if(D(this,fc,"f"))return;e==="end"&&(ce(this,fc,!0,"f"),D(this,_p,"f").call(this));let n=D(this,Pi,"f")[e];if(n&&(D(this,Pi,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,pc,"f").call(this,i),D(this,hc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ws,"f")&&!n?.length&&Promise.reject(i),D(this,pc,"f").call(this,i),D(this,hc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,gn,"m",Bg).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,gn,"m",jg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,gn,"m",Ug).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,gn,"m",Gg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(da=new WeakMap,dc=new WeakMap,vp=new WeakMap,pc=new WeakMap,mc=new WeakMap,_p=new WeakMap,hc=new WeakMap,Pi=new WeakMap,fc=new WeakMap,Sp=new WeakMap,wp=new WeakMap,ws=new WeakMap,kp=new WeakMap,xp=new WeakMap,Ep=new WeakMap,gn=new WeakSet,Bg=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},lT=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},jg=function(){this.ended||ce(this,da,void 0,"f")},Ug=function(r){if(this.ended)return;let n=D(this,gn,"m",cT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{dT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,da,n,"f");break}case"content_block_start":case"message_delta":break}},Gg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,da,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,da,void 0,"f"),r},cT=function(r){let n=D(this,da,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&dT(i)){let a=i[uT]||"";a+=r.delta.partial_json;let o={...i};if(Object.defineProperty(o,uT,{value:a,enumerable:!1,writable:!0}),a)try{o.input=bp(a)}catch(s){let l=new se(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${a}`);D(this,Ep,"f").call(this,l)}n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Cp={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var pT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},Xa=class extends jt{constructor(){super(...arguments),this.batches=new _s(this._client)}create(e,r){let{betas:n,...i}=e;i.model in pT&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${pT[i.model]}
|
|
3277
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!i.stream&&a==null){let o=Cp[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,o)}return this._client.post("/v1/messages?beta=true",{body:i,timeout:a??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return Tp.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:i,...r,headers:Ke([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}};Xa.Batches=_s;var ti=class extends jt{constructor(){super(...arguments),this.models=new bs(this._client),this.messages=new Xa(this._client),this.files=new ys(this._client)}};ti.Models=bs;ti.Messages=Xa;ti.Files=ys;var Ya=class extends jt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/complete",{body:i,timeout:this._client._options.timeout??6e5,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};var yn,pa,gc,Ip,yc,bc,Ap,vc,Ri,_c,Pp,Rp,ks,Np,Op,Vg,mT,Hg,qg,Wg,Zg,hT,fT="__json_buf";function gT(t){return t.type==="tool_use"||t.type==="server_tool_use"}var Dp=class t{constructor(){yn.add(this),this.messages=[],this.receivedMessages=[],pa.set(this,void 0),this.controller=new AbortController,gc.set(this,void 0),Ip.set(this,()=>{}),yc.set(this,()=>{}),bc.set(this,void 0),Ap.set(this,()=>{}),vc.set(this,()=>{}),Ri.set(this,{}),_c.set(this,!1),Pp.set(this,!1),Rp.set(this,!1),ks.set(this,!1),Np.set(this,void 0),Op.set(this,void 0),Hg.set(this,e=>{if(ce(this,Pp,!0,"f"),Ci(e)&&(e=new Qt),e instanceof Qt)return ce(this,Rp,!0,"f"),this._emit("abort",e);if(e instanceof se)return this._emit("error",e);if(e instanceof Error){let r=new se(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new se(String(e)))}),ce(this,gc,new Promise((e,r)=>{ce(this,Ip,e,"f"),ce(this,yc,r,"f")}),"f"),ce(this,bc,new Promise((e,r)=>{ce(this,Ap,e,"f"),ce(this,vc,r,"f")}),"f"),D(this,gc,"f").catch(()=>{}),D(this,bc,"f").catch(()=>{})}get response(){return D(this,Np,"f")}get request_id(){return D(this,Op,"f")}async withResponse(){let e=await D(this,gc,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let i=new t;for(let a of r.messages)i._addMessageParam(a);return i._run(()=>i._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},D(this,Hg,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,a;i&&(i.aborted&&this.controller.abort(),a=this.controller.abort.bind(this.controller),i.addEventListener("abort",a));try{D(this,yn,"m",qg).call(this);let{response:o,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(o);for await(let l of s)D(this,yn,"m",Wg).call(this,l);if(s.controller.signal?.aborted)throw new Qt;D(this,yn,"m",Zg).call(this)}finally{i&&a&&i.removeEventListener("abort",a)}}_connected(e){this.ended||(ce(this,Np,e,"f"),ce(this,Op,e?.headers.get("request-id"),"f"),D(this,Ip,"f").call(this,e),this._emit("connect"))}get ended(){return D(this,_c,"f")}get errored(){return D(this,Pp,"f")}get aborted(){return D(this,Rp,"f")}abort(){this.controller.abort()}on(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=D(this,Ri,"f")[e];if(!n)return this;let i=n.findIndex(a=>a.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(D(this,Ri,"f")[e]||(D(this,Ri,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ce(this,ks,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ce(this,ks,!0,"f"),await D(this,bc,"f")}get currentMessage(){return D(this,pa,"f")}async finalMessage(){return await this.done(),D(this,yn,"m",Vg).call(this)}async finalText(){return await this.done(),D(this,yn,"m",mT).call(this)}_emit(e,...r){if(D(this,_c,"f"))return;e==="end"&&(ce(this,_c,!0,"f"),D(this,Ap,"f").call(this));let n=D(this,Ri,"f")[e];if(n&&(D(this,Ri,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,yc,"f").call(this,i),D(this,vc,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!D(this,ks,"f")&&!n?.length&&Promise.reject(i),D(this,yc,"f").call(this,i),D(this,vc,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",D(this,yn,"m",Vg).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{D(this,yn,"m",qg).call(this),this._connected(null);let a=ei.fromReadableStream(e,this.controller);for await(let o of a)D(this,yn,"m",Wg).call(this,o);if(a.controller.signal?.aborted)throw new Qt;D(this,yn,"m",Zg).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(pa=new WeakMap,gc=new WeakMap,Ip=new WeakMap,yc=new WeakMap,bc=new WeakMap,Ap=new WeakMap,vc=new WeakMap,Ri=new WeakMap,_c=new WeakMap,Pp=new WeakMap,Rp=new WeakMap,ks=new WeakMap,Np=new WeakMap,Op=new WeakMap,Hg=new WeakMap,yn=new WeakSet,Vg=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},mT=function(){if(this.receivedMessages.length===0)throw new se("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new se("stream ended without producing a content block with type=text");return r.join(" ")},qg=function(){this.ended||ce(this,pa,void 0,"f")},Wg=function(r){if(this.ended)return;let n=D(this,yn,"m",hT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{gT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ce(this,pa,n,"f");break}case"content_block_start":case"message_delta":break}},Zg=function(){if(this.ended)throw new se("stream has ended, this shouldn't happen");let r=D(this,pa,"f");if(!r)throw new se("request ended without sending any chunks");return ce(this,pa,void 0,"f"),r},hT=function(r){let n=D(this,pa,"f");if(r.type==="message_start"){if(n)throw new se(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new se(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push({...r.content_block}),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&gT(i)){let a=i[fT]||"";a+=r.delta.partial_json;let o={...i};Object.defineProperty(o,fT,{value:a,enumerable:!1,writable:!0}),a&&(o.input=bp(a)),n.content[r.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let a=r.shift();a?a.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let a of r)a.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((a,o)=>r.push({resolve:a,reject:o})).then(a=>a?{value:a,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ei(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var xs=class extends jt{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(dr`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",fn,{query:e,...r})}delete(e,r){return this._client.delete(dr`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(dr`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new se(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:Ke([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,a)=>vs.fromResponse(a.response,a.controller))}};var ma=class extends jt{constructor(){super(...arguments),this.batches=new xs(this._client)}create(e,r){e.model in yT&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${yT[e.model]}
|
|
3278
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let n=this._client._options.timeout;if(!e.stream&&n==null){let i=Cp[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,i)}return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,stream:e.stream??!1})}stream(e,r){return Dp.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},yT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"};ma.Batches=xs;var Qa=class extends jt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(dr`/v1/models/${e}`,{...n,headers:Ke([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models",fn,{query:i,...r,headers:Ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var Sc=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Kg,Jg,Mp,bT,Tt=class{constructor({baseURL:e=Sc("ANTHROPIC_BASE_URL"),apiKey:r=Sc("ANTHROPIC_API_KEY")??null,authToken:n=Sc("ANTHROPIC_AUTH_TOKEN")??null,...i}={}){Kg.add(this),Mp.set(this,void 0);let a={apiKey:r,authToken:n,...i,baseURL:e||"https://api.anthropic.com"};if(!a.dangerouslyAllowBrowser&&qE())throw new se(`It looks like you're running in a browser-like environment.
|
|
3279
3279
|
|
|
3280
3280
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
3281
3281
|
If you understand the risks and have appropriate mitigations in place,
|
|
3282
3282
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
3283
3283
|
|
|
3284
3284
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
3285
|
-
`);this.baseURL=a.baseURL,this.timeout=a.timeout??
|
|
3285
|
+
`);this.baseURL=a.baseURL,this.timeout=a.timeout??Jg.DEFAULT_TIMEOUT,this.logger=a.logger??console;let o="warn";this.logLevel=o,this.logLevel=Ng(a.logLevel,"ClientOptions.logLevel",this)??Ng(Sc("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??o,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??ZE(),ce(this,Mp,JE,"f"),this._options=a,this.apiKey=r,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(this.apiKey&&e.get("x-api-key"))&&!r.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!r.has("authorization"))throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(e){return Ke([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return Ke([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return Ke([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new se(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${ua}`}defaultIdempotencyKey(){return`stainless-node-retry-${Tg()}`}makeStatusError(e,r,n,i){return qt.generate(e,r,n,i)}buildURL(e,r,n){let i=!D(this,Kg,"m",bT).call(this)&&n||this.baseURL,a=zE(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return FE(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(a.search=this.stringifyQuery(r)),a.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new se("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>({method:e,path:r,...i})))}request(e,r=null){return new Ka(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let i=await e,a=i.maxRetries??this.maxRetries;r==null&&(r=a),await this.prepareOptions(i);let{req:o,url:s,timeout:l}=await this.buildRequest(i,{retryCount:a-r});await this.prepareRequest(o,{url:s,options:i});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Wt(this).debug(`[${c}] sending request`,Ai({retryOfRequestLogID:n,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Qt;let m=new AbortController,p=await this.fetchWithTimeout(s,o,l,m).catch(nc),h=Date.now();if(p instanceof Error){let g=`retrying, ${r} attempts remaining`;if(i.signal?.aborted)throw new Qt;let x=Ci(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Wt(this).info(`[${c}] connection ${x?"timed out":"failed"} - ${g}`),Wt(this).debug(`[${c}] connection ${x?"timed out":"failed"} (${g})`,Ai({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),this.retryRequest(i,r,n??c);throw Wt(this).info(`[${c}] connection ${x?"timed out":"failed"} - error; no more retries left`),Wt(this).debug(`[${c}] connection ${x?"timed out":"failed"} (error; no more retries left)`,Ai({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),x?new ls:new ca({cause:p})}let f=[...p.headers.entries()].filter(([g])=>g==="request-id").map(([g,x])=>", "+g+": "+JSON.stringify(x)).join(""),y=`[${c}${u}${f}] ${o.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let M=`retrying, ${r} attempts remaining`;return await KE(p.body),Wt(this).info(`${y} - ${M}`),Wt(this).debug(`[${c}] response error (${M})`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(i,r,n??c,p.headers)}let x=g?"error; no more retries left":"error; not retryable";Wt(this).info(`${y} - ${x}`);let v=await p.text().catch(M=>nc(M).message),I=dp(v),T=I?void 0:v;throw Wt(this).debug(`[${c}] response error (${x})`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,I,T,p.headers)}return Wt(this).info(y),Wt(this).debug(`[${c}] response start`,Ai({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:i,controller:m,requestLogID:c,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new cc(this,n,e)}async fetchWithTimeout(e,r,n,i){let{signal:a,method:o,...s}=r||{};a&&a.addEventListener("abort",()=>i.abort());let l=setTimeout(()=>i.abort(),n),c=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,u={signal:i.signal,...c?{duplex:"half"}:{},method:"GET",...s};o&&(u.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){let a,o=i?.get("retry-after-ms");if(o){let l=parseFloat(o);Number.isNaN(l)||(a=l)}let s=i?.get("retry-after");if(s&&!a){let l=parseFloat(s);Number.isNaN(l)?a=Date.parse(s)-Date.now():a=l*1e3}if(!(a&&0<=a&&a<60*1e3)){let l=e.maxRetries??this.maxRetries;a=this.calculateDefaultRetryTimeoutMillis(r,l)}return await UE(a),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let a=r-e,o=Math.min(.5*Math.pow(2,a),8),s=1-Math.random()*.25;return o*s*1e3}calculateNonstreamingTimeout(e,r){if(36e5*e/128e3>6e5||r!=null&&e>r)throw new se("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:i,path:a,query:o,defaultBaseURL:s}=n,l=this.buildURL(a,o,s);"timeout"in n&&jE("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:i,bodyHeaders:c,retryCount:r});return{req:{method:i,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:l,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let a={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let o=Ke([a,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...WE(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=Ke([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:pp(e)}:D(this,Mp,"f").call(this,{body:e,headers:n})}};Jg=Tt,Mp=new WeakMap,Kg=new WeakSet,bT=function(){return this.baseURL!=="https://api.anthropic.com"};Tt.Anthropic=Jg;Tt.HUMAN_PROMPT=`
|
|
3286
3286
|
|
|
3287
3287
|
Human:`;Tt.AI_PROMPT=`
|
|
3288
3288
|
|
|
3289
|
-
Assistant:`;Tt.DEFAULT_TIMEOUT=6e5;Tt.AnthropicError=se;Tt.APIError=qt;Tt.APIConnectionError=ca;Tt.APIConnectionTimeoutError=ls;Tt.APIUserAbortError=Qt;Tt.NotFoundError=ps;Tt.ConflictError=ms;Tt.RateLimitError=fs;Tt.BadRequestError=cs;Tt.AuthenticationError=us;Tt.InternalServerError=gs;Tt.PermissionDeniedError=ds;Tt.UnprocessableEntityError=hs;Tt.toFile=
|
|
3289
|
+
Assistant:`;Tt.DEFAULT_TIMEOUT=6e5;Tt.AnthropicError=se;Tt.APIError=qt;Tt.APIConnectionError=ca;Tt.APIConnectionTimeoutError=ls;Tt.APIUserAbortError=Qt;Tt.NotFoundError=ps;Tt.ConflictError=ms;Tt.RateLimitError=fs;Tt.BadRequestError=cs;Tt.AuthenticationError=us;Tt.InternalServerError=gs;Tt.PermissionDeniedError=ds;Tt.UnprocessableEntityError=hs;Tt.toFile=yp;var On=class extends Tt{constructor(){super(...arguments),this.completions=new Ya(this),this.messages=new ma(this),this.models=new Qa(this),this.beta=new ti(this)}};On.Completions=Ya;On.Messages=ma;On.Models=Qa;On.Beta=ti;var{HUMAN_PROMPT:EL,AI_PROMPT:TL}=On;var $p=new Re("AnthropicChat"),Lp=class extends ss{addUserMessage(e){let r={role:"user",content:e||""};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}addAssistantMessage(e){let r={role:"assistant",content:e||""};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(r),customData:r})}async sendMessage(e){this.addUserMessage(e);let r=new On({apiKey:this.config.apiKey,baseURL:this.config.endpoint,dangerouslyAllowBrowser:!0}),n=!0,i="",a="";for(;n;){n=!1,await this.config.onBeforeMessageProcessing?.(),await this.trimMessages(),$p.debug("Before processing state",{messages:this.messageGroup.getAll().map(m=>m.customData),tools:this.toolGroup.getAll().map(m=>m.customData),context:this.contextGroup.getAll().map(m=>m.content)});let o=this.toolGroup.getAll().map(m=>({name:m.customData?.name||"",description:m.customData?.description||"",input_schema:{type:"object",required:m.customData?.params.required||[],properties:m.customData?.params.properties||{}}})),s;if(this.config.stream){let m=r.messages.stream({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.getAll().map(p=>p.customData),tools:o,stream:!0});m.on("text",p=>{a+=p,this.config.onAIMessage?.(a,!0)}),s=await m.finalMessage()}else s=await r.messages.create({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.items.map(m=>m.customData),tools:o});$p.debug("Message received",s);let l=!0;Array.isArray(s.content)&&s.content.length==0&&(l=!1);let c={role:s.role,content:s.content};l&&this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(c),customData:c});let u=[];for(let m of s.content)m.type=="thinking"?$p.debug(`AI is thinking: ${m.thinking}`):m.type=="text"?i+=m.text||`
|
|
3290
3290
|
|
|
3291
|
-
`:m.type=="tool_use"&&u.push(this.performToolCall(m));let d=await Promise.all(u);if(d.length>0){let m={role:"user",content:d};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(m),customData:m}),n=!0}this.config.onAIMessage?.(i,!0),this.stats.tokensUsed+=s.usage.input_tokens+s.usage.output_tokens}return i=i.trim(),this.config.onAIMessage?.(i,!1),i}async performToolCall(e){try{let r=this.toolGroup.getAll().find(i=>i.customData?.name==e.name);if(!r)throw new Error(`Tool ${e.name} not found`);this.config.onAIToolStart?.(e.name,e.input);let n=await r.customData.callback(e.input);return typeof n!="string"&&(n=JSON.stringify(n)||""),(n===""||n==="undefined")&&(n="success"),{type:"tool_result",tool_use_id:e.id,content:String(n||"")}}catch(r){return Dp.error(`Error performing tool call ${e.name}: ${r.message||r.toString()}`),{type:"tool_result",tool_use_id:e.id,content:`Error performing tool call ${e.name}: ${r.message||r.toString()}`}}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items[0]?.customData?.content?.type=="tool_result";)this.messageGroup.items.shift()}};var ut=function(){return ut=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ut.apply(this,arguments)};function TL(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(u){try{c(n.next(u))}catch(d){o(d)}}function l(u){try{c(n.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):i(u.value).then(s,l)}c((n=n.apply(t,e||[])).next())})}function CL(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}var IL="ENTRIES",mT="KEYS",hT="VALUES",er="",Kg=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Es(this._path),r=e.node,n=e.keys;if(Es(n)===er)return{done:!1,value:this.result()};var i=r.get(Es(n));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=Es(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var r=e.keys;return Es(r)}).filter(function(e){return e!==er}).join("")},t.prototype.value=function(){return Es(this._path).node.get(er)},t.prototype.result=function(){switch(this._type){case hT:return this.value();case mT:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),Es=function(t){return t[t.length-1]},AL=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,a=i+r,o=new Uint8Array(a*i).fill(r+1),s=0;s<i;++s)o[s]=s;for(var l=1;l<a;++l)o[l*i]=l;return fT(t,e,r,n,o,1,i,""),n},fT=function(t,e,r,n,i,a,o,s){var l,c,u=a*o;try{e:for(var d=Te(t.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===er){var h=i[u-1];h<=r&&n.set(s,[t.get(p),h])}else{for(var f=a,y=0;y<p.length;++y,++f){for(var g=p[y],S=o*f,v=S-o,I=i[S],T=Math.max(0,f-r-1),C=Math.min(o-1,f+r),$=T;$<C;++$){var W=g!==e[$],M=i[v+$]+ +W,B=i[v+$+1]+1,Y=i[S+$]+1,H=i[S+$+1]=Math.min(M,B,Y);H<I&&(I=H)}if(I>r)continue e}fT(t.get(p),e,r,n,i,f,o,s+p)}}}catch(j){l={error:j}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},Jg=function(){function t(e,r){e===void 0&&(e=new Map),r===void 0&&(r=""),this._size=void 0,this._tree=e,this._prefix=r}return t.prototype.atPrefix=function(e){var r,n;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=Rt(Lp(this._tree,e.slice(this._prefix.length)),2),a=i[0],o=i[1];if(a===void 0){var s=Rt(iy(o),2),l=s[0],c=s[1];try{for(var u=Te(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==er&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new t(p,e)}}}catch(h){r={error:h}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}return new t(a,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,PL(this._tree,e)},t.prototype.entries=function(){return new Kg(this,IL)},t.prototype.forEach=function(e){var r,n;try{for(var i=Te(this),a=i.next();!a.done;a=i.next()){var o=Rt(a.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return AL(this._tree,e,r)},t.prototype.get=function(e){var r=ty(this._tree,e);return r!==void 0?r.get(er):void 0},t.prototype.has=function(e){var r=ty(this._tree,e);return r!==void 0&&r.has(er)},t.prototype.keys=function(){return new Kg(this,mT)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Xg(this._tree,e);return n.set(er,r),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Xg(this._tree,e);return n.set(er,r(n.get(er))),this},t.prototype.fetch=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Xg(this._tree,e),i=n.get(er);return i===void 0&&n.set(er,i=r()),i},t.prototype.values=function(){return new Kg(this,hT)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=Rt(o.value,2),l=s[0],c=s[1];i.set(l,c)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),Lp=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var a=Te(t.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==er&&e.startsWith(s))return r.push([t,s]),Lp(t.get(s),e.slice(s.length),r)}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.push([t,e]),Lp(void 0,"",r)},ty=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=Te(t.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;if(o!==er&&e.startsWith(o))return ty(t.get(o),e.slice(o.length))}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Xg=function(t,e){var r,n,i=e.length;e:for(var a=0;t&&a<i;){try{for(var o=(r=void 0,Te(t.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==er&&e[a]===l[0]){for(var c=Math.min(i-a,l.length),u=1;u<c&&e[a+u]===l[u];)++u;var d=t.get(l);if(u===l.length)t=d;else{var m=new Map;m.set(l.slice(u),d),t.set(e.slice(a,a+u),m),t.delete(l),t=m}a+=u;continue e}}}catch(h){r={error:h}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var p=new Map;return t.set(e.slice(a),p),p}return t},PL=function(t,e){var r=Rt(Lp(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(er),n.size===0)gT(i);else if(n.size===1){var a=Rt(n.entries().next().value,2),o=a[0],s=a[1];yT(i,o,s)}}},gT=function(t){if(t.length!==0){var e=Rt(iy(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)gT(t.slice(0,-1));else if(r.size===1){var i=Rt(r.entries().next().value,2),a=i[0],o=i[1];a!==er&&yT(t.slice(0,-1),a,o)}}},yT=function(t,e,r){if(t.length!==0){var n=Rt(iy(t),2),i=n[0],a=n[1];i.set(a+e,r),i.delete(a)}},iy=function(t){return t[t.length-1]},_c,ay="or",bT="and",RL="and_not",vT=function(){function t(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?ey:e.autoVacuum;this._options=ut(ut(ut({},Qg),e),{autoVacuum:r,searchOptions:ut(ut({},cT),e.searchOptions||{}),autoSuggestOptions:ut(ut({},$L),e.autoSuggestOptions||{})}),this._index=new Jg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ny,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,h=c(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(h))throw new Error("MiniSearch: duplicate ID ".concat(h));var f=this.addDocumentId(h);this.saveStoredFields(f,e);try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var S=g.value,v=c(e,S);if(v!=null){var I=u(v.toString(),S),T=this._fieldIds[S],C=new Set(I).size;this.addFieldLength(f,T,this._documentCount-1,C);try{for(var $=(i=void 0,Te(I)),W=$.next();!W.done;W=$.next()){var M=W.value,B=d(M,S);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.addTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.addTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=$.return)&&a.call($)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.add(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,a=i===void 0?10:i,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,d,m){var p=u.chunk,h=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:h.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return n.addAll(p)})}:{chunk:p,promise:h}},o),l=s.chunk,c=s.promise;return c.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,h=d(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var f=this._idToShortId.get(h);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(h,": it is not in the index"));try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var S=g.value,v=d(e,S);if(v!=null){var I=c(v.toString(),S),T=this._fieldIds[S],C=new Set(I).size;this.removeFieldLength(f,T,this._documentCount,C);try{for(var $=(i=void 0,Te(I)),W=$.next();!W.done;W=$.next()){var M=W.value,B=u(M,S);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.removeTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.removeTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=$.return)&&a.call($)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(h),this._fieldLength.delete(f),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.remove(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Jg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,a){r.removeFieldLength(n,a,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:a},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,a=i(e,n);this.discard(a),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=ny,n.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,r){return TL(this,void 0,void 0,function(){var n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,S,v,I,T,C,$,W,M,B,Y;return CL(this,function(H){switch(H.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||ry.batchSize,a=e.batchWait||ry.batchWait,o=1,H.label=1;case 1:H.trys.push([1,7,8,9]),s=Te(this._index),l=s.next(),H.label=2;case 2:if(l.done)return[3,6];c=Rt(l.value,2),u=c[0],d=c[1];try{for(m=(W=void 0,Te(d)),p=m.next();!p.done;p=m.next()){h=Rt(p.value,2),f=h[0],y=h[1];try{for(g=(B=void 0,Te(y)),S=g.next();!S.done;S=g.next())v=Rt(S.value,1),I=v[0],!this._documentIds.has(I)&&(y.size<=1?d.delete(f):y.delete(I))}catch(j){B={error:j}}finally{try{S&&!S.done&&(Y=g.return)&&Y.call(g)}finally{if(B)throw B.error}}}}catch(j){W={error:j}}finally{try{p&&!p.done&&(M=m.return)&&M.call(m)}finally{if(W)throw W.error}}return this._index.get(u).size===0&&this._index.delete(u),o%i!==0?[3,4]:[4,new Promise(function(j){return setTimeout(j,a)})];case 3:H.sent(),H.label=4;case 4:o+=1,H.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return T=H.sent(),C={error:T},[3,9];case 8:try{l&&!l.done&&($=s.return)&&$.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=n,H.label=10;case 10:return[4,null];case 11:return H.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||ey.minDirtCount,n=n||ey.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.getStoredFields=function(e){var r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var a=this.executeQuery(e,r),o=[];try{for(var s=Te(a),l=s.next();!l.done;l=s.next()){var c=Rt(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,h=d.match,f=p.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(h),queryTerms:p,match:h};Object.assign(y,this._storedFields.get(u)),(r.filter==null||r.filter(y))&&o.push(y)}}catch(g){n={error:g}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e===t.wildcard&&r.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(dT),o},t.prototype.autoSuggest=function(e,r){var n,i,a,o;r===void 0&&(r={}),r=ut(ut({},this._options.autoSuggestOptions),r);var s=new Map;try{for(var l=Te(this.search(e,r)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),h=s.get(p);h!=null?(h.score+=d,h.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(T){n={error:T}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var f=[];try{for(var y=Te(s),g=y.next();!g.done;g=y.next()){var S=Rt(g.value,2),h=S[0],v=S[1],d=v.score,m=v.terms,I=v.count;f.push({suggestion:h,terms:m,score:d/I})}}catch(T){a={error:T}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(a)throw a.error}}return f.sort(dT),f},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)},t.getDefault=function(e){if(Qg.hasOwnProperty(e))return Yg(Qg,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,a,o,s,l,c=e.index,u=e.documentCount,d=e.nextId,m=e.documentIds,p=e.fieldIds,h=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,g=e.dirtCount,S=e.serializationVersion;if(S!==1&&S!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var v=new t(r);v._documentCount=u,v._nextId=d,v._documentIds=$p(m),v._idToShortId=new Map,v._fieldIds=p,v._fieldLength=$p(h),v._avgFieldLength=f,v._storedFields=$p(y),v._dirtCount=g||0,v._index=new Jg;try{for(var I=Te(v._documentIds),T=I.next();!T.done;T=I.next()){var C=Rt(T.value,2),$=C[0],W=C[1];v._idToShortId.set(W,$)}}catch(kt){n={error:kt}}finally{try{T&&!T.done&&(i=I.return)&&i.call(I)}finally{if(n)throw n.error}}try{for(var M=Te(c),B=M.next();!B.done;B=M.next()){var Y=Rt(B.value,2),H=Y[0],j=Y[1],Z=new Map;try{for(var ae=(s=void 0,Te(Object.keys(j))),$e=ae.next();!$e.done;$e=ae.next()){var Xe=$e.value,At=j[Xe];S===1&&(At=At.ds),Z.set(parseInt(Xe,10),$p(At))}}catch(kt){s={error:kt}}finally{try{$e&&!$e.done&&(l=ae.return)&&l.call(ae)}finally{if(s)throw s.error}}v._index.set(H,Z)}}catch(kt){a={error:kt}}finally{try{B&&!B.done&&(o=M.return)&&o.call(M)}finally{if(a)throw a.error}}return v},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){var i=ut(ut(ut({},r),e),{queries:void 0}),a=e.queries.map(function(y){return n.executeQuery(y,i)});return this.combineResults(a,i.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=ut(ut({tokenize:s,processTerm:l},c),r),d=u.tokenize,m=u.processTerm,p=d(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),h=p.map(ML(u)),f=h.map(function(y){return n.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,a,o,s=ut(ut({},this._options.searchOptions),r),l=(s.fields||this._options.fields).reduce(function(Xe,At){var kt;return ut(ut({},Xe),(kt={},kt[At]=Yg(s.boost,At)||1,kt))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=ut(ut({},cT.weights),u),h=p.fuzzy,f=p.prefix,y=this._index.get(e.term),g=this.termResults(e.term,e.term,1,y,l,c,m),S,v;if(e.prefix&&(S=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,T=I<1?Math.min(d,Math.round(e.term.length*I)):I;T&&(v=this._index.fuzzyGet(e.term,T))}if(S)try{for(var C=Te(S),$=C.next();!$.done;$=C.next()){var W=Rt($.value,2),M=W[0],B=W[1],Y=M.length-e.term.length;if(Y){v?.delete(M);var H=f*M.length/(M.length+.3*Y);this.termResults(e.term,M,H,B,l,c,m,g)}}}catch(Xe){n={error:Xe}}finally{try{$&&!$.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}if(v)try{for(var j=Te(v.keys()),Z=j.next();!Z.done;Z=j.next()){var M=Z.value,ae=Rt(v.get(M),2),$e=ae[0],Y=ae[1];if(Y){var H=h*M.length/(M.length+Y);this.termResults(e.term,M,H,$e,l,c,m,g)}}}catch(Xe){a={error:Xe}}finally{try{Z&&!Z.done&&(o=j.return)&&o.call(j)}finally{if(a)throw a.error}}return g},t.prototype.executeWildcardQuery=function(e){var r,n,i=new Map,a=ut(ut({},this._options.searchOptions),e);try{for(var o=Te(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;i.set(c,{score:d,terms:[],match:{}})}}catch(m){r={error:m}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=ay),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(NL[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,a=[];try{for(var o=Te(this._index),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(n=void 0,Te(u)),p=m.next();!p.done;p=m.next()){var h=Rt(p.value,2),f=h[0],y=h[1];d[f]=Object.fromEntries(y)}}catch(g){n={error:g}}finally{try{p&&!p.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}a.push([c,d])}}catch(g){e={error:g}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),i==null)return l;try{for(var h=Te(Object.keys(a)),f=h.next();!f.done;f=h.next()){var y=f.value,g=a[y],S=this._fieldIds[y],v=i.get(S);if(v!=null){var I=v.size,T=this._avgFieldLength[S];try{for(var C=(d=void 0,Te(v.keys())),$=C.next();!$.done;$=C.next()){var W=$.value;if(!this._documentIds.has(W)){this.removeTerm(S,W,r),I-=1;continue}var M=o?o(this._documentIds.get(W),r,this._storedFields.get(W)):1;if(M){var B=v.get(W),Y=this._fieldLength.get(W)[S],H=DL(B,I,this._documentCount,Y,T,s),j=n*g*M*H,Z=l.get(W);if(Z){Z.score+=j,LL(Z.terms,e);var ae=Yg(Z.match,r);ae?ae.push(y):Z.match[r]=[y]}else l.set(W,{score:j,terms:[e],match:(p={},p[r]=[y],p)})}}}catch($e){d={error:$e}}finally{try{$&&!$.done&&(m=C.return)&&m.call(C)}finally{if(d)throw d.error}}}}}catch($e){c={error:$e}}finally{try{f&&!f.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,pT),a=i.get(e);if(a==null)a=new Map,a.set(r,1),i.set(e,a);else{var o=a.get(r);a.set(r,(o||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,pT),a=i.get(e);a==null||a.get(r)==null?this.warnDocumentChanged(r,e,n):a.get(r)<=1?a.size<=1?i.delete(e):a.delete(r):a.set(r,a.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,a;try{for(var o=Te(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){i={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[r]=i;var o=this._avgFieldLength[r]||0,s=o*n+i;this._avgFieldLength[r]=s/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var a=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=a/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=Te(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(r,d);m!==void 0&&(l[d]=m)}}catch(p){n={error:p}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}},t.wildcard=Symbol("*"),t}(),Yg=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},NL=(_c={},_c[ay]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value,s=t.get(o);if(s==null)t.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),uT(s.terms,u)}}}catch(m){r={error:m}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},_c[bT]=function(t,e){var r,n,i=new Map;try{for(var a=Te(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=t.get(s);if(l!=null){var c=e.get(s),u=c.score,d=c.terms,m=c.match;uT(l.terms,d),i.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){r={error:p}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},_c[RL]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;t.delete(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},_c),OL={k:1.2,b:.7,d:.5},DL=function(t,e,r,n,i,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(r-e+.5)/(e+.5));return c*(l+t*(o+1)/(t+o*(1-s+s*n/i)))},ML=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,a=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:a}}},Qg={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t){return t.split(zL)},processTerm:function(t){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e){typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},cT={combineWith:ay,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:OL},$L={combineWith:bT,prefix:function(t,e,r){return e===r.length-1}},ry={batchSize:1e3,batchWait:10},ny={minDirtFactor:.1,minDirtCount:20},ey=ut(ut({},ry),ny),LL=function(t,e){t.includes(e)||t.push(e)},uT=function(t,e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;t.includes(o)||t.push(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},dT=function(t,e){var r=t.score,n=e.score;return n-r},pT=function(){return new Map},$p=function(t){var e,r,n=new Map;try{for(var i=Te(Object.keys(t)),a=i.next();!a.done;a=i.next()){var o=a.value;n.set(parseInt(o,10),t[o])}}catch(s){e={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},zL=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var _T=t=>[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,r)=>{let n=await r.knowledgeBase.search(e.query),i=r;i._lastKBsearch=e.query,i._nextRequestUseKBitems=n,r.submitAnalyticsEvent({type:"kb-search",query:e.query,results:n});let a=n.filter(s=>s.type!="action").map(s=>"id="+s.id).join(", ")||"(none)",o=n.filter(s=>s.type=="action").map(s=>"name="+s._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${a}. New tools available: ${o}.`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return r.submitAnalyticsEvent({type:"open-url",url:e.url}),`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,r.submitAnalyticsEvent({type:"change-route",path:n}),`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email using the default mail client.",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),a=encodeURIComponent(e.body),o=`mailto:${n}?subject=${i}&body=${a}`;try{window.location.href=o}catch(s){throw new Error(`Failed to open email client: ${s instanceof Error?s.message:String(s)}`)}return r.submitAnalyticsEvent({type:"send-email",email_address:e.email_address,subject:e.subject,body_length:e.body.length}),`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Le;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Le||(Le={}));var ST;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ST||(ST={}));var K=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ni=t=>{switch(typeof t){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN(t)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(t)?K.array:t===null?K.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?K.promise:typeof Map<"u"&&t instanceof Map?K.map:typeof Set<"u"&&t instanceof Set?K.set:typeof Date<"u"&&t instanceof Date?K.date:K.object;default:return K.unknown}};var L=Le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var en=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};en.create=t=>new en(t);var FL=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===K.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Le.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Le.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Le.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Le.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Le.assertNever(t)}return{message:r}},ha=FL;var BL=ha;function Sc(){return BL}var zp=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function q(t,e){let r=Sc(),n=zp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ha?void 0:ha].filter(i=>!!i)});t.common.issues.push(n)}var dr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return de;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return de;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},de=Object.freeze({status:"aborted"}),Ts=t=>({status:"dirty",value:t}),Er=t=>({status:"valid",value:t}),oy=t=>t.status==="aborted",sy=t=>t.status==="dirty",eo=t=>t.status==="valid",wc=t=>typeof Promise<"u"&&t instanceof Promise;var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var bn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},wT=(t,e)=>{if(eo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new en(t.common.issues);return this._error=r,this._error}}};function _e(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:i}}var Ce=class{get description(){return this._def.description}_getType(e){return Ni(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new dr,ctx:{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(wc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parseSync({data:e,path:n.path,parent:n});return wT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return eo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>eo(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(wc(i)?i:Promise.resolve(i));return wT(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Mn({schema:this,typeName:ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Dn.create(this,this._def)}nullable(){return Mi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ga.create(this)}promise(){return to.create(this,this._def)}or(e){return Rs.create([this,e],this._def)}and(e){return Ns.create(this,e,this._def)}transform(e){return new Mn({..._e(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ls({..._e(this._def),innerType:this,defaultValue:r,typeName:ue.ZodDefault})}brand(){return new Fp({typeName:ue.ZodBranded,type:this,..._e(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zs({..._e(this._def),innerType:this,catchValue:r,typeName:ue.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bp.create(this,e)}readonly(){return Fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jL=/^c[^\s-]{8,}$/i,UL=/^[0-9a-z]+$/,GL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,VL=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,HL=/^[a-z0-9_-]{21}$/i,qL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,WL=/^[-+]?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)?)??$/,ZL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,KL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ly,JL=/^(?:(?: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])$/,XL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,YL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,QL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ez=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kT="((\\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])))",rz=new RegExp(`^${kT}$`);function xT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function nz(t){return new RegExp(`^${xT(t)}$`)}function iz(t){let e=`${kT}T${xT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function az(t,e){return!!((e==="v4"||!e)&&JL.test(t)||(e==="v6"||!e)&&YL.test(t))}function oz(t,e){if(!qL.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function sz(t,e){return!!((e==="v4"||!e)&&XL.test(t)||(e==="v6"||!e)&&QL.test(t))}var Is=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.string,received:a.parsedType}),de}let n=new dr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ZL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")ly||(ly=new RegExp(KL,"u")),ly.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")VL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")HL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")jL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")UL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")GL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:L.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?iz(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?rz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?nz(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?WL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?az(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?oz(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?sz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ez.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?tz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):Le.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Q.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Is.create=t=>new Is({checks:[],typeName:ue.ZodString,coerce:t?.coerce??!1,..._e(t)});function lz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var kc=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.number,received:a.parsedType}),de}let n,i=new dr;for(let a of this._def.checks)a.kind==="int"?Le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?lz(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_finite,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};kc.create=t=>new kc({checks:[],typeName:ue.ZodNumber,coerce:t?.coerce||!1,..._e(t)});var xc=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let n,i=new dr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.bigint,received:r.parsedType}),de}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};xc.create=t=>new xc({checks:[],typeName:ue.ZodBigInt,coerce:t?.coerce??!1,..._e(t)});var Ec=class extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.boolean,received:n.parsedType}),de}return Er(e.data)}};Ec.create=t=>new Ec({typeName:ue.ZodBoolean,coerce:t?.coerce||!1,..._e(t)});var Tc=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.date,received:a.parsedType}),de}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_date}),de}let n=new dr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Le.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Tc.create=t=>new Tc({checks:[],coerce:t?.coerce||!1,typeName:ue.ZodDate,..._e(t)});var Cc=class extends Ce{_parse(e){if(this._getType(e)!==K.symbol){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.symbol,received:n.parsedType}),de}return Er(e.data)}};Cc.create=t=>new Cc({typeName:ue.ZodSymbol,..._e(t)});var As=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.undefined,received:n.parsedType}),de}return Er(e.data)}};As.create=t=>new As({typeName:ue.ZodUndefined,..._e(t)});var Ps=class extends Ce{_parse(e){if(this._getType(e)!==K.null){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.null,received:n.parsedType}),de}return Er(e.data)}};Ps.create=t=>new Ps({typeName:ue.ZodNull,..._e(t)});var Ic=class extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Er(e.data)}};Ic.create=t=>new Ic({typeName:ue.ZodAny,..._e(t)});var fa=class extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Er(e.data)}};fa.create=t=>new fa({typeName:ue.ZodUnknown,..._e(t)});var ri=class extends Ce{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.never,received:r.parsedType}),de}};ri.create=t=>new ri({typeName:ue.ZodNever,..._e(t)});var Ac=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.void,received:n.parsedType}),de}return Er(e.data)}};Ac.create=t=>new Ac({typeName:ue.ZodVoid,..._e(t)});var ga=class t extends Ce{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==K.array)return q(r,{code:L.invalid_type,expected:K.array,received:r.parsedType}),de;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(q(r,{code:o?L.too_big:L.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new bn(r,o,r.path,s)))).then(o=>dr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new bn(r,o,r.path,s)));return dr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};ga.create=(t,e)=>new ga({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,..._e(e)});function Cs(t){if(t instanceof tn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Dn.create(Cs(n))}return new tn({...t._def,shape:()=>e})}else return t instanceof ga?new ga({...t._def,type:Cs(t.element)}):t instanceof Dn?Dn.create(Cs(t.unwrap())):t instanceof Mi?Mi.create(Cs(t.unwrap())):t instanceof Di?Di.create(t.items.map(e=>Cs(e))):t}var tn=class t extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==K.object){let c=this._getOrReturnCtx(e);return q(c,{code:L.invalid_type,expected:K.object,received:c.parsedType}),de}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ri&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=a[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new bn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ri){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")s.length>0&&(q(i,{code:L.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new bn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,m=await u.value;c.push({key:d,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>dr.mergeObjectSync(n,c)):dr.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Cs(this)}partial(e){let r={};for(let n of Le.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Dn;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return ET(Le.objectKeys(this.shape))}};tn.create=(t,e)=>new tn({shape:()=>t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.strictCreate=(t,e)=>new tn({shape:()=>t,unknownKeys:"strict",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.lazycreate=(t,e)=>new tn({shape:t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});var Rs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new en(s.ctx.common.issues));return q(r,{code:L.invalid_union,unionErrors:o}),de}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new en(l));return q(r,{code:L.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rs.create=(t,e)=>new Rs({options:t,typeName:ue.ZodUnion,..._e(e)});var Oi=t=>t instanceof Os?Oi(t.schema):t instanceof Mn?Oi(t.innerType()):t instanceof Ds?[t.value]:t instanceof Ms?t.options:t instanceof $s?Le.objectValues(t.enum):t instanceof Ls?Oi(t._def.innerType):t instanceof As?[void 0]:t instanceof Ps?[null]:t instanceof Dn?[void 0,...Oi(t.unwrap())]:t instanceof Mi?[null,...Oi(t.unwrap())]:t instanceof Fp||t instanceof Fs?Oi(t.unwrap()):t instanceof zs?Oi(t._def.innerType):[],cy=class t extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.object)return q(r,{code:L.invalid_type,expected:K.object,received:r.parsedType}),de;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Oi(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,..._e(n)})}};function uy(t,e){let r=Ni(t),n=Ni(e);if(t===e)return{valid:!0,data:t};if(r===K.object&&n===K.object){let i=Le.objectKeys(e),a=Le.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=uy(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===K.array&&n===K.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=uy(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===K.date&&n===K.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ns=class extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(oy(a)||oy(o))return de;let s=uy(a.value,o.value);return s.valid?((sy(a)||sy(o))&&r.dirty(),{status:r.value,value:s.data}):(q(n,{code:L.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ns.create=(t,e,r)=>new Ns({left:t,right:e,typeName:ue.ZodIntersection,..._e(r)});var Di=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.array)return q(n,{code:L.invalid_type,expected:K.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return q(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(q(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new bn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>dr.mergeArray(r,o)):dr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Di.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Di({items:t,typeName:ue.ZodTuple,rest:null,..._e(e)})};var dy=class t extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.object)return q(n,{code:L.invalid_type,expected:K.object,received:n.parsedType}),de;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new bn(n,s,n.path,s)),value:o._parse(new bn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?dr.mergeObjectAsync(r,i):dr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ce?new t({keyType:e,valueType:r,typeName:ue.ZodRecord,..._e(n)}):new t({keyType:Is.create(),valueType:e,typeName:ue.ZodRecord,..._e(r)})}},Pc=class extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.map)return q(n,{code:L.invalid_type,expected:K.map,received:n.parsedType}),de;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:i._parse(new bn(n,s,n.path,[c,"key"])),value:a._parse(new bn(n,l,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};Pc.create=(t,e,r)=>new Pc({valueType:e,keyType:t,typeName:ue.ZodMap,..._e(r)});var Rc=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.set)return q(n,{code:L.invalid_type,expected:K.set,received:n.parsedType}),de;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(q(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(q(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return de;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((l,c)=>a._parse(new bn(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Rc.create=(t,e)=>new Rc({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,..._e(e)});var py=class t extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.function)return q(r,{code:L.invalid_type,expected:K.function,received:r.parsedType}),de;function n(s,l){return zp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Sc(),ha].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(s,l){return zp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Sc(),ha].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof to){let s=this;return Er(async function(...l){let c=new en([]),u=await s._def.args.parseAsync(l,a).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{let s=this;return Er(function(...l){let c=s._def.args.safeParse(l,a);if(!c.success)throw new en([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new en([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Di.create(e).rest(fa.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Di.create([]).rest(fa.create()),returns:r||fa.create(),typeName:ue.ZodFunction,..._e(n)})}},Os=class extends Ce{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Os.create=(t,e)=>new Os({getter:t,typeName:ue.ZodLazy,..._e(e)});var Ds=class extends Ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ds.create=(t,e)=>new Ds({value:t,typeName:ue.ZodLiteral,..._e(e)});function ET(t,e){return new Ms({values:t,typeName:ue.ZodEnum,..._e(e)})}var Ms=class t extends Ce{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{expected:Le.joinValues(n),received:r.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{received:r.data,code:L.invalid_enum_value,options:n}),de}return Er(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ms.create=ET;var $s=class extends Ce{_parse(e){let r=Le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==K.string&&n.parsedType!==K.number){let i=Le.objectValues(r);return q(n,{expected:Le.joinValues(i),received:n.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(Le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Le.objectValues(r);return q(n,{received:n.data,code:L.invalid_enum_value,options:i}),de}return Er(e.data)}get enum(){return this._def.values}};$s.create=(t,e)=>new $s({values:t,typeName:ue.ZodNativeEnum,..._e(e)});var to=class extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.promise&&r.common.async===!1)return q(r,{code:L.invalid_type,expected:K.promise,received:r.parsedType}),de;let n=r.parsedType===K.promise?r.data:Promise.resolve(r.data);return Er(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};to.create=(t,e)=>new to({type:t,typeName:ue.ZodPromise,..._e(e)});var Mn=class extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return de;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?de:l.status==="dirty"?Ts(l.value):r.value==="dirty"?Ts(l.value):l});{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Ts(s.value):r.value==="dirty"?Ts(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!eo(o))return de;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>eo(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):de);Le.assertNever(i)}};Mn.create=(t,e,r)=>new Mn({schema:t,typeName:ue.ZodEffects,effect:e,..._e(r)});Mn.createWithPreprocess=(t,e,r)=>new Mn({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,..._e(r)});var Dn=class extends Ce{_parse(e){return this._getType(e)===K.undefined?Er(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Dn.create=(t,e)=>new Dn({innerType:t,typeName:ue.ZodOptional,..._e(e)});var Mi=class extends Ce{_parse(e){return this._getType(e)===K.null?Er(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mi.create=(t,e)=>new Mi({innerType:t,typeName:ue.ZodNullable,..._e(e)});var Ls=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===K.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ls.create=(t,e)=>new Ls({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});var zs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zs.create=(t,e)=>new zs({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});var Nc=class extends Ce{_parse(e){if(this._getType(e)!==K.nan){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.nan,received:n.parsedType}),de}return{status:"valid",value:e.data}}};Nc.create=t=>new Nc({typeName:ue.ZodNaN,..._e(t)});var xee=Symbol("zod_brand"),Fp=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bp=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?de:a.status==="dirty"?(r.dirty(),Ts(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ue.ZodPipeline})}},Fs=class extends Ce{_parse(e){let r=this._def.innerType._parse(e),n=i=>(eo(i)&&(i.value=Object.freeze(i.value)),i);return wc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fs.create=(t,e)=>new Fs({innerType:t,typeName:ue.ZodReadonly,..._e(e)});var Eee={object:tn.lazycreate},ue;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={}));var Tee=Is.create,Cee=kc.create,Iee=Nc.create,Aee=xc.create,Pee=Ec.create,Ree=Tc.create,Nee=Cc.create,Oee=As.create,Dee=Ps.create,Mee=Ic.create,$ee=fa.create,Lee=ri.create,zee=Ac.create,Fee=ga.create,cz=tn.create,Bee=tn.strictCreate,jee=Rs.create,Uee=cy.create,Gee=Ns.create,Vee=Di.create,Hee=dy.create,qee=Pc.create,Wee=Rc.create,Zee=py.create,Kee=Os.create,Jee=Ds.create,Xee=Ms.create,Yee=$s.create,Qee=to.create,ete=Mn.create,tte=Dn.create,rte=Mi.create,nte=Mn.createWithPreprocess,ite=Bp.create;var Up=Object.freeze({status:"aborted"});function N(t,e,r){function n(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,l);let c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let m=u[d];m in s||(s[m]=c[m].bind(s))}}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var l;let c=r?.Parent?new a:this;n(c,s),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var my=Symbol("zod_brand"),ni=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},jp={};function pr(t){return t&&Object.assign(jp,t),jp}var U={};Xd(U,{BIGINT_FORMAT_RANGES:()=>AT,Class:()=>fy,NUMBER_FORMAT_RANGES:()=>Sy,aborted:()=>_a,allowsEval:()=>by,assert:()=>gz,assertEqual:()=>pz,assertIs:()=>hz,assertNever:()=>fz,assertNotEqual:()=>mz,assignProp:()=>ya,base64ToUint8Array:()=>RT,base64urlToUint8Array:()=>Oz,cached:()=>Us,captureStackTrace:()=>Hp,cleanEnum:()=>Nz,cleanRegex:()=>Mc,clone:()=>zr,cloneDef:()=>bz,createTransparentProxy:()=>xz,defineLazy:()=>nt,esc:()=>Vp,escapeRegex:()=>ii,extend:()=>Cz,finalizeIssue:()=>$n,floatSafeRemainder:()=>gy,getElementAtPath:()=>vz,getEnumValues:()=>Gp,getLengthableOrigin:()=>$c,getParsedType:()=>kz,getSizableOrigin:()=>PT,hexToUint8Array:()=>Mz,isObject:()=>ro,isPlainObject:()=>va,issue:()=>Gs,joinValues:()=>pe,jsonStringifyReplacer:()=>js,merge:()=>Az,mergeDefs:()=>ba,normalizeParams:()=>ie,nullish:()=>Dc,numKeys:()=>wz,objectClone:()=>yz,omit:()=>Tz,optionalKeys:()=>_y,partial:()=>Pz,pick:()=>Ez,prefixIssues:()=>$i,primitiveTypes:()=>IT,promiseAllObject:()=>_z,propertyKeyTypes:()=>vy,randomString:()=>Sz,required:()=>Rz,safeExtend:()=>Iz,shallowClone:()=>CT,slugify:()=>yy,stringifyPrimitive:()=>me,uint8ArrayToBase64:()=>NT,uint8ArrayToBase64url:()=>Dz,uint8ArrayToHex:()=>$z,unwrapMessage:()=>Oc});function pz(t){return t}function mz(t){return t}function hz(t){}function fz(t){throw new Error}function gz(t){}function Gp(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function pe(t,e="|"){return t.map(r=>me(r)).join(e)}function js(t,e){return typeof e=="bigint"?e.toString():e}function Us(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Dc(t){return t==null}function Mc(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function gy(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let a=r>i?r:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}var TT=Symbol("evaluating");function nt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==TT)return n===void 0&&(n=TT,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function yz(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ya(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ba(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function bz(t){return ba(t._zod.def)}function vz(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function _z(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<e.length;a++)i[e[a]]=n[a];return i})}function Sz(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Vp(t){return JSON.stringify(t)}function yy(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Hp="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ro(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var by=Us(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function va(t){if(ro(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(ro(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function CT(t){return va(t)?{...t}:Array.isArray(t)?[...t]:t}function wz(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var kz=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},vy=new Set(["string","number","symbol"]),IT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ii(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ie(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function xz(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,a){return e??(e=t()),Reflect.set(e,n,i,a)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function me(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _y(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Sy={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},AT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ez(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Tz(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Cz(t,e){if(!va(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ba(t._zod.def,{get shape(){let a={...t._zod.def.shape,...e};return ya(this,"shape",a),a},checks:[]});return zr(t,i)}function Iz(t,e){if(!va(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ya(this,"shape",n),n},checks:t._zod.def.checks};return zr(t,r)}function Az(t,e){let r=ba(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ya(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return zr(t,r)}function Pz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function Rz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function _a(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function $i(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Oc(t){return typeof t=="string"?t:t?.message}function $n(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Oc(t.inst?._zod.def?.error?.(t))??Oc(e?.error?.(t))??Oc(r.customError?.(t))??Oc(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function PT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function $c(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Gs(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Nz(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function RT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function NT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Oz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return RT(e+r)}function Dz(t){return NT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Mz(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function $z(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var fy=class{constructor(...e){}};var OT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,js,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},qp=N("$ZodError",OT),wy=N("$ZodError",OT,{Parent:Error});function Wp(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function Zp(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)r._errors.push(e(a));else{let o=r,s=0;for(;s<a.path.length;){let l=a.path[s];s===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(a))):o[l]=o[l]||{_errors:[]},o=o[l],s++}}};return n(t),r}var Kp=t=>(e,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ni;if(o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,pr())));throw Hp(s,i?.callee),s}return o.value};var Jp=t=>async(e,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,pr())));throw Hp(s,i?.callee),s}return o.value};var Lc=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ni;return a.issues.length?{success:!1,error:new(t??qp)(a.issues.map(o=>$n(o,i,pr())))}:{success:!0,data:a.value}},Vs=Lc(wy),zc=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(o=>$n(o,i,pr())))}:{success:!0,data:a.value}},Fc=zc(wy),DT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Kp(t)(e,r,i)};var MT=t=>(e,r,n)=>Kp(t)(e,r,n);var $T=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Jp(t)(e,r,i)};var LT=t=>async(e,r,n)=>Jp(t)(e,r,n);var zT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lc(t)(e,r,i)};var FT=t=>(e,r,n)=>Lc(t)(e,r,n);var BT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zc(t)(e,r,i)};var jT=t=>async(e,r,n)=>zc(t)(e,r,n);var UT=/^[cC][^\s-]{8,}$/,GT=/^[0-9a-z]+$/,VT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,HT=/^[0-9a-vA-V]{20}$/,qT=/^[A-Za-z0-9]{27}$/,WT=/^[a-zA-Z0-9_-]{21}$/,ZT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var KT=/^([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})$/,ky=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var JT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var zz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function XT(){return new RegExp(zz,"u")}var YT=/^(?:(?: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])$/,QT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var e0=/^((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])$/,t0=/^(([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])$/,r0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xy=/^[A-Za-z0-9_-]*$/;var n0=/^\+(?:[0-9]){6,14}[0-9]$/,i0="(?:(?:\\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])))",a0=new RegExp(`^${i0}$`);function o0(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function s0(t){return new RegExp(`^${o0(t)}$`)}function l0(t){let e=o0({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${i0}T(?:${n})$`)}var c0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},u0=/^-?\d+n?$/,d0=/^-?\d+$/,p0=/^-?\d+(?:\.\d+)?/,m0=/^(?:true|false)$/i,h0=/^null$/i;var f0=/^[^A-Z]*$/,g0=/^[^a-z]*$/;var Zt=N("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),y0={number:"number",bigint:"bigint",object:"date"},Ey=N("$ZodCheckLessThan",(t,e)=>{Zt.init(t,e);let r=y0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ty=N("$ZodCheckGreaterThan",(t,e)=>{Zt.init(t,e);let r=y0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),b0=N("$ZodCheckMultipleOf",(t,e)=>{Zt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):gy(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),v0=N("$ZodCheckNumberFormat",(t,e)=>{Zt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=Sy[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=i,s.maximum=a,r&&(s.pattern=d0)}),t._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:t})}});var _0=N("$ZodCheckMaxLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Dc(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let o=$c(i);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),S0=N("$ZodCheckMinLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Dc(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let o=$c(i);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),w0=N("$ZodCheckLengthEquals",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Dc(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,a=i.length;if(a===e.length)return;let o=$c(i),s=a>e.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Bc=N("$ZodCheckStringFormat",(t,e)=>{var r,n;Zt.init(t,e),t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),k0=N("$ZodCheckRegex",(t,e)=>{Bc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),x0=N("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=f0),Bc.init(t,e)}),E0=N("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=g0),Bc.init(t,e)}),T0=N("$ZodCheckIncludes",(t,e)=>{Zt.init(t,e);let r=ii(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),C0=N("$ZodCheckStartsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`^${ii(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),I0=N("$ZodCheckEndsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`.*${ii(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var A0=N("$ZodCheckOverwrite",(t,e)=>{Zt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Xp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
3291
|
+
`:m.type=="tool_use"&&u.push(this.performToolCall(m));let d=await Promise.all(u);if(d.length>0){let m={role:"user",content:d};this.messageGroup.add({id:"msg-"+_t(),content:JSON.stringify(m),customData:m}),n=!0}this.config.onAIMessage?.(i,!0),this.stats.tokensUsed+=s.usage.input_tokens+s.usage.output_tokens}return i=i.trim(),this.config.onAIMessage?.(i,!1),i}async performToolCall(e){try{let r=this.toolGroup.getAll().find(i=>i.customData?.name==e.name);if(!r)throw new Error(`Tool ${e.name} not found`);this.config.onAIToolStart?.(e.name,e.input);let n=await r.customData.callback(e.input);return typeof n!="string"&&(n=JSON.stringify(n)||""),(n===""||n==="undefined")&&(n="success"),{type:"tool_result",tool_use_id:e.id,content:String(n||"")}}catch(r){return $p.error(`Error performing tool call ${e.name}: ${r.message||r.toString()}`),{type:"tool_result",tool_use_id:e.id,content:`Error performing tool call ${e.name}: ${r.message||r.toString()}`}}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items[0]?.customData?.content?.type=="tool_result";)this.messageGroup.items.shift()}};var ut=function(){return ut=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ut.apply(this,arguments)};function CL(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(u){try{c(n.next(u))}catch(d){o(d)}}function l(u){try{c(n.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):i(u.value).then(s,l)}c((n=n.apply(t,e||[])).next())})}function IL(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}var AL="ENTRIES",kT="KEYS",xT="VALUES",er="",Xg=function(){function t(e,r){var n=e._tree,i=Array.from(n.keys());this.set=e,this._type=r,this._path=i.length>0?[{node:n,keys:i}]:[]}return t.prototype.next=function(){var e=this.dive();return this.backtrack(),e},t.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Es(this._path),r=e.node,n=e.keys;if(Es(n)===er)return{done:!1,value:this.result()};var i=r.get(Es(n));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},t.prototype.backtrack=function(){if(this._path.length!==0){var e=Es(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},t.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var r=e.keys;return Es(r)}).filter(function(e){return e!==er}).join("")},t.prototype.value=function(){return Es(this._path).node.get(er)},t.prototype.result=function(){switch(this._type){case xT:return this.value();case kT:return this.key();default:return[this.key(),this.value()]}},t.prototype[Symbol.iterator]=function(){return this},t}(),Es=function(t){return t[t.length-1]},PL=function(t,e,r){var n=new Map;if(e===void 0)return n;for(var i=e.length+1,a=i+r,o=new Uint8Array(a*i).fill(r+1),s=0;s<i;++s)o[s]=s;for(var l=1;l<a;++l)o[l*i]=l;return ET(t,e,r,n,o,1,i,""),n},ET=function(t,e,r,n,i,a,o,s){var l,c,u=a*o;try{e:for(var d=Te(t.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===er){var h=i[u-1];h<=r&&n.set(s,[t.get(p),h])}else{for(var f=a,y=0;y<p.length;++y,++f){for(var g=p[y],x=o*f,v=x-o,I=i[x],T=Math.max(0,f-r-1),C=Math.min(o-1,f+r),M=T;M<C;++M){var W=g!==e[M],$=i[v+M]+ +W,B=i[v+M+1]+1,Y=i[x+M]+1,H=i[x+M+1]=Math.min($,B,Y);H<I&&(I=H)}if(I>r)continue e}ET(t.get(p),e,r,n,i,f,o,s+p)}}}catch(j){l={error:j}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},Yg=function(){function t(e,r){e===void 0&&(e=new Map),r===void 0&&(r=""),this._size=void 0,this._tree=e,this._prefix=r}return t.prototype.atPrefix=function(e){var r,n;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=Rt(Fp(this._tree,e.slice(this._prefix.length)),2),a=i[0],o=i[1];if(a===void 0){var s=Rt(oy(o),2),l=s[0],c=s[1];try{for(var u=Te(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==er&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new t(p,e)}}}catch(h){r={error:h}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}return new t(a,e)},t.prototype.clear=function(){this._size=void 0,this._tree.clear()},t.prototype.delete=function(e){return this._size=void 0,RL(this._tree,e)},t.prototype.entries=function(){return new Xg(this,AL)},t.prototype.forEach=function(e){var r,n;try{for(var i=Te(this),a=i.next();!a.done;a=i.next()){var o=Rt(a.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.fuzzyGet=function(e,r){return PL(this._tree,e,r)},t.prototype.get=function(e){var r=ny(this._tree,e);return r!==void 0?r.get(er):void 0},t.prototype.has=function(e){var r=ny(this._tree,e);return r!==void 0&&r.has(er)},t.prototype.keys=function(){return new Xg(this,kT)},t.prototype.set=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e);return n.set(er,r),this},Object.defineProperty(t.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),t.prototype.update=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e);return n.set(er,r(n.get(er))),this},t.prototype.fetch=function(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var n=Qg(this._tree,e),i=n.get(er);return i===void 0&&n.set(er,i=r()),i},t.prototype.values=function(){return new Xg(this,xT)},t.prototype[Symbol.iterator]=function(){return this.entries()},t.from=function(e){var r,n,i=new t;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=Rt(o.value,2),l=s[0],c=s[1];i.set(l,c)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},t.fromObject=function(e){return t.from(Object.entries(e))},t}(),Fp=function(t,e,r){var n,i;if(r===void 0&&(r=[]),e.length===0||t==null)return[t,r];try{for(var a=Te(t.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==er&&e.startsWith(s))return r.push([t,s]),Fp(t.get(s),e.slice(s.length),r)}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.push([t,e]),Fp(void 0,"",r)},ny=function(t,e){var r,n;if(e.length===0||t==null)return t;try{for(var i=Te(t.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;if(o!==er&&e.startsWith(o))return ny(t.get(o),e.slice(o.length))}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},Qg=function(t,e){var r,n,i=e.length;e:for(var a=0;t&&a<i;){try{for(var o=(r=void 0,Te(t.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==er&&e[a]===l[0]){for(var c=Math.min(i-a,l.length),u=1;u<c&&e[a+u]===l[u];)++u;var d=t.get(l);if(u===l.length)t=d;else{var m=new Map;m.set(l.slice(u),d),t.set(e.slice(a,a+u),m),t.delete(l),t=m}a+=u;continue e}}}catch(h){r={error:h}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}var p=new Map;return t.set(e.slice(a),p),p}return t},RL=function(t,e){var r=Rt(Fp(t,e),2),n=r[0],i=r[1];if(n!==void 0){if(n.delete(er),n.size===0)TT(i);else if(n.size===1){var a=Rt(n.entries().next().value,2),o=a[0],s=a[1];CT(i,o,s)}}},TT=function(t){if(t.length!==0){var e=Rt(oy(t),2),r=e[0],n=e[1];if(r.delete(n),r.size===0)TT(t.slice(0,-1));else if(r.size===1){var i=Rt(r.entries().next().value,2),a=i[0],o=i[1];a!==er&&CT(t.slice(0,-1),a,o)}}},CT=function(t,e,r){if(t.length!==0){var n=Rt(oy(t),2),i=n[0],a=n[1];i.set(a+e,r),i.delete(a)}},oy=function(t){return t[t.length-1]},wc,sy="or",IT="and",NL="and_not",AT=function(){function t(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var r=e.autoVacuum==null||e.autoVacuum===!0?ry:e.autoVacuum;this._options=ut(ut(ut({},ty),e),{autoVacuum:r,searchOptions:ut(ut({},vT),e.searchOptions||{}),autoSuggestOptions:ut(ut({},LL),e.autoSuggestOptions||{})}),this._index=new Yg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ay,this.addFields(this._options.fields)}return t.prototype.add=function(e){var r,n,i,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,h=c(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(h))throw new Error("MiniSearch: duplicate ID ".concat(h));var f=this.addDocumentId(h);this.saveStoredFields(f,e);try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var x=g.value,v=c(e,x);if(v!=null){var I=u(v.toString(),x),T=this._fieldIds[x],C=new Set(I).size;this.addFieldLength(f,T,this._documentCount-1,C);try{for(var M=(i=void 0,Te(I)),W=M.next();!W.done;W=M.next()){var $=W.value,B=d($,x);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.addTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.addTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}},t.prototype.addAll=function(e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.add(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.addAllAsync=function(e,r){var n=this;r===void 0&&(r={});var i=r.chunkSize,a=i===void 0?10:i,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,d,m){var p=u.chunk,h=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:h.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return n.addAll(p)})}:{chunk:p,promise:h}},o),l=s.chunk,c=s.promise;return c.then(function(){return n.addAll(l)})},t.prototype.remove=function(e){var r,n,i,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,h=d(e,p);if(h==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var f=this._idToShortId.get(h);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(h,": it is not in the index"));try{for(var y=Te(m),g=y.next();!g.done;g=y.next()){var x=g.value,v=d(e,x);if(v!=null){var I=c(v.toString(),x),T=this._fieldIds[x],C=new Set(I).size;this.removeFieldLength(f,T,this._documentCount,C);try{for(var M=(i=void 0,Te(I)),W=M.next();!W.done;W=M.next()){var $=W.value,B=u($,x);if(Array.isArray(B))try{for(var Y=(o=void 0,Te(B)),H=Y.next();!H.done;H=Y.next()){var j=H.value;this.removeTerm(T,f,j)}}catch(Z){o={error:Z}}finally{try{H&&!H.done&&(s=Y.return)&&s.call(Y)}finally{if(o)throw o.error}}else B&&this.removeTerm(T,f,B)}}catch(Z){i={error:Z}}finally{try{W&&!W.done&&(a=M.return)&&a.call(M)}finally{if(i)throw i.error}}}}}catch(Z){r={error:Z}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(h),this._fieldLength.delete(f),this._documentCount-=1},t.prototype.removeAll=function(e){var r,n;if(e)try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;this.remove(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Yg,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},t.prototype.discard=function(e){var r=this,n=this._idToShortId.get(e);if(n==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach(function(i,a){r.removeFieldLength(n,a,r._documentCount,i)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},t.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,r=e.minDirtFactor,n=e.minDirtCount,i=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:a},{minDirtCount:n,minDirtFactor:r})}},t.prototype.discardAll=function(e){var r,n,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=Te(e),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},t.prototype.replace=function(e){var r=this._options,n=r.idField,i=r.extractField,a=i(e,n);this.discard(a),this.add(e)},t.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},t.prototype.conditionalVacuum=function(e,r){var n=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=n._enqueuedVacuumConditions;return n._enqueuedVacuumConditions=ay,n.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},t.prototype.performVacuuming=function(e,r){return CL(this,void 0,void 0,function(){var n,i,a,o,s,l,c,u,d,m,p,h,f,y,g,x,v,I,T,C,M,W,$,B,Y;return IL(this,function(H){switch(H.label){case 0:if(n=this._dirtCount,!this.vacuumConditionsMet(r))return[3,10];i=e.batchSize||iy.batchSize,a=e.batchWait||iy.batchWait,o=1,H.label=1;case 1:H.trys.push([1,7,8,9]),s=Te(this._index),l=s.next(),H.label=2;case 2:if(l.done)return[3,6];c=Rt(l.value,2),u=c[0],d=c[1];try{for(m=(W=void 0,Te(d)),p=m.next();!p.done;p=m.next()){h=Rt(p.value,2),f=h[0],y=h[1];try{for(g=(B=void 0,Te(y)),x=g.next();!x.done;x=g.next())v=Rt(x.value,1),I=v[0],!this._documentIds.has(I)&&(y.size<=1?d.delete(f):y.delete(I))}catch(j){B={error:j}}finally{try{x&&!x.done&&(Y=g.return)&&Y.call(g)}finally{if(B)throw B.error}}}}catch(j){W={error:j}}finally{try{p&&!p.done&&($=m.return)&&$.call(m)}finally{if(W)throw W.error}}return this._index.get(u).size===0&&this._index.delete(u),o%i!==0?[3,4]:[4,new Promise(function(j){return setTimeout(j,a)})];case 3:H.sent(),H.label=4;case 4:o+=1,H.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return T=H.sent(),C={error:T},[3,9];case 8:try{l&&!l.done&&(M=s.return)&&M.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=n,H.label=10;case 10:return[4,null];case 11:return H.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},t.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var r=e.minDirtCount,n=e.minDirtFactor;return r=r||ry.minDirtCount,n=n||ry.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n},Object.defineProperty(t.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this._idToShortId.has(e)},t.prototype.getStoredFields=function(e){var r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)},t.prototype.search=function(e,r){var n,i;r===void 0&&(r={});var a=this.executeQuery(e,r),o=[];try{for(var s=Te(a),l=s.next();!l.done;l=s.next()){var c=Rt(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,h=d.match,f=p.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(h),queryTerms:p,match:h};Object.assign(y,this._storedFields.get(u)),(r.filter==null||r.filter(y))&&o.push(y)}}catch(g){n={error:g}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e===t.wildcard&&r.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(ST),o},t.prototype.autoSuggest=function(e,r){var n,i,a,o;r===void 0&&(r={}),r=ut(ut({},this._options.autoSuggestOptions),r);var s=new Map;try{for(var l=Te(this.search(e,r)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),h=s.get(p);h!=null?(h.score+=d,h.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(T){n={error:T}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}var f=[];try{for(var y=Te(s),g=y.next();!g.done;g=y.next()){var x=Rt(g.value,2),h=x[0],v=x[1],d=v.score,m=v.terms,I=v.count;f.push({suggestion:h,terms:m,score:d/I})}}catch(T){a={error:T}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(a)throw a.error}}return f.sort(ST),f},Object.defineProperty(t.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),t.loadJSON=function(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)},t.getDefault=function(e){if(ty.hasOwnProperty(e))return ey(ty,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},t.loadJS=function(e,r){var n,i,a,o,s,l,c=e.index,u=e.documentCount,d=e.nextId,m=e.documentIds,p=e.fieldIds,h=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,g=e.dirtCount,x=e.serializationVersion;if(x!==1&&x!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var v=new t(r);v._documentCount=u,v._nextId=d,v._documentIds=zp(m),v._idToShortId=new Map,v._fieldIds=p,v._fieldLength=zp(h),v._avgFieldLength=f,v._storedFields=zp(y),v._dirtCount=g||0,v._index=new Yg;try{for(var I=Te(v._documentIds),T=I.next();!T.done;T=I.next()){var C=Rt(T.value,2),M=C[0],W=C[1];v._idToShortId.set(W,M)}}catch(kt){n={error:kt}}finally{try{T&&!T.done&&(i=I.return)&&i.call(I)}finally{if(n)throw n.error}}try{for(var $=Te(c),B=$.next();!B.done;B=$.next()){var Y=Rt(B.value,2),H=Y[0],j=Y[1],Z=new Map;try{for(var ae=(s=void 0,Te(Object.keys(j))),$e=ae.next();!$e.done;$e=ae.next()){var Xe=$e.value,At=j[Xe];x===1&&(At=At.ds),Z.set(parseInt(Xe,10),zp(At))}}catch(kt){s={error:kt}}finally{try{$e&&!$e.done&&(l=ae.return)&&l.call(ae)}finally{if(s)throw s.error}}v._index.set(H,Z)}}catch(kt){a={error:kt}}finally{try{B&&!B.done&&(o=$.return)&&o.call($)}finally{if(a)throw a.error}}return v},t.prototype.executeQuery=function(e,r){var n=this;if(r===void 0&&(r={}),e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){var i=ut(ut(ut({},r),e),{queries:void 0}),a=e.queries.map(function(y){return n.executeQuery(y,i)});return this.combineResults(a,i.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=ut(ut({tokenize:s,processTerm:l},c),r),d=u.tokenize,m=u.processTerm,p=d(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),h=p.map($L(u)),f=h.map(function(y){return n.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},t.prototype.executeQuerySpec=function(e,r){var n,i,a,o,s=ut(ut({},this._options.searchOptions),r),l=(s.fields||this._options.fields).reduce(function(Xe,At){var kt;return ut(ut({},Xe),(kt={},kt[At]=ey(s.boost,At)||1,kt))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=ut(ut({},vT.weights),u),h=p.fuzzy,f=p.prefix,y=this._index.get(e.term),g=this.termResults(e.term,e.term,1,y,l,c,m),x,v;if(e.prefix&&(x=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,T=I<1?Math.min(d,Math.round(e.term.length*I)):I;T&&(v=this._index.fuzzyGet(e.term,T))}if(x)try{for(var C=Te(x),M=C.next();!M.done;M=C.next()){var W=Rt(M.value,2),$=W[0],B=W[1],Y=$.length-e.term.length;if(Y){v?.delete($);var H=f*$.length/($.length+.3*Y);this.termResults(e.term,$,H,B,l,c,m,g)}}}catch(Xe){n={error:Xe}}finally{try{M&&!M.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}if(v)try{for(var j=Te(v.keys()),Z=j.next();!Z.done;Z=j.next()){var $=Z.value,ae=Rt(v.get($),2),$e=ae[0],Y=ae[1];if(Y){var H=h*$.length/($.length+Y);this.termResults(e.term,$,H,$e,l,c,m,g)}}}catch(Xe){a={error:Xe}}finally{try{Z&&!Z.done&&(o=j.return)&&o.call(j)}finally{if(a)throw a.error}}return g},t.prototype.executeWildcardQuery=function(e){var r,n,i=new Map,a=ut(ut({},this._options.searchOptions),e);try{for(var o=Te(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;i.set(c,{score:d,terms:[],match:{}})}}catch(m){r={error:m}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},t.prototype.combineResults=function(e,r){if(r===void 0&&(r=sy),e.length===0)return new Map;var n=r.toLowerCase();return e.reduce(OL[n])||new Map},t.prototype.toJSON=function(){var e,r,n,i,a=[];try{for(var o=Te(this._index),s=o.next();!s.done;s=o.next()){var l=Rt(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(n=void 0,Te(u)),p=m.next();!p.done;p=m.next()){var h=Rt(p.value,2),f=h[0],y=h[1];d[f]=Object.fromEntries(y)}}catch(g){n={error:g}}finally{try{p&&!p.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}a.push([c,d])}}catch(g){e={error:g}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},t.prototype.termResults=function(e,r,n,i,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),i==null)return l;try{for(var h=Te(Object.keys(a)),f=h.next();!f.done;f=h.next()){var y=f.value,g=a[y],x=this._fieldIds[y],v=i.get(x);if(v!=null){var I=v.size,T=this._avgFieldLength[x];try{for(var C=(d=void 0,Te(v.keys())),M=C.next();!M.done;M=C.next()){var W=M.value;if(!this._documentIds.has(W)){this.removeTerm(x,W,r),I-=1;continue}var $=o?o(this._documentIds.get(W),r,this._storedFields.get(W)):1;if($){var B=v.get(W),Y=this._fieldLength.get(W)[x],H=ML(B,I,this._documentCount,Y,T,s),j=n*g*$*H,Z=l.get(W);if(Z){Z.score+=j,zL(Z.terms,e);var ae=ey(Z.match,r);ae?ae.push(y):Z.match[r]=[y]}else l.set(W,{score:j,terms:[e],match:(p={},p[r]=[y],p)})}}}catch($e){d={error:$e}}finally{try{M&&!M.done&&(m=C.return)&&m.call(C)}finally{if(d)throw d.error}}}}}catch($e){c={error:$e}}finally{try{f&&!f.done&&(u=h.return)&&u.call(h)}finally{if(c)throw c.error}}return l},t.prototype.addTerm=function(e,r,n){var i=this._index.fetch(n,wT),a=i.get(e);if(a==null)a=new Map,a.set(r,1),i.set(e,a);else{var o=a.get(r);a.set(r,(o||0)+1)}},t.prototype.removeTerm=function(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}var i=this._index.fetch(n,wT),a=i.get(e);a==null||a.get(r)==null?this.warnDocumentChanged(r,e,n):a.get(r)<=1?a.size<=1?i.delete(e):a.delete(r):a.set(r,a.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)},t.prototype.warnDocumentChanged=function(e,r,n){var i,a;try{for(var o=Te(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(n,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){i={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(i)throw i.error}}},t.prototype.addDocumentId=function(e){var r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r},t.prototype.addFields=function(e){for(var r=0;r<e.length;r++)this._fieldIds[e[r]]=r},t.prototype.addFieldLength=function(e,r,n,i){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[r]=i;var o=this._avgFieldLength[r]||0,s=o*n+i;this._avgFieldLength[r]=s/(n+1)},t.prototype.removeFieldLength=function(e,r,n,i){if(n===1){this._avgFieldLength[r]=0;return}var a=this._avgFieldLength[r]*n-i;this._avgFieldLength[r]=a/(n-1)},t.prototype.saveStoredFields=function(e,r){var n,i,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=Te(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(r,d);m!==void 0&&(l[d]=m)}}catch(p){n={error:p}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}},t.wildcard=Symbol("*"),t}(),ey=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0},OL=(wc={},wc[sy]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value,s=t.get(o);if(s==null)t.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),_T(s.terms,u)}}}catch(m){r={error:m}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},wc[IT]=function(t,e){var r,n,i=new Map;try{for(var a=Te(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=t.get(s);if(l!=null){var c=e.get(s),u=c.score,d=c.terms,m=c.match;_T(l.terms,d),i.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){r={error:p}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},wc[NL]=function(t,e){var r,n;try{for(var i=Te(e.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;t.delete(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},wc),DL={k:1.2,b:.7,d:.5},ML=function(t,e,r,n,i,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(r-e+.5)/(e+.5));return c*(l+t*(o+1)/(t+o*(1-s+s*n/i)))},$L=function(t){return function(e,r,n){var i=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,a=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0;return{term:e,fuzzy:i,prefix:a}}},ty={idField:"id",extractField:function(t,e){return t[e]},tokenize:function(t){return t.split(FL)},processTerm:function(t){return t.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(t,e){typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},vT={combineWith:sy,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:DL},LL={combineWith:IT,prefix:function(t,e,r){return e===r.length-1}},iy={batchSize:1e3,batchWait:10},ay={minDirtFactor:.1,minDirtCount:20},ry=ut(ut({},iy),ay),zL=function(t,e){t.includes(e)||t.push(e)},_T=function(t,e){var r,n;try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var o=a.value;t.includes(o)||t.push(o)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},ST=function(t,e){var r=t.score,n=e.score;return n-r},wT=function(){return new Map},zp=function(t){var e,r,n=new Map;try{for(var i=Te(Object.keys(t)),a=i.next();!a.done;a=i.next()){var o=a.value;n.set(parseInt(o,10),t[o])}}catch(s){e={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},FL=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var PT=t=>[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,r)=>{let n=await r.knowledgeBase.search(e.query),i=r;i._lastKBsearch=e.query,i._nextRequestUseKBitems=n,r.submitAnalyticsEvent({type:"kb-search",query:e.query,results:n});let a=n.filter(s=>s.type!="action").map(s=>"id="+s.id).join(", ")||"(none)",o=n.filter(s=>s.type=="action").map(s=>"name="+s._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${a}. New tools available: ${o}.`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return r.submitAnalyticsEvent({type:"open-url",url:e.url}),`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,r.submitAnalyticsEvent({type:"change-route",path:n}),`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email using the default mail client.",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),a=encodeURIComponent(e.body),o=`mailto:${n}?subject=${i}&body=${a}`;try{window.location.href=o}catch(s){throw new Error(`Failed to open email client: ${s instanceof Error?s.message:String(s)}`)}return r.submitAnalyticsEvent({type:"send-email",email_address:e.email_address,subject:e.subject,body_length:e.body.length}),`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Le;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Le||(Le={}));var RT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(RT||(RT={}));var K=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ni=t=>{switch(typeof t){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN(t)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(t)?K.array:t===null?K.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?K.promise:typeof Map<"u"&&t instanceof Map?K.map:typeof Set<"u"&&t instanceof Set?K.set:typeof Date<"u"&&t instanceof Date?K.date:K.object;default:return K.unknown}};var L=Le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var en=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};en.create=t=>new en(t);var BL=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===K.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Le.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Le.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Le.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Le.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Le.assertNever(t)}return{message:r}},ha=BL;var jL=ha;function kc(){return jL}var Bp=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function q(t,e){let r=kc(),n=Bp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ha?void 0:ha].filter(i=>!!i)});t.common.issues.push(n)}var pr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return de;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return de;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},de=Object.freeze({status:"aborted"}),Ts=t=>({status:"dirty",value:t}),Er=t=>({status:"valid",value:t}),ly=t=>t.status==="aborted",cy=t=>t.status==="dirty",eo=t=>t.status==="valid",xc=t=>typeof Promise<"u"&&t instanceof Promise;var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var bn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},NT=(t,e)=>{if(eo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new en(t.common.issues);return this._error=r,this._error}}};function _e(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:i}}var Ce=class{get description(){return this._def.description}_getType(e){return Ni(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pr,ctx:{common:e.parent.common,data:e.data,parsedType:Ni(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(xc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parseSync({data:e,path:n.path,parent:n});return NT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return eo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>eo(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ni(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(xc(i)?i:Promise.resolve(i));return NT(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Mn({schema:this,typeName:ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Dn.create(this,this._def)}nullable(){return Mi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ga.create(this)}promise(){return to.create(this,this._def)}or(e){return Rs.create([this,e],this._def)}and(e){return Ns.create(this,e,this._def)}transform(e){return new Mn({..._e(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ls({..._e(this._def),innerType:this,defaultValue:r,typeName:ue.ZodDefault})}brand(){return new jp({typeName:ue.ZodBranded,type:this,..._e(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zs({..._e(this._def),innerType:this,catchValue:r,typeName:ue.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Up.create(this,e)}readonly(){return Fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},UL=/^c[^\s-]{8,}$/i,GL=/^[0-9a-z]+$/,VL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HL=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qL=/^[a-z0-9_-]{21}$/i,WL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ZL=/^[-+]?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)?)??$/,KL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uy,XL=/^(?:(?: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])$/,YL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,QL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ez=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OT="((\\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])))",nz=new RegExp(`^${OT}$`);function DT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function iz(t){return new RegExp(`^${DT(t)}$`)}function az(t){let e=`${OT}T${DT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function oz(t,e){return!!((e==="v4"||!e)&&XL.test(t)||(e==="v6"||!e)&&QL.test(t))}function sz(t,e){if(!WL.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function lz(t,e){return!!((e==="v4"||!e)&&YL.test(t)||(e==="v6"||!e)&&ez.test(t))}var Is=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.string,received:a.parsedType}),de}let n=new pr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")KL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")uy||(uy=new RegExp(JL,"u")),uy.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")HL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")qL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")UL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")GL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")VL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:L.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?az(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?nz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?iz(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?ZL.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?oz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?sz(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?lz(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?tz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rz.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):Le.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Q.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Is.create=t=>new Is({checks:[],typeName:ue.ZodString,coerce:t?.coerce??!1,..._e(t)});function cz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Ec=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.number,received:a.parsedType}),de}let n,i=new pr;for(let a of this._def.checks)a.kind==="int"?Le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?cz(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_finite,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Ec.create=t=>new Ec({checks:[],typeName:ue.ZodNumber,coerce:t?.coerce||!1,..._e(t)});var Tc=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let n,i=new pr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Le.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.bigint,received:r.parsedType}),de}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Tc.create=t=>new Tc({checks:[],typeName:ue.ZodBigInt,coerce:t?.coerce??!1,..._e(t)});var Cc=class extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.boolean,received:n.parsedType}),de}return Er(e.data)}};Cc.create=t=>new Cc({typeName:ue.ZodBoolean,coerce:t?.coerce||!1,..._e(t)});var Ic=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:K.date,received:a.parsedType}),de}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_date}),de}let n=new pr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Le.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Ic.create=t=>new Ic({checks:[],coerce:t?.coerce||!1,typeName:ue.ZodDate,..._e(t)});var Ac=class extends Ce{_parse(e){if(this._getType(e)!==K.symbol){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.symbol,received:n.parsedType}),de}return Er(e.data)}};Ac.create=t=>new Ac({typeName:ue.ZodSymbol,..._e(t)});var As=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.undefined,received:n.parsedType}),de}return Er(e.data)}};As.create=t=>new As({typeName:ue.ZodUndefined,..._e(t)});var Ps=class extends Ce{_parse(e){if(this._getType(e)!==K.null){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.null,received:n.parsedType}),de}return Er(e.data)}};Ps.create=t=>new Ps({typeName:ue.ZodNull,..._e(t)});var Pc=class extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Er(e.data)}};Pc.create=t=>new Pc({typeName:ue.ZodAny,..._e(t)});var fa=class extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Er(e.data)}};fa.create=t=>new fa({typeName:ue.ZodUnknown,..._e(t)});var ri=class extends Ce{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:K.never,received:r.parsedType}),de}};ri.create=t=>new ri({typeName:ue.ZodNever,..._e(t)});var Rc=class extends Ce{_parse(e){if(this._getType(e)!==K.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.void,received:n.parsedType}),de}return Er(e.data)}};Rc.create=t=>new Rc({typeName:ue.ZodVoid,..._e(t)});var ga=class t extends Ce{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==K.array)return q(r,{code:L.invalid_type,expected:K.array,received:r.parsedType}),de;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(q(r,{code:o?L.too_big:L.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new bn(r,o,r.path,s)))).then(o=>pr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new bn(r,o,r.path,s)));return pr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};ga.create=(t,e)=>new ga({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,..._e(e)});function Cs(t){if(t instanceof tn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Dn.create(Cs(n))}return new tn({...t._def,shape:()=>e})}else return t instanceof ga?new ga({...t._def,type:Cs(t.element)}):t instanceof Dn?Dn.create(Cs(t.unwrap())):t instanceof Mi?Mi.create(Cs(t.unwrap())):t instanceof Di?Di.create(t.items.map(e=>Cs(e))):t}var tn=class t extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==K.object){let c=this._getOrReturnCtx(e);return q(c,{code:L.invalid_type,expected:K.object,received:c.parsedType}),de}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ri&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=a[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new bn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ri){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")s.length>0&&(q(i,{code:L.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new bn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,m=await u.value;c.push({key:d,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>pr.mergeObjectSync(n,c)):pr.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Cs(this)}partial(e){let r={};for(let n of Le.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Dn;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return MT(Le.objectKeys(this.shape))}};tn.create=(t,e)=>new tn({shape:()=>t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.strictCreate=(t,e)=>new tn({shape:()=>t,unknownKeys:"strict",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});tn.lazycreate=(t,e)=>new tn({shape:t,unknownKeys:"strip",catchall:ri.create(),typeName:ue.ZodObject,..._e(e)});var Rs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new en(s.ctx.common.issues));return q(r,{code:L.invalid_union,unionErrors:o}),de}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new en(l));return q(r,{code:L.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rs.create=(t,e)=>new Rs({options:t,typeName:ue.ZodUnion,..._e(e)});var Oi=t=>t instanceof Os?Oi(t.schema):t instanceof Mn?Oi(t.innerType()):t instanceof Ds?[t.value]:t instanceof Ms?t.options:t instanceof $s?Le.objectValues(t.enum):t instanceof Ls?Oi(t._def.innerType):t instanceof As?[void 0]:t instanceof Ps?[null]:t instanceof Dn?[void 0,...Oi(t.unwrap())]:t instanceof Mi?[null,...Oi(t.unwrap())]:t instanceof jp||t instanceof Fs?Oi(t.unwrap()):t instanceof zs?Oi(t._def.innerType):[],dy=class t extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.object)return q(r,{code:L.invalid_type,expected:K.object,received:r.parsedType}),de;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Oi(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,..._e(n)})}};function py(t,e){let r=Ni(t),n=Ni(e);if(t===e)return{valid:!0,data:t};if(r===K.object&&n===K.object){let i=Le.objectKeys(e),a=Le.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=py(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===K.array&&n===K.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=py(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===K.date&&n===K.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ns=class extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(ly(a)||ly(o))return de;let s=py(a.value,o.value);return s.valid?((cy(a)||cy(o))&&r.dirty(),{status:r.value,value:s.data}):(q(n,{code:L.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ns.create=(t,e,r)=>new Ns({left:t,right:e,typeName:ue.ZodIntersection,..._e(r)});var Di=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.array)return q(n,{code:L.invalid_type,expected:K.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return q(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(q(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new bn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>pr.mergeArray(r,o)):pr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Di.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Di({items:t,typeName:ue.ZodTuple,rest:null,..._e(e)})};var my=class t extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.object)return q(n,{code:L.invalid_type,expected:K.object,received:n.parsedType}),de;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new bn(n,s,n.path,s)),value:o._parse(new bn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?pr.mergeObjectAsync(r,i):pr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ce?new t({keyType:e,valueType:r,typeName:ue.ZodRecord,..._e(n)}):new t({keyType:Is.create(),valueType:e,typeName:ue.ZodRecord,..._e(r)})}},Nc=class extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.map)return q(n,{code:L.invalid_type,expected:K.map,received:n.parsedType}),de;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:i._parse(new bn(n,s,n.path,[c,"key"])),value:a._parse(new bn(n,l,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};Nc.create=(t,e,r)=>new Nc({valueType:e,keyType:t,typeName:ue.ZodMap,..._e(r)});var Oc=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==K.set)return q(n,{code:L.invalid_type,expected:K.set,received:n.parsedType}),de;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(q(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(q(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return de;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((l,c)=>a._parse(new bn(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Oc.create=(t,e)=>new Oc({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,..._e(e)});var hy=class t extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.function)return q(r,{code:L.invalid_type,expected:K.function,received:r.parsedType}),de;function n(s,l){return Bp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kc(),ha].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(s,l){return Bp({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kc(),ha].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof to){let s=this;return Er(async function(...l){let c=new en([]),u=await s._def.args.parseAsync(l,a).catch(p=>{throw c.addIssue(n(l,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{let s=this;return Er(function(...l){let c=s._def.args.safeParse(l,a);if(!c.success)throw new en([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new en([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Di.create(e).rest(fa.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Di.create([]).rest(fa.create()),returns:r||fa.create(),typeName:ue.ZodFunction,..._e(n)})}},Os=class extends Ce{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Os.create=(t,e)=>new Os({getter:t,typeName:ue.ZodLazy,..._e(e)});var Ds=class extends Ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ds.create=(t,e)=>new Ds({value:t,typeName:ue.ZodLiteral,..._e(e)});function MT(t,e){return new Ms({values:t,typeName:ue.ZodEnum,..._e(e)})}var Ms=class t extends Ce{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{expected:Le.joinValues(n),received:r.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{received:r.data,code:L.invalid_enum_value,options:n}),de}return Er(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ms.create=MT;var $s=class extends Ce{_parse(e){let r=Le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==K.string&&n.parsedType!==K.number){let i=Le.objectValues(r);return q(n,{expected:Le.joinValues(i),received:n.parsedType,code:L.invalid_type}),de}if(this._cache||(this._cache=new Set(Le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Le.objectValues(r);return q(n,{received:n.data,code:L.invalid_enum_value,options:i}),de}return Er(e.data)}get enum(){return this._def.values}};$s.create=(t,e)=>new $s({values:t,typeName:ue.ZodNativeEnum,..._e(e)});var to=class extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==K.promise&&r.common.async===!1)return q(r,{code:L.invalid_type,expected:K.promise,received:r.parsedType}),de;let n=r.parsedType===K.promise?r.data:Promise.resolve(r.data);return Er(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};to.create=(t,e)=>new to({type:t,typeName:ue.ZodPromise,..._e(e)});var Mn=class extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return de;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?de:l.status==="dirty"?Ts(l.value):r.value==="dirty"?Ts(l.value):l});{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Ts(s.value):r.value==="dirty"?Ts(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!eo(o))return de;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>eo(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):de);Le.assertNever(i)}};Mn.create=(t,e,r)=>new Mn({schema:t,typeName:ue.ZodEffects,effect:e,..._e(r)});Mn.createWithPreprocess=(t,e,r)=>new Mn({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,..._e(r)});var Dn=class extends Ce{_parse(e){return this._getType(e)===K.undefined?Er(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Dn.create=(t,e)=>new Dn({innerType:t,typeName:ue.ZodOptional,..._e(e)});var Mi=class extends Ce{_parse(e){return this._getType(e)===K.null?Er(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mi.create=(t,e)=>new Mi({innerType:t,typeName:ue.ZodNullable,..._e(e)});var Ls=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===K.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ls.create=(t,e)=>new Ls({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});var zs=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new en(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zs.create=(t,e)=>new zs({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});var Dc=class extends Ce{_parse(e){if(this._getType(e)!==K.nan){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:K.nan,received:n.parsedType}),de}return{status:"valid",value:e.data}}};Dc.create=t=>new Dc({typeName:ue.ZodNaN,..._e(t)});var Eee=Symbol("zod_brand"),jp=class extends Ce{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Up=class t extends Ce{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?de:a.status==="dirty"?(r.dirty(),Ts(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ue.ZodPipeline})}},Fs=class extends Ce{_parse(e){let r=this._def.innerType._parse(e),n=i=>(eo(i)&&(i.value=Object.freeze(i.value)),i);return xc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fs.create=(t,e)=>new Fs({innerType:t,typeName:ue.ZodReadonly,..._e(e)});var Tee={object:tn.lazycreate},ue;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={}));var Cee=Is.create,Iee=Ec.create,Aee=Dc.create,Pee=Tc.create,Ree=Cc.create,Nee=Ic.create,Oee=Ac.create,Dee=As.create,Mee=Ps.create,$ee=Pc.create,Lee=fa.create,zee=ri.create,Fee=Rc.create,Bee=ga.create,uz=tn.create,jee=tn.strictCreate,Uee=Rs.create,Gee=dy.create,Vee=Ns.create,Hee=Di.create,qee=my.create,Wee=Nc.create,Zee=Oc.create,Kee=hy.create,Jee=Os.create,Xee=Ds.create,Yee=Ms.create,Qee=$s.create,ete=to.create,tte=Mn.create,rte=Dn.create,nte=Mi.create,ite=Mn.createWithPreprocess,ate=Up.create;var Vp=Object.freeze({status:"aborted"});function N(t,e,r){function n(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,l);let c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let m=u[d];m in s||(s[m]=c[m].bind(s))}}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:t});function o(s){var l;let c=r?.Parent?new a:this;n(c,s),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var fy=Symbol("zod_brand"),ni=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Gp={};function mr(t){return t&&Object.assign(Gp,t),Gp}var U={};rc(U,{BIGINT_FORMAT_RANGES:()=>FT,Class:()=>yy,NUMBER_FORMAT_RANGES:()=>ky,aborted:()=>_a,allowsEval:()=>_y,assert:()=>yz,assertEqual:()=>mz,assertIs:()=>fz,assertNever:()=>gz,assertNotEqual:()=>hz,assignProp:()=>ya,base64ToUint8Array:()=>jT,base64urlToUint8Array:()=>Dz,cached:()=>Us,captureStackTrace:()=>Wp,cleanEnum:()=>Oz,cleanRegex:()=>Lc,clone:()=>zr,cloneDef:()=>vz,createTransparentProxy:()=>Ez,defineLazy:()=>nt,esc:()=>qp,escapeRegex:()=>ii,extend:()=>Iz,finalizeIssue:()=>$n,floatSafeRemainder:()=>by,getElementAtPath:()=>_z,getEnumValues:()=>Hp,getLengthableOrigin:()=>zc,getParsedType:()=>xz,getSizableOrigin:()=>BT,hexToUint8Array:()=>$z,isObject:()=>ro,isPlainObject:()=>va,issue:()=>Gs,joinValues:()=>pe,jsonStringifyReplacer:()=>js,merge:()=>Pz,mergeDefs:()=>ba,normalizeParams:()=>ie,nullish:()=>$c,numKeys:()=>kz,objectClone:()=>bz,omit:()=>Cz,optionalKeys:()=>wy,partial:()=>Rz,pick:()=>Tz,prefixIssues:()=>$i,primitiveTypes:()=>zT,promiseAllObject:()=>Sz,propertyKeyTypes:()=>Sy,randomString:()=>wz,required:()=>Nz,safeExtend:()=>Az,shallowClone:()=>LT,slugify:()=>vy,stringifyPrimitive:()=>me,uint8ArrayToBase64:()=>UT,uint8ArrayToBase64url:()=>Mz,uint8ArrayToHex:()=>Lz,unwrapMessage:()=>Mc});function mz(t){return t}function hz(t){return t}function fz(t){}function gz(t){throw new Error}function yz(t){}function Hp(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function pe(t,e="|"){return t.map(r=>me(r)).join(e)}function js(t,e){return typeof e=="bigint"?e.toString():e}function Us(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $c(t){return t==null}function Lc(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function by(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let a=r>i?r:i,o=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return o%s/10**a}var $T=Symbol("evaluating");function nt(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==$T)return n===void 0&&(n=$T,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function bz(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ya(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ba(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function vz(t){return ba(t._zod.def)}function _z(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Sz(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<e.length;a++)i[e[a]]=n[a];return i})}function wz(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function qp(t){return JSON.stringify(t)}function vy(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Wp="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ro(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var _y=Us(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function va(t){if(ro(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(ro(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(t){return va(t)?{...t}:Array.isArray(t)?[...t]:t}function kz(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xz=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Sy=new Set(["string","number","symbol"]),zT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ii(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ie(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ez(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,a){return e??(e=t()),Reflect.set(e,n,i,a)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function me(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function wy(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var ky={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},FT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Tz(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Cz(t,e){let r=t._zod.def,n=ba(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ya(this,"shape",i),i},checks:[]});return zr(t,n)}function Iz(t,e){if(!va(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ba(t._zod.def,{get shape(){let a={...t._zod.def.shape,...e};return ya(this,"shape",a),a},checks:[]});return zr(t,i)}function Az(t,e){if(!va(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ya(this,"shape",n),n},checks:t._zod.def.checks};return zr(t,r)}function Pz(t,e){let r=ba(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ya(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return zr(t,r)}function Rz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)a[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function Nz(t,e,r){let n=ba(e._zod.def,{get shape(){let i=e._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new t({type:"nonoptional",innerType:i[o]});return ya(this,"shape",a),a},checks:[]});return zr(e,n)}function _a(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function $i(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Mc(t){return typeof t=="string"?t:t?.message}function $n(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=Mc(t.inst?._zod.def?.error?.(t))??Mc(e?.error?.(t))??Mc(r.customError?.(t))??Mc(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function BT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function zc(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Gs(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Oz(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function jT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function UT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Dz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return jT(e+r)}function Mz(t){return UT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $z(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Lz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var yy=class{constructor(...e){}};var GT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,js,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Zp=N("$ZodError",GT),xy=N("$ZodError",GT,{Parent:Error});function Kp(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function Jp(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)r._errors.push(e(a));else{let o=r,s=0;for(;s<a.path.length;){let l=a.path[s];s===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(a))):o[l]=o[l]||{_errors:[]},o=o[l],s++}}};return n(t),r}var Xp=t=>(e,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ni;if(o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,mr())));throw Wp(s,i?.callee),s}return o.value};var Yp=t=>async(e,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??t)(o.issues.map(l=>$n(l,a,mr())));throw Wp(s,i?.callee),s}return o.value};var Fc=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ni;return a.issues.length?{success:!1,error:new(t??Zp)(a.issues.map(o=>$n(o,i,mr())))}:{success:!0,data:a.value}},Vs=Fc(xy),Bc=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(o=>$n(o,i,mr())))}:{success:!0,data:a.value}},jc=Bc(xy),VT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xp(t)(e,r,i)};var HT=t=>(e,r,n)=>Xp(t)(e,r,n);var qT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yp(t)(e,r,i)};var WT=t=>async(e,r,n)=>Yp(t)(e,r,n);var ZT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fc(t)(e,r,i)};var KT=t=>(e,r,n)=>Fc(t)(e,r,n);var JT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bc(t)(e,r,i)};var XT=t=>async(e,r,n)=>Bc(t)(e,r,n);var YT=/^[cC][^\s-]{8,}$/,QT=/^[0-9a-z]+$/,e0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,t0=/^[0-9a-vA-V]{20}$/,r0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,i0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var a0=/^([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})$/,Ey=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var o0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Fz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function s0(){return new RegExp(Fz,"u")}var l0=/^(?:(?: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])$/,c0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var u0=/^((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])$/,d0=/^(([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])$/,p0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ty=/^[A-Za-z0-9_-]*$/;var m0=/^\+(?:[0-9]){6,14}[0-9]$/,h0="(?:(?:\\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])))",f0=new RegExp(`^${h0}$`);function g0(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function y0(t){return new RegExp(`^${g0(t)}$`)}function b0(t){let e=g0({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${h0}T(?:${n})$`)}var v0=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_0=/^-?\d+n?$/,S0=/^-?\d+$/,w0=/^-?\d+(?:\.\d+)?/,k0=/^(?:true|false)$/i,x0=/^null$/i;var E0=/^[^A-Z]*$/,T0=/^[^a-z]*$/;var Zt=N("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),C0={number:"number",bigint:"bigint",object:"date"},Cy=N("$ZodCheckLessThan",(t,e)=>{Zt.init(t,e);let r=C0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Iy=N("$ZodCheckGreaterThan",(t,e)=>{Zt.init(t,e);let r=C0[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,a=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),I0=N("$ZodCheckMultipleOf",(t,e)=>{Zt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):by(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),A0=N("$ZodCheckNumberFormat",(t,e)=>{Zt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,a]=ky[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=i,s.maximum=a,r&&(s.pattern=S0)}),t._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:t})}});var P0=N("$ZodCheckMaxLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let o=zc(i);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),R0=N("$ZodCheckMinLength",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let o=zc(i);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),N0=N("$ZodCheckLengthEquals",(t,e)=>{var r;Zt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!$c(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,a=i.length;if(a===e.length)return;let o=zc(i),s=a>e.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Uc=N("$ZodCheckStringFormat",(t,e)=>{var r,n;Zt.init(t,e),t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),O0=N("$ZodCheckRegex",(t,e)=>{Uc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),D0=N("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=E0),Uc.init(t,e)}),M0=N("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=T0),Uc.init(t,e)}),$0=N("$ZodCheckIncludes",(t,e)=>{Zt.init(t,e);let r=ii(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),L0=N("$ZodCheckStartsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`^${ii(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),z0=N("$ZodCheckEndsWith",(t,e)=>{Zt.init(t,e);let r=new RegExp(`.*${ii(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var F0=N("$ZodCheckOverwrite",(t,e)=>{Zt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Qp=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
3292
3292
|
`).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),a=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...r,i.join(`
|
|
3293
|
-
`))}};var
|
|
3293
|
+
`))}};var j0={major:4,minor:1,patch:13};var Qe=N("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=j0;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let a of i._zod.onattach)a(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(o,s,l)=>{let c=_a(o),u;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(o))continue}else if(c)continue;let m=o.issues.length,p=d._zod.check(o);if(p instanceof Promise&&l?.async===!1)throw new ni;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,o.issues.length!==m&&(c||(c=_a(o,m)))});else{if(o.issues.length===m)continue;c||(c=_a(o,m))}}return u?u.then(()=>o):o},a=(o,s,l)=>{if(_a(o))return o.aborted=!0,o;let c=i(s,n,l);if(c instanceof Promise){if(l.async===!1)throw new ni;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(o,s)=>{if(s.skipChecks)return t._zod.parse(o,s);if(s.direction==="backward"){let c=t._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return c instanceof Promise?c.then(u=>a(u,o,s)):a(c,o,s)}let l=t._zod.parse(o,s);if(l instanceof Promise){if(s.async===!1)throw new ni;return l.then(c=>i(c,n,s))}return i(l,n,s)}}t["~standard"]={validate:i=>{try{let a=Vs(t,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return jc(t,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),Hs=N("$ZodString",(t,e)=>{Qe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??v0(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),dt=N("$ZodStringFormat",(t,e)=>{Uc.init(t,e),Hs.init(t,e)}),Py=N("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=a0),dt.init(t,e)}),Ry=N("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ey(n))}else e.pattern??(e.pattern=Ey());dt.init(t,e)}),Ny=N("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=o0),dt.init(t,e)}),Oy=N("$ZodURL",(t,e)=>{dt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Dy=N("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=s0()),dt.init(t,e)}),My=N("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=n0),dt.init(t,e)}),$y=N("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=YT),dt.init(t,e)}),Ly=N("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=QT),dt.init(t,e)}),zy=N("$ZodULID",(t,e)=>{e.pattern??(e.pattern=e0),dt.init(t,e)}),Fy=N("$ZodXID",(t,e)=>{e.pattern??(e.pattern=t0),dt.init(t,e)}),By=N("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=r0),dt.init(t,e)}),jy=N("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=b0(e)),dt.init(t,e)}),Uy=N("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=f0),dt.init(t,e)}),Gy=N("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=y0(e)),dt.init(t,e)}),Vy=N("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=i0),dt.init(t,e)}),Hy=N("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=l0),dt.init(t,e),t._zod.bag.format="ipv4"}),qy=N("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=c0),dt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Wy=N("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=u0),dt.init(t,e)}),Zy=N("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=d0),dt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,a]=n;if(!a)throw new Error;let o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Y0(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Ky=N("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=p0),dt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Y0(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Bz(t){if(!Ty.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Y0(r)}var Jy=N("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ty),dt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Bz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Xy=N("$ZodE164",(t,e)=>{e.pattern??(e.pattern=m0),dt.init(t,e)});function jz(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var Yy=N("$ZodJWT",(t,e)=>{dt.init(t,e),t._zod.check=r=>{jz(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var rm=N("$ZodNumber",(t,e)=>{Qe.init(t,e),t._zod.pattern=t._zod.bag.pattern??w0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...a?{received:a}:{}}),r}}),Qy=N("$ZodNumberFormat",(t,e)=>{A0.init(t,e),rm.init(t,e)}),nm=N("$ZodBoolean",(t,e)=>{Qe.init(t,e),t._zod.pattern=k0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),eb=N("$ZodBigInt",(t,e)=>{Qe.init(t,e),t._zod.pattern=_0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var tb=N("$ZodNull",(t,e)=>{Qe.init(t,e),t._zod.pattern=x0,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rb=N("$ZodAny",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),nb=N("$ZodUnknown",(t,e)=>{Qe.init(t,e),t._zod.parse=r=>r}),ib=N("$ZodNever",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var ab=N("$ZodDate",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:t}),r}});function U0(t,e,r){t.issues.length&&e.issues.push(...$i(r,t.issues)),e.value[r]=t.value}var ob=N("$ZodArray",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let a=[];for(let o=0;o<i.length;o++){let s=i[o],l=e.element._zod.run({value:s,issues:[]},n);l instanceof Promise?a.push(l.then(c=>U0(c,r,o))):U0(l,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function tm(t,e,r,n){t.issues.length&&e.issues.push(...$i(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function Q0(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=wy(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function eC(t,e,r,n,i,a){let o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type;for(let u in e){if(s.has(u))continue;if(c==="never"){o.push(u);continue}let d=l.run({value:e[u],issues:[]},n);d instanceof Promise?t.push(d.then(m=>tm(m,r,u,e))):tm(d,r,u,e)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:a}),t.length?Promise.all(t).then(()=>r):r}var tC=N("$ZodObject",(t,e)=>{if(Qe.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let l={...s};return Object.defineProperty(e,"shape",{value:l}),l}})}let n=Us(()=>Q0(e));nt(t._zod,"propValues",()=>{let s=e.shape,l={};for(let c in s){let u=s[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(let d of u.values)l[c].add(d)}}return l});let i=ro,a=e.catchall,o;t._zod.parse=(s,l)=>{o??(o=n.value);let c=s.value;if(!i(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),s;s.value={};let u=[],d=o.shape;for(let m of o.keys){let h=d[m]._zod.run({value:c[m],issues:[]},l);h instanceof Promise?u.push(h.then(f=>tm(f,s,m,c))):tm(h,s,m,c)}return a?eC(u,c,s,l,n.value,t):u.length?Promise.all(u).then(()=>s):s}}),rC=N("$ZodObjectJIT",(t,e)=>{tC.init(t,e);let r=t._zod.parse,n=Us(()=>Q0(e)),i=m=>{let p=new Qp(["shape","payload","ctx"]),h=n.value,f=v=>{let I=qp(v);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),g=0;for(let v of h.keys)y[v]=`key_${g++}`;p.write("const newResult = {};");for(let v of h.keys){let I=y[v],T=qp(v);p.write(`const ${I} = ${f(v)};`),p.write(`
|
|
3294
3294
|
if (${I}.issues.length) {
|
|
3295
3295
|
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
3296
3296
|
...iss,
|
|
@@ -3307,11 +3307,11 @@ Assistant:`;Tt.DEFAULT_TIMEOUT=6e5;Tt.AnthropicError=se;Tt.APIError=qt;Tt.APICon
|
|
|
3307
3307
|
newResult[${T}] = ${I}.value;
|
|
3308
3308
|
}
|
|
3309
3309
|
|
|
3310
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");let S=p.compile();return(v,I)=>S(m,v,I)},a,o=ro,s=!jp.jitless,c=s&&by.value,u=e.catchall,d;t._zod.parse=(m,p)=>{d??(d=n.value);let h=m.value;return o(h)?s&&c&&p?.async===!1&&p.jitless!==!0?(a||(a=i(e.shape)),m=a(m,p),u?V0([],h,m,p,d,t):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),m)}});function O0(t,e,r,n){for(let a of t)if(a.issues.length===0)return e.value=a.value,e;let i=t.filter(a=>!_a(a));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(a=>a.issues.map(o=>$n(o,n,pr())))}),e)}var rm=N("$ZodUnion",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),nt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),nt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),nt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>Mc(a.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,a)=>{if(r)return n(i,a);let o=!1,s=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},a);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(l=>O0(l,i,t,a)):O0(s,i,t,a)}}),ab=N("$ZodDiscriminatedUnion",(t,e)=>{rm.init(t,e);let r=t._zod.parse;nt(t._zod,"propValues",()=>{let i={};for(let a of e.options){let o=a._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let[s,l]of Object.entries(o)){i[s]||(i[s]=new Set);for(let c of l)i[s].add(c)}}return i});let n=Us(()=>{let i=e.options,a=new Map;for(let o of i){let s=o._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let l of s){if(a.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);a.set(l,o)}}return a});t._zod.parse=(i,a)=>{let o=i.value;if(!ro(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;let s=n.value.get(o?.[e.discriminator]);return s?s._zod.run(i,a):e.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),i)}}),ob=N("$ZodIntersection",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,a=e.left._zod.run({value:i,issues:[]},n),o=e.right._zod.run({value:i,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([l,c])=>D0(r,l,c)):D0(r,a,o)}});function Cy(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(va(t)&&va(e)){let r=Object.keys(e),n=Object.keys(t).filter(a=>r.indexOf(a)!==-1),i={...t,...e};for(let a of n){let o=Cy(t[a],e[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};i[a]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],a=e[n],o=Cy(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function D0(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),_a(t))return t;let n=Cy(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var sb=N("$ZodRecord",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!va(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let a=[],o=e.keyType._zod.values;if(o){r.value={};let s=new Set;for(let c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){s.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?a.push(u.then(d=>{d.issues.length&&r.issues.push(...$i(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...$i(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)s.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let l=e.keyType._zod.run({value:s,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>$n(u,n,pr())),input:s,path:[s],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[s],issues:[]},n);c instanceof Promise?a.push(c.then(u=>{u.issues.length&&r.issues.push(...$i(s,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...$i(s,c.issues)),r.value[l.value]=c.value)}}return a.length?Promise.all(a).then(()=>r):r}});var lb=N("$ZodEnum",(t,e)=>{Qe.init(t,e);let r=Gp(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>vy.has(typeof i)).map(i=>typeof i=="string"?ii(i):i.toString()).join("|")})$`),t._zod.parse=(i,a)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),cb=N("$ZodLiteral",(t,e)=>{if(Qe.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ii(n):n?ii(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:e.values,input:a,inst:t}),n}});var ub=N("$ZodTransform",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r));if(i instanceof Promise)throw new ni;return r.value=i,r}});function M0(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var db=N("$ZodOptional",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Mc(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>M0(a,r.value)):M0(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),pb=N("$ZodNullable",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Mc(r.source)}|null)$`):void 0}),nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),mb=N("$ZodDefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>$0(a,e)):$0(i,e)}});function $0(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var hb=N("$ZodPrefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),fb=N("$ZodNonOptional",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>L0(a,t)):L0(i,t)}});function L0(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var gb=N("$ZodCatch",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>(r.value=a.value,a.issues.length&&(r.value=e.catchValue({...r,error:{issues:a.issues.map(o=>$n(o,n,pr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>$n(a,n,pr()))},input:r.value}),r.issues=[]),r)}});var yb=N("$ZodPipe",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>e.in._zod.values),nt(t._zod,"optin",()=>e.in._zod.optin),nt(t._zod,"optout",()=>e.out._zod.optout),nt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=e.out._zod.run(r,n);return a instanceof Promise?a.then(o=>Yp(o,e.in,n)):Yp(a,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Yp(a,e.out,n)):Yp(i,e.out,n)}});function Yp(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var bb=N("$ZodReadonly",(t,e)=>{Qe.init(t,e),nt(t._zod,"propValues",()=>e.innerType._zod.propValues),nt(t._zod,"values",()=>e.innerType._zod.values),nt(t._zod,"optin",()=>e.innerType?._zod?.optin),nt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(z0):z0(i)}});function z0(t){return t.value=Object.freeze(t.value),t}var vb=N("$ZodCustom",(t,e)=>{Zt.init(t,e),Qe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(a=>F0(a,r,n,t));F0(i,r,n,t)}});function F0(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Gs(i))}}var Uz=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Gz=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Uz(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${me(n.values[0])}`:`Invalid option: expected one of ${pe(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=e(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=e(n.origin);return a?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${pe(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function _b(){return{localeError:Gz()}}var W0,Z0=Symbol("ZodOutput"),K0=Symbol("ZodInput"),nm=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function wb(){return new nm}(W0=globalThis).__zod_globalRegistry??(W0.__zod_globalRegistry=wb());var Li=globalThis.__zod_globalRegistry;function kb(t,e){return new t({type:"string",...ie(e)})}function xb(t,e){return new t({type:"string",coerce:!0,...ie(e)})}function Eb(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ie(e)})}function im(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ie(e)})}function Tb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(e)})}function Cb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(e)})}function Ib(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(e)})}function Ab(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(e)})}function am(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ie(e)})}function Pb(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(e)})}function Rb(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(e)})}function Nb(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(e)})}function Ob(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(e)})}function Db(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(e)})}function Mb(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ie(e)})}function $b(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(e)})}function Lb(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(e)})}function zb(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(e)})}function Fb(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(e)})}function Bb(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(e)})}function jb(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ie(e)})}function Ub(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(e)})}function Gb(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ie(e)})}function Vb(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(e)})}function Hb(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(e)})}function qb(t,e){return new t({type:"string",format:"date",check:"string_format",...ie(e)})}function Wb(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ie(e)})}function Zb(t,e){return new t({type:"string",format:"duration",check:"string_format",...ie(e)})}function Kb(t,e){return new t({type:"number",checks:[],...ie(e)})}function Jb(t,e){return new t({type:"number",coerce:!0,checks:[],...ie(e)})}function Xb(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(e)})}function Yb(t,e){return new t({type:"boolean",...ie(e)})}function Qb(t,e){return new t({type:"boolean",coerce:!0,...ie(e)})}function ev(t,e){return new t({type:"bigint",coerce:!0,...ie(e)})}function tv(t,e){return new t({type:"null",...ie(e)})}function rv(t){return new t({type:"any"})}function nv(t){return new t({type:"unknown"})}function iv(t,e){return new t({type:"never",...ie(e)})}function av(t,e){return new t({type:"date",coerce:!0,...ie(e)})}function io(t,e){return new Ey({check:"less_than",...ie(e),value:t,inclusive:!1})}function Ln(t,e){return new Ey({check:"less_than",...ie(e),value:t,inclusive:!0})}function ao(t,e){return new Ty({check:"greater_than",...ie(e),value:t,inclusive:!1})}function rn(t,e){return new Ty({check:"greater_than",...ie(e),value:t,inclusive:!0})}function qs(t,e){return new b0({check:"multiple_of",...ie(e),value:t})}function jc(t,e){return new _0({check:"max_length",...ie(e),maximum:t})}function oo(t,e){return new S0({check:"min_length",...ie(e),minimum:t})}function Uc(t,e){return new w0({check:"length_equals",...ie(e),length:t})}function om(t,e){return new k0({check:"string_format",format:"regex",...ie(e),pattern:t})}function sm(t){return new x0({check:"string_format",format:"lowercase",...ie(t)})}function lm(t){return new E0({check:"string_format",format:"uppercase",...ie(t)})}function cm(t,e){return new T0({check:"string_format",format:"includes",...ie(e),includes:t})}function um(t,e){return new C0({check:"string_format",format:"starts_with",...ie(e),prefix:t})}function dm(t,e){return new I0({check:"string_format",format:"ends_with",...ie(e),suffix:t})}function zi(t){return new A0({check:"overwrite",tx:t})}function pm(t){return zi(e=>e.normalize(t))}function mm(){return zi(t=>t.trim())}function hm(){return zi(t=>t.toLowerCase())}function fm(){return zi(t=>t.toUpperCase())}function ov(){return zi(t=>yy(t))}function X0(t,e,r){return new t({type:"array",element:e,...ie(r)})}function sv(t,e,r){let n=ie(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function lv(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ie(r)})}function cv(t){let e=Wz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gs(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(Gs(i))}},t(r.value,r)));return e}function Wz(t,e){let r=new Zt({check:"custom",...ie(e)});return r._zod.check=t,r}function Ws(t){return!!t._zod}function Fn(t,e){return Ws(t)?Vs(t,e):t.safeParse(e)}function gm(t){var e,r;if(!t)return;let n;if(Ws(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function aC(t){var e;if(Ws(t)){let o=(e=t._zod)===null||e===void 0?void 0:e.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let i=t.value;if(i!==void 0)return i}var oC=N("ZodISODateTime",(t,e)=>{Fy.init(t,e),St.init(t,e)});function sC(t){return Hb(oC,t)}var lC=N("ZodISODate",(t,e)=>{By.init(t,e),St.init(t,e)});function cC(t){return qb(lC,t)}var uC=N("ZodISOTime",(t,e)=>{jy.init(t,e),St.init(t,e)});function dC(t){return Wb(uC,t)}var pC=N("ZodISODuration",(t,e)=>{Uy.init(t,e),St.init(t,e)});function mC(t){return Zb(pC,t)}var gC=(t,e)=>{qp.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Zp(t,r)},flatten:{value:r=>Wp(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,js,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,js,2)}},isEmpty:{get(){return t.issues.length===0}}})},rae=N("ZodError",gC),nn=N("ZodError",gC,{Parent:Error});var yC=Kp(nn),bC=Jp(nn),vC=Lc(nn),_C=zc(nn),SC=DT(nn),wC=MT(nn),kC=$T(nn),xC=LT(nn),EC=zT(nn),TC=FT(nn),CC=BT(nn),IC=jT(nn);var pt=N("ZodType",(t,e)=>(Qe.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(U.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>zr(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>yC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>vC(t,r,n),t.parseAsync=async(r,n)=>bC(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>_C(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>SC(t,r,n),t.decode=(r,n)=>wC(t,r,n),t.encodeAsync=async(r,n)=>kC(t,r,n),t.decodeAsync=async(r,n)=>xC(t,r,n),t.safeEncode=(r,n)=>EC(t,r,n),t.safeDecode=(r,n)=>TC(t,r,n),t.safeEncodeAsync=async(r,n)=>CC(t,r,n),t.safeDecodeAsync=async(r,n)=>IC(t,r,n),t.refine=(r,n)=>t.check(CF(r,n)),t.superRefine=r=>t.check(IF(r)),t.overwrite=r=>t.check(zi(r)),t.optional=()=>te(t),t.nullable=()=>RC(t),t.nullish=()=>te(RC(t)),t.nonoptional=r=>SF(t,r),t.array=()=>V(t),t.or=r=>ft([t,r]),t.and=r=>vm(t,r),t.transform=r=>dv(t,BC(r)),t.default=r=>bF(t,r),t.prefault=r=>_F(t,r),t.catch=r=>kF(t,r),t.pipe=r=>dv(t,r),t.readonly=()=>TF(t),t.describe=r=>{let n=t.clone();return Li.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Li.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Li.get(t);let n=t.clone();return Li.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),NC=N("_ZodString",(t,e)=>{Hs.init(t,e),pt.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(om(...n)),t.includes=(...n)=>t.check(cm(...n)),t.startsWith=(...n)=>t.check(um(...n)),t.endsWith=(...n)=>t.check(dm(...n)),t.min=(...n)=>t.check(oo(...n)),t.max=(...n)=>t.check(jc(...n)),t.length=(...n)=>t.check(Uc(...n)),t.nonempty=(...n)=>t.check(oo(1,...n)),t.lowercase=n=>t.check(sm(n)),t.uppercase=n=>t.check(lm(n)),t.trim=()=>t.check(mm()),t.normalize=(...n)=>t.check(pm(...n)),t.toLowerCase=()=>t.check(hm()),t.toUpperCase=()=>t.check(fm()),t.slugify=()=>t.check(ov())}),pv=N("ZodString",(t,e)=>{Hs.init(t,e),NC.init(t,e),t.email=r=>t.check(Eb(U2,r)),t.url=r=>t.check(am(OC,r)),t.jwt=r=>t.check(Vb(nF,r)),t.emoji=r=>t.check(Pb(G2,r)),t.guid=r=>t.check(im(AC,r)),t.uuid=r=>t.check(Tb(ym,r)),t.uuidv4=r=>t.check(Cb(ym,r)),t.uuidv6=r=>t.check(Ib(ym,r)),t.uuidv7=r=>t.check(Ab(ym,r)),t.nanoid=r=>t.check(Rb(V2,r)),t.guid=r=>t.check(im(AC,r)),t.cuid=r=>t.check(Nb(H2,r)),t.cuid2=r=>t.check(Ob(q2,r)),t.ulid=r=>t.check(Db(W2,r)),t.base64=r=>t.check(jb(eF,r)),t.base64url=r=>t.check(Ub(tF,r)),t.xid=r=>t.check(Mb(Z2,r)),t.ksuid=r=>t.check($b(K2,r)),t.ipv4=r=>t.check(Lb(J2,r)),t.ipv6=r=>t.check(zb(X2,r)),t.cidrv4=r=>t.check(Fb(Y2,r)),t.cidrv6=r=>t.check(Bb(Q2,r)),t.e164=r=>t.check(Gb(rF,r)),t.datetime=r=>t.check(sC(r)),t.date=r=>t.check(cC(r)),t.time=r=>t.check(dC(r)),t.duration=r=>t.check(mC(r))});function k(t){return kb(pv,t)}var St=N("ZodStringFormat",(t,e)=>{dt.init(t,e),NC.init(t,e)}),U2=N("ZodEmail",(t,e)=>{Py.init(t,e),St.init(t,e)});var AC=N("ZodGUID",(t,e)=>{Iy.init(t,e),St.init(t,e)});var ym=N("ZodUUID",(t,e)=>{Ay.init(t,e),St.init(t,e)});var OC=N("ZodURL",(t,e)=>{Ry.init(t,e),St.init(t,e)});function DC(t){return am(OC,t)}var G2=N("ZodEmoji",(t,e)=>{Ny.init(t,e),St.init(t,e)});var V2=N("ZodNanoID",(t,e)=>{Oy.init(t,e),St.init(t,e)});var H2=N("ZodCUID",(t,e)=>{Dy.init(t,e),St.init(t,e)});var q2=N("ZodCUID2",(t,e)=>{My.init(t,e),St.init(t,e)});var W2=N("ZodULID",(t,e)=>{$y.init(t,e),St.init(t,e)});var Z2=N("ZodXID",(t,e)=>{Ly.init(t,e),St.init(t,e)});var K2=N("ZodKSUID",(t,e)=>{zy.init(t,e),St.init(t,e)});var J2=N("ZodIPv4",(t,e)=>{Gy.init(t,e),St.init(t,e)});var X2=N("ZodIPv6",(t,e)=>{Vy.init(t,e),St.init(t,e)});var Y2=N("ZodCIDRv4",(t,e)=>{Hy.init(t,e),St.init(t,e)});var Q2=N("ZodCIDRv6",(t,e)=>{qy.init(t,e),St.init(t,e)});var eF=N("ZodBase64",(t,e)=>{Wy.init(t,e),St.init(t,e)});var tF=N("ZodBase64URL",(t,e)=>{Zy.init(t,e),St.init(t,e)});var rF=N("ZodE164",(t,e)=>{Ky.init(t,e),St.init(t,e)});var nF=N("ZodJWT",(t,e)=>{Jy.init(t,e),St.init(t,e)});var bm=N("ZodNumber",(t,e)=>{em.init(t,e),pt.init(t,e),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.int=n=>t.check(PC(n)),t.safe=n=>t.check(PC(n)),t.positive=n=>t.check(ao(0,n)),t.nonnegative=n=>t.check(rn(0,n)),t.negative=n=>t.check(io(0,n)),t.nonpositive=n=>t.check(Ln(0,n)),t.multipleOf=(n,i)=>t.check(qs(n,i)),t.step=(n,i)=>t.check(qs(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function et(t){return Kb(bm,t)}var iF=N("ZodNumberFormat",(t,e)=>{Xy.init(t,e),bm.init(t,e)});function PC(t){return Xb(iF,t)}var mv=N("ZodBoolean",(t,e)=>{tm.init(t,e),pt.init(t,e)});function mt(t){return Yb(mv,t)}var MC=N("ZodBigInt",(t,e)=>{Yy.init(t,e),pt.init(t,e),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.positive=n=>t.check(ao(BigInt(0),n)),t.negative=n=>t.check(io(BigInt(0),n)),t.nonpositive=n=>t.check(Ln(BigInt(0),n)),t.nonnegative=n=>t.check(rn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(qs(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var aF=N("ZodNull",(t,e)=>{Qy.init(t,e),pt.init(t,e)});function hv(t){return tv(aF,t)}var oF=N("ZodAny",(t,e)=>{eb.init(t,e),pt.init(t,e)});function $C(){return rv(oF)}var sF=N("ZodUnknown",(t,e)=>{tb.init(t,e),pt.init(t,e)});function Ut(){return nv(sF)}var lF=N("ZodNever",(t,e)=>{rb.init(t,e),pt.init(t,e)});function cF(t){return iv(lF,t)}var LC=N("ZodDate",(t,e)=>{nb.init(t,e),pt.init(t,e),t.min=(n,i)=>t.check(rn(n,i)),t.max=(n,i)=>t.check(Ln(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var uF=N("ZodArray",(t,e)=>{ib.init(t,e),pt.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(oo(r,n)),t.nonempty=r=>t.check(oo(1,r)),t.max=(r,n)=>t.check(jc(r,n)),t.length=(r,n)=>t.check(Uc(r,n)),t.unwrap=()=>t.element});function V(t,e){return X0(uF,t,e)}var zC=N("ZodObject",(t,e)=>{q0.init(t,e),pt.init(t,e),U.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>hr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ut()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ut()}),t.strict=()=>t.clone({...t._zod.def,catchall:cF()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>U.extend(t,r),t.safeExtend=r=>U.safeExtend(t,r),t.merge=r=>U.merge(t,r),t.pick=r=>U.pick(t,r),t.omit=r=>U.omit(t,r),t.partial=(...r)=>U.partial(jC,t,r[0]),t.required=(...r)=>U.required(UC,t,r[0])});function F(t,e){let r={type:"object",shape:t??{},...U.normalizeParams(e)};return new zC(r)}function mr(t,e){return new zC({type:"object",shape:t,catchall:Ut(),...U.normalizeParams(e)})}var FC=N("ZodUnion",(t,e)=>{rm.init(t,e),pt.init(t,e),t.options=e.options});function ft(t,e){return new FC({type:"union",options:t,...U.normalizeParams(e)})}var dF=N("ZodDiscriminatedUnion",(t,e)=>{FC.init(t,e),ab.init(t,e)});function fv(t,e,r){return new dF({type:"union",options:e,discriminator:t,...U.normalizeParams(r)})}var pF=N("ZodIntersection",(t,e)=>{ob.init(t,e),pt.init(t,e)});function vm(t,e){return new pF({type:"intersection",left:t,right:e})}var mF=N("ZodRecord",(t,e)=>{sb.init(t,e),pt.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Gt(t,e,r){return new mF({type:"record",keyType:t,valueType:e,...U.normalizeParams(r)})}var uv=N("ZodEnum",(t,e)=>{lb.init(t,e),pt.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new uv({...e,checks:[],...U.normalizeParams(i),entries:a})},t.exclude=(n,i)=>{let a={...e.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new uv({...e,checks:[],...U.normalizeParams(i),entries:a})}});function hr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new uv({type:"enum",entries:r,...U.normalizeParams(e)})}var hF=N("ZodLiteral",(t,e)=>{cb.init(t,e),pt.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ee(t,e){return new hF({type:"literal",values:Array.isArray(t)?t:[t],...U.normalizeParams(e)})}var fF=N("ZodTransform",(t,e)=>{ub.init(t,e),pt.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(U.issue(a,r.value,e));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),r.issues.push(U.issue(o))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function BC(t){return new fF({type:"transform",transform:t})}var jC=N("ZodOptional",(t,e)=>{db.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function te(t){return new jC({type:"optional",innerType:t})}var gF=N("ZodNullable",(t,e)=>{pb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function RC(t){return new gF({type:"nullable",innerType:t})}var yF=N("ZodDefault",(t,e)=>{mb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function bF(t,e){return new yF({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var vF=N("ZodPrefault",(t,e)=>{hb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function _F(t,e){return new vF({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var UC=N("ZodNonOptional",(t,e)=>{fb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function SF(t,e){return new UC({type:"nonoptional",innerType:t,...U.normalizeParams(e)})}var wF=N("ZodCatch",(t,e)=>{gb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function kF(t,e){return new wF({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var xF=N("ZodPipe",(t,e)=>{yb.init(t,e),pt.init(t,e),t.in=e.in,t.out=e.out});function dv(t,e){return new xF({type:"pipe",in:t,out:e})}var EF=N("ZodReadonly",(t,e)=>{bb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function TF(t){return new EF({type:"readonly",innerType:t})}var GC=N("ZodCustom",(t,e)=>{vb.init(t,e),pt.init(t,e)});function VC(t,e){return sv(GC,t??(()=>!0),e)}function CF(t,e={}){return lv(GC,t,e)}function IF(t){return cv(t)}function gv(t,e){return dv(BC(t),e)}var qC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var HC;HC||(HC={});var _m={};Xd(_m,{bigint:()=>NF,boolean:()=>RF,date:()=>OF,number:()=>PF,string:()=>AF});function AF(t){return xb(pv,t)}function PF(t){return Jb(bm,t)}function RF(t){return Qb(mv,t)}function NF(t){return ev(MC,t)}function OF(t){return av(LC,t)}pr(_b());var Ks="2025-11-25";var ZC=[Ks,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oi="io.modelcontextprotocol/related-task",wm="2.0",ai=VC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),KC=ft([k(),et().int()]),JC=k(),MF=mr({ttl:ft([et(),hv()]).optional(),pollInterval:et().optional()}),bv=mr({taskId:k()}),$F=mr({progressToken:KC.optional(),[oi]:bv.optional()}),Fr=mr({task:MF.optional(),_meta:$F.optional()}),tr=F({method:k(),params:Fr.optional()}),so=mr({_meta:F({[oi]:te(bv)}).passthrough().optional()}),vn=F({method:k(),params:so.optional()}),fr=mr({_meta:mr({[oi]:bv.optional()}).optional()}),km=ft([k(),et().int()]),XC=F({jsonrpc:ee(wm),id:km,...tr.shape}).strict(),Gc=t=>XC.safeParse(t).success,YC=F({jsonrpc:ee(wm),...vn.shape}).strict(),QC=t=>YC.safeParse(t).success,eI=F({jsonrpc:ee(wm),id:km,result:fr}).strict(),lo=t=>eI.safeParse(t).success,he;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(he||(he={}));var tI=F({jsonrpc:ee(wm),id:km,error:F({code:et().int(),message:k(),data:te(Ut())})}).strict(),rI=t=>tI.safeParse(t).success,Js=ft([XC,YC,eI,tI]),co=fr.strict(),LF=so.extend({requestId:km,reason:k().optional()}),xm=vn.extend({method:ee("notifications/cancelled"),params:LF}),zF=F({src:k(),mimeType:k().optional(),sizes:V(k()).optional()}),Vc=F({icons:V(zF).optional()}),Zs=F({name:k(),title:k().optional()}),nI=Zs.extend({...Zs.shape,...Vc.shape,version:k(),websiteUrl:k().optional()}),FF=vm(F({applyDefaults:mt().optional()}),Gt(k(),Ut())),BF=gv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,vm(F({form:FF.optional(),url:ai.optional()}),Gt(k(),Ut()).optional())),jF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({sampling:te(F({createMessage:te(F({}).passthrough())}).passthrough()),elicitation:te(F({create:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),UF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({tools:te(F({call:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),GF=F({experimental:Gt(k(),ai).optional(),sampling:F({context:ai.optional(),tools:ai.optional()}).optional(),elicitation:BF.optional(),roots:F({listChanged:mt().optional()}).optional(),tasks:te(jF)}),VF=Fr.extend({protocolVersion:k(),capabilities:GF,clientInfo:nI}),HF=tr.extend({method:ee("initialize"),params:VF});var qF=F({experimental:Gt(k(),ai).optional(),logging:ai.optional(),completions:ai.optional(),prompts:te(F({listChanged:te(mt())})),resources:F({subscribe:mt().optional(),listChanged:mt().optional()}).optional(),tools:F({listChanged:mt().optional()}).optional(),tasks:te(UF)}).passthrough(),vv=fr.extend({protocolVersion:k(),capabilities:qF,serverInfo:nI,instructions:k().optional()}),iI=vn.extend({method:ee("notifications/initialized")}),aI=t=>iI.safeParse(t).success,Em=tr.extend({method:ee("ping")}),WF=F({progress:et(),total:te(et()),message:te(k())}),ZF=F({...so.shape,...WF.shape,progressToken:KC}),Tm=vn.extend({method:ee("notifications/progress"),params:ZF}),KF=Fr.extend({cursor:JC.optional()}),Hc=tr.extend({params:KF.optional()}),qc=fr.extend({nextCursor:te(JC)}),Wc=F({taskId:k(),status:hr(["working","input_required","completed","failed","cancelled"]),ttl:ft([et(),hv()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:te(et()),statusMessage:te(k())}),uo=fr.extend({task:Wc}),JF=so.merge(Wc),Zc=vn.extend({method:ee("notifications/tasks/status"),params:JF}),Cm=tr.extend({method:ee("tasks/get"),params:Fr.extend({taskId:k()})}),Im=fr.merge(Wc),Am=tr.extend({method:ee("tasks/result"),params:Fr.extend({taskId:k()})}),Pm=Hc.extend({method:ee("tasks/list")}),Rm=qc.extend({tasks:V(Wc)}),oI=tr.extend({method:ee("tasks/cancel"),params:Fr.extend({taskId:k()})}),sI=fr.merge(Wc),lI=F({uri:k(),mimeType:te(k()),_meta:Gt(k(),Ut()).optional()}),cI=lI.extend({text:k()}),_v=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),uI=lI.extend({blob:_v}),dI=F({...Zs.shape,...Vc.shape,uri:k(),description:te(k()),mimeType:te(k()),_meta:te(mr({}))}),XF=F({...Zs.shape,...Vc.shape,uriTemplate:k(),description:te(k()),mimeType:te(k()),_meta:te(mr({}))}),YF=Hc.extend({method:ee("resources/list")}),Sv=qc.extend({resources:V(dI)}),QF=Hc.extend({method:ee("resources/templates/list")}),wv=qc.extend({resourceTemplates:V(XF)}),kv=Fr.extend({uri:k()}),eB=kv,tB=tr.extend({method:ee("resources/read"),params:eB}),xv=fr.extend({contents:V(ft([cI,uI]))}),rB=vn.extend({method:ee("notifications/resources/list_changed")}),nB=kv,iB=tr.extend({method:ee("resources/subscribe"),params:nB}),aB=kv,oB=tr.extend({method:ee("resources/unsubscribe"),params:aB}),sB=so.extend({uri:k()}),lB=vn.extend({method:ee("notifications/resources/updated"),params:sB}),cB=F({name:k(),description:te(k()),required:te(mt())}),uB=F({...Zs.shape,...Vc.shape,description:te(k()),arguments:te(V(cB)),_meta:te(mr({}))}),dB=Hc.extend({method:ee("prompts/list")}),Ev=qc.extend({prompts:V(uB)}),pB=Fr.extend({name:k(),arguments:Gt(k(),k()).optional()}),mB=tr.extend({method:ee("prompts/get"),params:pB}),Tv=F({type:ee("text"),text:k(),_meta:Gt(k(),Ut()).optional()}),Cv=F({type:ee("image"),data:_v,mimeType:k(),_meta:Gt(k(),Ut()).optional()}),Iv=F({type:ee("audio"),data:_v,mimeType:k(),_meta:Gt(k(),Ut()).optional()}),hB=F({type:ee("tool_use"),name:k(),id:k(),input:F({}).passthrough(),_meta:te(F({}).passthrough())}).passthrough(),fB=F({type:ee("resource"),resource:ft([cI,uI]),_meta:Gt(k(),Ut()).optional()}),gB=dI.extend({type:ee("resource_link")}),Av=ft([Tv,Cv,Iv,gB,fB]),yB=F({role:hr(["user","assistant"]),content:Av}),Pv=fr.extend({description:te(k()),messages:V(yB)}),bB=vn.extend({method:ee("notifications/prompts/list_changed")}),vB=F({title:k().optional(),readOnlyHint:mt().optional(),destructiveHint:mt().optional(),idempotentHint:mt().optional(),openWorldHint:mt().optional()}),_B=F({taskSupport:hr(["required","optional","forbidden"]).optional()}),pI=F({...Zs.shape,...Vc.shape,description:k().optional(),inputSchema:F({type:ee("object"),properties:Gt(k(),ai).optional(),required:V(k()).optional()}).catchall(Ut()),outputSchema:F({type:ee("object"),properties:Gt(k(),ai).optional(),required:V(k()).optional()}).catchall(Ut()).optional(),annotations:te(vB),execution:te(_B),_meta:Gt(k(),Ut()).optional()}),SB=Hc.extend({method:ee("tools/list")}),Rv=qc.extend({tools:V(pI)}),Xs=fr.extend({content:V(Av).default([]),structuredContent:Gt(k(),Ut()).optional(),isError:te(mt())}),wae=Xs.or(fr.extend({toolResult:Ut()})),wB=Fr.extend({name:k(),arguments:te(Gt(k(),Ut()))}),kB=tr.extend({method:ee("tools/call"),params:wB}),Nv=vn.extend({method:ee("notifications/tools/list_changed")}),mI=hr(["debug","info","notice","warning","error","critical","alert","emergency"]),xB=Fr.extend({level:mI}),EB=tr.extend({method:ee("logging/setLevel"),params:xB}),TB=so.extend({level:mI,logger:k().optional(),data:Ut()}),Ov=vn.extend({method:ee("notifications/message"),params:TB}),CB=F({name:k().optional()}),IB=F({hints:te(V(CB)),costPriority:te(et().min(0).max(1)),speedPriority:te(et().min(0).max(1)),intelligencePriority:te(et().min(0).max(1))}),AB=F({mode:te(hr(["auto","required","none"]))}),PB=F({type:ee("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:V(Av).default([]),structuredContent:F({}).passthrough().optional(),isError:te(mt()),_meta:te(F({}).passthrough())}).passthrough(),RB=fv("type",[Tv,Cv,Iv]),Sm=fv("type",[Tv,Cv,Iv,hB,PB]),NB=F({role:hr(["user","assistant"]),content:ft([Sm,V(Sm)]),_meta:te(F({}).passthrough())}).passthrough(),OB=Fr.extend({messages:V(NB),modelPreferences:IB.optional(),systemPrompt:k().optional(),includeContext:hr(["none","thisServer","allServers"]).optional(),temperature:et().optional(),maxTokens:et().int(),stopSequences:V(k()).optional(),metadata:ai.optional(),tools:te(V(pI)),toolChoice:te(AB)}),Dv=tr.extend({method:ee("sampling/createMessage"),params:OB}),Mv=fr.extend({model:k(),stopReason:te(hr(["endTurn","stopSequence","maxTokens"]).or(k())),role:hr(["user","assistant"]),content:RB}),DB=fr.extend({model:k(),stopReason:te(hr(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:hr(["user","assistant"]),content:ft([Sm,V(Sm)])}),MB=F({type:ee("boolean"),title:k().optional(),description:k().optional(),default:mt().optional()}),$B=F({type:ee("string"),title:k().optional(),description:k().optional(),minLength:et().optional(),maxLength:et().optional(),format:hr(["email","uri","date","date-time"]).optional(),default:k().optional()}),LB=F({type:hr(["number","integer"]),title:k().optional(),description:k().optional(),minimum:et().optional(),maximum:et().optional(),default:et().optional()}),zB=F({type:ee("string"),title:k().optional(),description:k().optional(),enum:V(k()),default:k().optional()}),FB=F({type:ee("string"),title:k().optional(),description:k().optional(),oneOf:V(F({const:k(),title:k()})),default:k().optional()}),BB=F({type:ee("string"),title:k().optional(),description:k().optional(),enum:V(k()),enumNames:V(k()).optional(),default:k().optional()}),jB=ft([zB,FB]),UB=F({type:ee("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({type:ee("string"),enum:V(k())}),default:V(k()).optional()}),GB=F({type:ee("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({anyOf:V(F({const:k(),title:k()}))}),default:V(k()).optional()}),VB=ft([UB,GB]),HB=ft([BB,jB,VB]),qB=ft([HB,MB,$B,LB]),WB=Fr.extend({mode:ee("form").optional(),message:k(),requestedSchema:F({type:ee("object"),properties:Gt(k(),qB),required:V(k()).optional()})}),ZB=Fr.extend({mode:ee("url"),message:k(),elicitationId:k(),url:k().url()}),KB=ft([WB,ZB]),$v=tr.extend({method:ee("elicitation/create"),params:KB}),JB=so.extend({elicitationId:k()}),XB=vn.extend({method:ee("notifications/elicitation/complete"),params:JB}),Lv=fr.extend({action:hr(["accept","decline","cancel"]),content:gv(t=>t===null?void 0:t,Gt(k(),ft([k(),et(),mt(),V(k())])).optional())}),YB=F({type:ee("ref/resource"),uri:k()});var QB=F({type:ee("ref/prompt"),name:k()}),ej=Fr.extend({ref:ft([QB,YB]),argument:F({name:k(),value:k()}),context:F({arguments:Gt(k(),k()).optional()}).optional()}),tj=tr.extend({method:ee("completion/complete"),params:ej});var zv=fr.extend({completion:mr({values:V(k()).max(100),total:te(et().int()),hasMore:te(mt())})}),rj=F({uri:k().startsWith("file://"),name:k().optional(),_meta:Gt(k(),Ut()).optional()}),nj=tr.extend({method:ee("roots/list")}),ij=fr.extend({roots:V(rj)}),aj=vn.extend({method:ee("notifications/roots/list_changed")}),kae=ft([Em,HF,tj,EB,mB,dB,YF,QF,tB,iB,oB,kB,SB,Cm,Am,Pm]),xae=ft([xm,Tm,iI,aj,Zc]),Eae=ft([co,Mv,DB,Lv,ij,Im,Rm,uo]),Tae=ft([Em,Dv,$v,nj,Cm,Am,Pm]),Cae=ft([xm,Tm,Ov,lB,rB,Nv,bB,Zc,XB]),Iae=ft([co,vv,zv,Pv,Ev,Sv,wv,xv,Xs,Rv,Im,Rm,uo]),le=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===he.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new yv(i.elicitations,r)}return new t(e,r,n)}},yv=class extends le{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(he.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function Sa(t){return t==="completed"||t==="failed"||t==="cancelled"}var oj=Symbol("Let zodToJsonSchema decide on which parser to use");var loe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Fv(t){let e=gm(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=aC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Bv(t,e){let r=Fn(t,e);if(!r.success)throw r.error;return r.data}var pj=6e4,Nm=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(xm,r=>{this._oncancel(r)}),this.setNotificationHandler(Tm,r=>{this._onprogress(r)}),this.setRequestHandler(Em,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Cm,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Am,async(r,n)=>{let i=async()=>{var a;let o=r.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(l.type==="response"||l.type==="error"){let c=l.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),l.type==="response")d(c);else{let m=c,p=new le(m.error.code,m.error.message,m.error.data);d(p)}else{let m=l.type==="response"?"Response":"Error";this._onerror(new Error(`${m} handler missing for request ${u}`))}continue}await((a=this._transport)===null||a===void 0?void 0:a.send(l.message,{relatedRequestId:n.requestId}))}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new le(he.InvalidParams,`Task not found: ${o}`);if(!Sa(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(Sa(s.status)){let l=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...l,_meta:{...l._meta,[oi]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Pm,async(r,n)=>{var i;try{let{tasks:a,nextCursor:o}=await this._taskStore.listTasks((i=r.params)===null||i===void 0?void 0:i.cursor,n.sessionId);return{tasks:a,nextCursor:o,_meta:{}}}catch(a){throw new le(he.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(oI,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,`Task not found: ${r.params.taskId}`);if(Sa(i.status))throw new le(he.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new le(he.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof le?i:new le(he.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),le.fromError(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=l=>{o?.(l),this._onerror(l)};let s=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(l,c)=>{s?.(l,c),lo(l)||rI(l)?this._onresponse(l):Gc(l)?this._onrequest(l,c):QC(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=le.fromError(he.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i,a,o,s,l;let c=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,u=this._transport,d=(o=(a=(i=e.params)===null||i===void 0?void 0:i._meta)===null||a===void 0?void 0:a[oi])===null||o===void 0?void 0:o.taskId;if(c===void 0){let y={jsonrpc:"2.0",id:e.id,error:{code:he.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:y,timestamp:Date.now()},u?.sessionId).catch(g=>this._onerror(new Error(`Failed to enqueue error response: ${g}`))):u?.send(y).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)));return}let m=new AbortController;this._requestHandlerAbortControllers.set(e.id,m);let p=(s=e.params)===null||s===void 0?void 0:s.task,h=this._taskStore?this.requestTaskStore(e,u?.sessionId):void 0,f={signal:m.signal,sessionId:u?.sessionId,_meta:(l=e.params)===null||l===void 0?void 0:l._meta,sendNotification:async y=>{let g={relatedRequestId:e.id};d&&(g.relatedTask={taskId:d}),await this.notification(y,g)},sendRequest:async(y,g,S)=>{var v,I;let T={...S,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let C=(I=(v=T.relatedTask)===null||v===void 0?void 0:v.taskId)!==null&&I!==void 0?I:d;return C&&h&&await h.updateTaskStatus(C,"input_required"),await this.request(y,g,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:h,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>c(e,f)).then(async y=>{if(m.signal.aborted)return;let g={result:y,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:g,timestamp:Date.now()},u?.sessionId):await u?.send(g)},async y=>{var g;if(m.signal.aborted)return;let S={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(y.code)?y.code:he.InternalError,message:(g=y.message)!==null&&g!==void 0?g:"Internal error",...y.data!==void 0&&{data:y.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:S,timestamp:Date.now()},u?.sessionId):await u?.send(S)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(l);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),lo(e))n(e);else{let o=new le(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(lo(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),lo(e))i(e);else{let o=le.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var i,a,o,s;let{task:l}=n??{};if(!l){try{yield{type:"result",result:await this.request(e,r,n)}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}return}let c;try{let u=await this.request(e,uo,n);if(u.task)c=u.task.taskId,yield{type:"taskCreated",task:u.task};else throw new le(he.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:c},n);if(yield{type:"taskStatus",task:d},Sa(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)}:d.status==="failed"?yield{type:"error",error:new le(he.InternalError,`Task ${c} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new le(he.InternalError,`Task ${c} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)};return}let m=(o=(i=d.pollInterval)!==null&&i!==void 0?i:(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;await new Promise(p=>setTimeout(p,m)),(s=n?.signal)===null||s===void 0||s.throwIfAborted()}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:l}=n??{};return new Promise((c,u)=>{var d,m,p,h,f,y,g;let S=M=>{u(M)};if(!this._transport){S(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(M){S(M);return}(m=n?.signal)===null||m===void 0||m.throwIfAborted();let v=this._requestMessageId++,I={...e,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),I.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:v}}),s&&(I.params={...I.params,task:s}),l&&(I.params={...I.params,_meta:{...((h=I.params)===null||h===void 0?void 0:h._meta)||{},[oi]:l}});let T=M=>{var B;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(M)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(H=>this._onerror(new Error(`Failed to send cancellation: ${H}`)));let Y=M instanceof le?M:new le(he.RequestTimeout,String(M));u(Y)};this._responseHandlers.set(v,M=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if(M instanceof Error)return u(M);try{let Y=Fn(r,M.result);Y.success?c(Y.data):u(Y.error)}catch(Y){u(Y)}}}),(f=n?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var M;T((M=n?.signal)===null||M===void 0?void 0:M.reason)});let C=(y=n?.timeout)!==null&&y!==void 0?y:pj,$=()=>T(le.fromError(he.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(v,C,n?.maxTotalTimeout,$,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1);let W=l?.taskId;if(W){let M=B=>{let Y=this._responseHandlers.get(v);Y?Y(B):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,M),this._enqueueTaskMessage(W,{type:"request",message:I,timestamp:Date.now()}).catch(B=>{this._cleanupTimeout(v),u(B)})}else this._transport.send(I,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(M=>{this._cleanupTimeout(v),u(M)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Im,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Rm,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},sI,r)}async notification(e,r){var n,i,a,o,s;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let l=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(l){let m={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((i=e.params)===null||i===void 0?void 0:i._meta)||{},[oi]:r.relatedTask}}};await this._enqueueTaskMessage(l,{type:"notification",message:m,timestamp:Date.now()});return}if(((o=(a=this._options)===null||a===void 0?void 0:a.debouncedNotificationMethods)!==null&&o!==void 0?o:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var m,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let h={...e,jsonrpc:"2.0"};r?.relatedTask&&(h={...h,params:{...h.params,_meta:{...((m=h.params)===null||m===void 0?void 0:m._meta)||{},[oi]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(h,r).catch(f=>this._onerror(f))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((s=d.params)===null||s===void 0?void 0:s._meta)||{},[oi]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=Fv(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=Bv(e,i);return Promise.resolve(r(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Fv(e);this._notificationHandlers.set(n,i=>{let a=Bv(e,i);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var i;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let a=(i=this._options)===null||i===void 0?void 0:i.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,a)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&Gc(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new le(he.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,i,a;let o=(i=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;try{let s=await((a=this._taskStore)===null||a===void 0?void 0:a.getTask(e));s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,l)=>{if(r.aborted){l(new le(he.InvalidRequest,"Request cancelled"));return}let c=setTimeout(s,o);r.addEventListener("abort",()=>{clearTimeout(c),l(new le(he.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let l=Zc.parse({method:"notifications/tasks/status",params:s});await this.notification(l),Sa(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new le(he.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Sa(s.status))throw new le(he.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let l=await n.getTask(i,r);if(l){let c=Zc.parse({method:"notifications/tasks/status",params:l});await this.notification(c),Sa(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function hI(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function fI(t,e){let r={...t};for(let n in e){let i=n,a=e[i];if(a===void 0)continue;let o=r[i];hI(o)&&hI(a)?r[i]={...o,...a}:r[i]=a}return r}var gO=Yd(jP(),1),yO=Yd(fO(),1);function K5(){let t=new gO.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,yO.default)(t),t}var qh=class{constructor(e){this._ajv=e??K5()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Wh=class{constructor(e){this._client=e}async*callToolStream(e,r=Xs,n){var i;let a=this._client,o={...n,task:(i=n?.task)!==null&&i!==void 0?i:a.isToolTask(e.name)?{}:void 0},s=a.requestStream({method:"tools/call",params:e},r,o),l=a.getToolOutputValidator(e.name);for await(let c of s){if(c.type==="result"&&l){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let d=l(u.structuredContent);if(!d.valid){yield{type:"error",error:new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof le){yield{type:"error",error:d};return}yield{type:"error",error:new le(he.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function bO(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function vO(t,e,r){var n,i;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((i=t.elicitation)===null||i===void 0)&&i.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Zh(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let a=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[i]=a.default),r[i]!==void 0&&Zh(a,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Zh(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Zh(r,e)}}function J5(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var ed=class extends Nm{constructor(e,r){var n,i;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(i=r?.jsonSchemaValidator)!==null&&i!==void 0?i:new qh}get experimental(){return this._experimental||(this._experimental={tasks:new Wh(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=fI(this._capabilities,e)}setRequestHandler(e,r){var n,i,a;let o=gm(e),s=o?.method;if(!s)throw new Error("Schema is missing a method literal");let l;if(Ws(s)){let u=s,d=(n=u._zod)===null||n===void 0?void 0:n.def;l=(i=d?.value)!==null&&i!==void 0?i:u.value}else{let u=s,d=u._def;l=(a=d?.value)!==null&&a!==void 0?a:u.value}if(typeof l!="string")throw new Error("Schema method literal must be a string");let c=l;if(c==="elicitation/create"){let u=async(d,m)=>{var p,h,f;let y=Fn($v,d);if(!y.success){let M=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid elicitation request: ${M}`)}let{params:g}=y.data,S=(p=g.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:v,supportsUrlMode:I}=J5(this._capabilities.elicitation);if(S==="form"&&!v)throw new le(he.InvalidParams,"Client does not support form-mode elicitation requests");if(S==="url"&&!I)throw new le(he.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,m));if(g.task){let M=Fn(uo,T);if(!M.success){let B=M.error instanceof Error?M.error.message:String(M.error);throw new le(he.InvalidParams,`Invalid task creation result: ${B}`)}return M.data}let C=Fn(Lv,T);if(!C.success){let M=C.error instanceof Error?C.error.message:String(C.error);throw new le(he.InvalidParams,`Invalid elicitation result: ${M}`)}let $=C.data,W=S==="form"?g.requestedSchema:void 0;if(S==="form"&&$.action==="accept"&&$.content&&W&&!((f=(h=this._capabilities.elicitation)===null||h===void 0?void 0:h.form)===null||f===void 0)&&f.applyDefaults)try{Zh(W,$.content)}catch{}return $};return super.setRequestHandler(e,u)}if(c==="sampling/createMessage"){let u=async(d,m)=>{let p=Fn(Dv,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new le(he.InvalidParams,`Invalid sampling request: ${g}`)}let{params:h}=p.data,f=await Promise.resolve(r(d,m));if(h.task){let g=Fn(uo,f);if(!g.success){let S=g.error instanceof Error?g.error.message:String(g.error);throw new le(he.InvalidParams,`Invalid task creation result: ${S}`)}return g.data}let y=Fn(Mv,f);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid sampling result: ${g}`)}return y.data};return super.setRequestHandler(e,u)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Ks,capabilities:this._capabilities,clientInfo:this._clientInfo}},vv,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!ZC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,a,o;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;bO((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&vO((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},co,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},zv,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},co,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Pv,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Ev,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Sv,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},wv,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},xv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},co,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},co,r)}async callTool(e,r=Xs,n){if(this.isToolTaskRequired(e.name))throw new le(he.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),a=this.getToolOutputValidator(e.name);if(a){if(!i.structuredContent&&!i.isError)throw new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let o=a(i.structuredContent);if(!o.valid)throw new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${o.errorMessage}`)}catch(o){throw o instanceof le?o:new le(he.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return i}isToolTask(e){var r,n,i,a;return!((a=(i=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||i===void 0?void 0:i.tools)===null||a===void 0)&&a.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let a=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,a)}let i=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(i==="required"||i==="optional")&&this._cachedKnownTaskTools.add(n.name),i==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},Rv,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function Tl(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Kh(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...Tl(e.headers),...Tl(n.headers)}:e.headers};return t(r,i)}:t}var ck;ck=globalThis.crypto;async function X5(t){return(await ck).getRandomValues(new Uint8Array(t))}async function Y5(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await X5(t);for(let i=0;i<t;i++){let a=n[i]%e.length;r+=e[a]}return r}async function Q5(t){return await Y5(t)}async function e9(t){let e=await(await ck).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function uk(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await Q5(t),r=await e9(e);return{code_verifier:e,code_challenge:r}}var lr=DC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:qC.custom,message:"URL must be parseable",fatal:!0}),Up}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),SO=mr({resource:k().url(),authorization_servers:V(lr).optional(),jwks_uri:k().url().optional(),scopes_supported:V(k()).optional(),bearer_methods_supported:V(k()).optional(),resource_signing_alg_values_supported:V(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:V(k()).optional(),dpop_signing_alg_values_supported:V(k()).optional(),dpop_bound_access_tokens_required:mt().optional()}),dk=mr({issuer:k(),authorization_endpoint:lr,token_endpoint:lr,registration_endpoint:lr.optional(),scopes_supported:V(k()).optional(),response_types_supported:V(k()),response_modes_supported:V(k()).optional(),grant_types_supported:V(k()).optional(),token_endpoint_auth_methods_supported:V(k()).optional(),token_endpoint_auth_signing_alg_values_supported:V(k()).optional(),service_documentation:lr.optional(),revocation_endpoint:lr.optional(),revocation_endpoint_auth_methods_supported:V(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:V(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:V(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:V(k()).optional(),code_challenge_methods_supported:V(k()).optional(),client_id_metadata_document_supported:mt().optional()}),t9=mr({issuer:k(),authorization_endpoint:lr,token_endpoint:lr,userinfo_endpoint:lr.optional(),jwks_uri:lr,registration_endpoint:lr.optional(),scopes_supported:V(k()).optional(),response_types_supported:V(k()),response_modes_supported:V(k()).optional(),grant_types_supported:V(k()).optional(),acr_values_supported:V(k()).optional(),subject_types_supported:V(k()),id_token_signing_alg_values_supported:V(k()),id_token_encryption_alg_values_supported:V(k()).optional(),id_token_encryption_enc_values_supported:V(k()).optional(),userinfo_signing_alg_values_supported:V(k()).optional(),userinfo_encryption_alg_values_supported:V(k()).optional(),userinfo_encryption_enc_values_supported:V(k()).optional(),request_object_signing_alg_values_supported:V(k()).optional(),request_object_encryption_alg_values_supported:V(k()).optional(),request_object_encryption_enc_values_supported:V(k()).optional(),token_endpoint_auth_methods_supported:V(k()).optional(),token_endpoint_auth_signing_alg_values_supported:V(k()).optional(),display_values_supported:V(k()).optional(),claim_types_supported:V(k()).optional(),claims_supported:V(k()).optional(),service_documentation:k().optional(),claims_locales_supported:V(k()).optional(),ui_locales_supported:V(k()).optional(),claims_parameter_supported:mt().optional(),request_parameter_supported:mt().optional(),request_uri_parameter_supported:mt().optional(),require_request_uri_registration:mt().optional(),op_policy_uri:lr.optional(),op_tos_uri:lr.optional(),client_id_metadata_document_supported:mt().optional()}),wO=F({...t9.shape,...dk.pick({code_challenge_methods_supported:!0}).shape}),kO=F({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:_m.number().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),xO=F({error:k(),error_description:k().optional(),error_uri:k().optional()}),_O=lr.optional().or(ee("").transform(()=>{})),r9=F({redirect_uris:V(lr),token_endpoint_auth_method:k().optional(),grant_types:V(k()).optional(),response_types:V(k()).optional(),client_name:k().optional(),client_uri:lr.optional(),logo_uri:_O,scope:k().optional(),contacts:V(k()).optional(),tos_uri:_O,policy_uri:k().optional(),jwks_uri:lr.optional(),jwks:$C().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),n9=F({client_id:k(),client_secret:k().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),EO=r9.merge(n9),Vde=F({error:k(),error_description:k().optional()}).strip(),Hde=F({token:k(),token_type_hint:k().optional()}).strip();function TO(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function CO({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(a)}var Dt=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},td=class extends Dt{};td.errorCode="invalid_request";var No=class extends Dt{};No.errorCode="invalid_client";var Oo=class extends Dt{};Oo.errorCode="invalid_grant";var Do=class extends Dt{};Do.errorCode="unauthorized_client";var rd=class extends Dt{};rd.errorCode="unsupported_grant_type";var nd=class extends Dt{};nd.errorCode="invalid_scope";var id=class extends Dt{};id.errorCode="access_denied";var Ki=class extends Dt{};Ki.errorCode="server_error";var ad=class extends Dt{};ad.errorCode="temporarily_unavailable";var od=class extends Dt{};od.errorCode="unsupported_response_type";var sd=class extends Dt{};sd.errorCode="unsupported_token_type";var ld=class extends Dt{};ld.errorCode="invalid_token";var cd=class extends Dt{};cd.errorCode="method_not_allowed";var ud=class extends Dt{};ud.errorCode="too_many_requests";var Mo=class extends Dt{};Mo.errorCode="invalid_client_metadata";var dd=class extends Dt{};dd.errorCode="insufficient_scope";var pd=class extends Dt{};pd.errorCode="invalid_target";var IO={[td.errorCode]:td,[No.errorCode]:No,[Oo.errorCode]:Oo,[Do.errorCode]:Do,[rd.errorCode]:rd,[nd.errorCode]:nd,[id.errorCode]:id,[Ki.errorCode]:Ki,[ad.errorCode]:ad,[od.errorCode]:od,[sd.errorCode]:sd,[ld.errorCode]:ld,[cd.errorCode]:cd,[ud.errorCode]:ud,[Mo.errorCode]:Mo,[dd.errorCode]:dd,[pd.errorCode]:pd};var Rr=class extends Error{constructor(e){super(e??"Unauthorized")}};function i9(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var pk="code",mk="S256";function a9(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&i9(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function o9(t,e,r,n){let{client_id:i,client_secret:a}=e;switch(t){case"client_secret_basic":s9(i,a,r);return;case"client_secret_post":l9(i,a,n);return;case"none":c9(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function s9(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function l9(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function c9(t,e){e.set("client_id",t)}async function PO(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=xO.parse(JSON.parse(r)),{error:i,error_description:a,error_uri:o}=n,s=IO[i]||Ki;return new s(a||"",o)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ki(i)}}async function Ji(t,e){var r,n;try{return await hk(t,e)}catch(i){if(i instanceof No||i instanceof Do)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await hk(t,e);if(i instanceof Oo)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await hk(t,e);throw i}}async function hk(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:a}){var o,s;let l,c;try{l=await p9(e,{resourceMetadataUrl:i},a),l.authorization_servers&&l.authorization_servers.length>0&&(c=l.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await d9(e,t,l),d=await y9(c,{fetchFn:a}),m=await Promise.resolve(t.clientInformation());if(!m){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let S=d?.client_id_metadata_document_supported===!0,v=t.clientMetadataUrl;if(v&&!u9(v))throw new Mo(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(S&&v)m={client_id:v},await((o=t.saveClientInformation)===null||o===void 0?void 0:o.call(t,m));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let T=await w9(c,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(T),m=T}}let p=!t.redirectUrl;if(r!==void 0||p){let S=await S9(t,c,{metadata:d,resource:u,authorizationCode:r,fetchFn:a});return await t.saveTokens(S),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let S=await _9(c,{metadata:d,clientInformation:m,refreshToken:h.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(S),"AUTHORIZED"}catch(S){if(!(!(S instanceof Dt)||S instanceof Ki))throw S}let f=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await b9(c,{metadata:d,clientInformation:m,state:f,redirectUrl:t.redirectUrl,scope:n||((s=l?.scopes_supported)===null||s===void 0?void 0:s.join(" "))||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function u9(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function d9(t,e,r){let n=TO(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!CO({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Cl(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=fk(t,"resource_metadata")||void 0,a;if(i)try{a=new URL(i)}catch{}let o=fk(t,"scope")||void 0,s=fk(t,"error")||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function fk(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function p9(t,e,r=fetch){var n,i;let a=await f9(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!a||a.status===404)throw await((n=a?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!a.ok)throw await((i=a.body)===null||i===void 0?void 0:i.cancel()),new Error(`HTTP ${a.status} trying to load well-known OAuth protected resource metadata.`);return SO.parse(await a.json())}async function gk(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?gk(t,void 0,r):void 0;throw n}}function m9(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function AO(t,e,r=fetch){return await gk(t,{"MCP-Protocol-Version":e},r)}function h9(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function f9(t,e,r,n){var i,a;let o=new URL(t),s=(i=n?.protocolVersion)!==null&&i!==void 0?i:Ks,l;if(n?.metadataUrl)l=new URL(n.metadataUrl);else{let u=m9(e,o.pathname);l=new URL(u,(a=n?.metadataServerUrl)!==null&&a!==void 0?a:o),l.search=o.search}let c=await AO(l,s,r);if(!n?.metadataUrl&&h9(c,o.pathname)){let u=new URL(`/.well-known/${e}`,o);c=await AO(u,s,r)}return c}function g9(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function y9(t,{fetchFn:e=fetch,protocolVersion:r=Ks}={}){var n;let i={"MCP-Protocol-Version":r,Accept:"application/json"},a=g9(t);for(let{url:o,type:s}of a){let l=await gk(o,i,e);if(l){if(!l.ok){if(await((n=l.body)===null||n===void 0?void 0:n.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?dk.parse(await l.json()):wO.parse(await l.json())}}}async function b9(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:a,resource:o}){let s;if(e){if(s=new URL(e.authorization_endpoint),!e.response_types_supported.includes(pk))throw new Error(`Incompatible auth server: does not support response type ${pk}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(mk))throw new Error(`Incompatible auth server: does not support code challenge method ${mk}`)}else s=new URL("/authorize",t);let l=await uk(),c=l.code_verifier,u=l.code_challenge;return s.searchParams.set("response_type",pk),s.searchParams.set("client_id",r.client_id),s.searchParams.set("code_challenge",u),s.searchParams.set("code_challenge_method",mk),s.searchParams.set("redirect_uri",String(n)),a&&s.searchParams.set("state",a),i&&s.searchParams.set("scope",i),i?.includes("offline_access")&&s.searchParams.append("prompt","consent"),o&&s.searchParams.set("resource",o.href),{authorizationUrl:s,codeVerifier:c}}function v9(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function RO(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:o}){var s;let l=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(a&&r.set("resource",a.href),i)await i(c,r,l,e);else if(n){let d=(s=e?.token_endpoint_auth_methods_supported)!==null&&s!==void 0?s:[],m=a9(n,d);o9(m,n,c,r)}let u=await(o??fetch)(l,{method:"POST",headers:c,body:r});if(!u.ok)throw await PO(u);return kO.parse(await u.json())}async function _9(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:a,fetchFn:o}){let s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await RO(t,{metadata:e,tokenRequestParams:s,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:o});return{refresh_token:n,...l}}async function S9(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:a}={}){let o=t.clientMetadata.scope,s;if(t.prepareTokenRequest&&(s=await t.prepareTokenRequest(o)),!s){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();s=v9(i,c,t.redirectUrl)}let l=await t.clientInformation();return RO(e,{metadata:r,tokenRequestParams:s,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:a})}async function w9(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let a=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await PO(a);return EO.parse(await a.json())}var Jh=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function yk(t){}function Xh(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=yk,onError:r=yk,onRetry:n=yk,onComment:i}=t,a="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[g,S]=k9(`${a}${y}`);for(let v of g)d(v);a=S,o=!1}function d(f){if(f===""){p();return}if(f.startsWith(":")){i&&i(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let g=f.slice(0,y),S=f[y+1]===" "?2:1,v=f.slice(y+S);m(g,v,f);return}m(f,"",f)}function m(f,y,g){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3311
|
-
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new
|
|
3312
|
-
`)?l.slice(0,-1):l}),s=void 0,l="",c=""}function h(f={}){a&&f.consume&&d(a),o=!0,s=void 0,l="",c="",a=""}return{feed:u,reset:h}}function
|
|
3310
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");let x=p.compile();return(v,I)=>x(m,v,I)},a,o=ro,s=!Gp.jitless,c=s&&_y.value,u=e.catchall,d;t._zod.parse=(m,p)=>{d??(d=n.value);let h=m.value;return o(h)?s&&c&&p?.async===!1&&p.jitless!==!0?(a||(a=i(e.shape)),m=a(m,p),u?eC([],h,m,p,d,t):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),m)}});function G0(t,e,r,n){for(let a of t)if(a.issues.length===0)return e.value=a.value,e;let i=t.filter(a=>!_a(a));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(a=>a.issues.map(o=>$n(o,n,mr())))}),e)}var im=N("$ZodUnion",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),nt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),nt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),nt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>Lc(a.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,a)=>{if(r)return n(i,a);let o=!1,s=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},a);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(l=>G0(l,i,t,a)):G0(s,i,t,a)}}),sb=N("$ZodDiscriminatedUnion",(t,e)=>{im.init(t,e);let r=t._zod.parse;nt(t._zod,"propValues",()=>{let i={};for(let a of e.options){let o=a._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let[s,l]of Object.entries(o)){i[s]||(i[s]=new Set);for(let c of l)i[s].add(c)}}return i});let n=Us(()=>{let i=e.options,a=new Map;for(let o of i){let s=o._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let l of s){if(a.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);a.set(l,o)}}return a});t._zod.parse=(i,a)=>{let o=i.value;if(!ro(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;let s=n.value.get(o?.[e.discriminator]);return s?s._zod.run(i,a):e.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),i)}}),lb=N("$ZodIntersection",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,a=e.left._zod.run({value:i,issues:[]},n),o=e.right._zod.run({value:i,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([l,c])=>V0(r,l,c)):V0(r,a,o)}});function Ay(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(va(t)&&va(e)){let r=Object.keys(e),n=Object.keys(t).filter(a=>r.indexOf(a)!==-1),i={...t,...e};for(let a of n){let o=Ay(t[a],e[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};i[a]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],a=e[n],o=Ay(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function V0(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),_a(t))return t;let n=Ay(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var cb=N("$ZodRecord",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!va(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let a=[],o=e.keyType._zod.values;if(o){r.value={};let s=new Set;for(let c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){s.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?a.push(u.then(d=>{d.issues.length&&r.issues.push(...$i(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...$i(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)s.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let l=e.keyType._zod.run({value:s,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>$n(u,n,mr())),input:s,path:[s],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[s],issues:[]},n);c instanceof Promise?a.push(c.then(u=>{u.issues.length&&r.issues.push(...$i(s,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...$i(s,c.issues)),r.value[l.value]=c.value)}}return a.length?Promise.all(a).then(()=>r):r}});var ub=N("$ZodEnum",(t,e)=>{Qe.init(t,e);let r=Hp(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>Sy.has(typeof i)).map(i=>typeof i=="string"?ii(i):i.toString()).join("|")})$`),t._zod.parse=(i,a)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),db=N("$ZodLiteral",(t,e)=>{if(Qe.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ii(n):n?ii(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:e.values,input:a,inst:t}),n}});var pb=N("$ZodTransform",(t,e)=>{Qe.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r));if(i instanceof Promise)throw new ni;return r.value=i,r}});function H0(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var mb=N("$ZodOptional",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Lc(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>H0(a,r.value)):H0(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),hb=N("$ZodNullable",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Lc(r.source)}|null)$`):void 0}),nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),fb=N("$ZodDefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>q0(a,e)):q0(i,e)}});function q0(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var gb=N("$ZodPrefault",(t,e)=>{Qe.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),yb=N("$ZodNonOptional",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>W0(a,t)):W0(i,t)}});function W0(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var bb=N("$ZodCatch",(t,e)=>{Qe.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>(r.value=a.value,a.issues.length&&(r.value=e.catchValue({...r,error:{issues:a.issues.map(o=>$n(o,n,mr()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>$n(a,n,mr()))},input:r.value}),r.issues=[]),r)}});var vb=N("$ZodPipe",(t,e)=>{Qe.init(t,e),nt(t._zod,"values",()=>e.in._zod.values),nt(t._zod,"optin",()=>e.in._zod.optin),nt(t._zod,"optout",()=>e.out._zod.optout),nt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=e.out._zod.run(r,n);return a instanceof Promise?a.then(o=>em(o,e.in,n)):em(a,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>em(a,e.out,n)):em(i,e.out,n)}});function em(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var _b=N("$ZodReadonly",(t,e)=>{Qe.init(t,e),nt(t._zod,"propValues",()=>e.innerType._zod.propValues),nt(t._zod,"values",()=>e.innerType._zod.values),nt(t._zod,"optin",()=>e.innerType?._zod?.optin),nt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(Z0):Z0(i)}});function Z0(t){return t.value=Object.freeze(t.value),t}var Sb=N("$ZodCustom",(t,e)=>{Zt.init(t,e),Qe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(a=>K0(a,r,n,t));K0(i,r,n,t)}});function K0(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Gs(i))}}var Gz=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Vz=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Gz(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${me(n.values[0])}`:`Invalid option: expected one of ${pe(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=e(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=e(n.origin);return a?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${pe(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function wb(){return{localeError:Vz()}}var nC,iC=Symbol("ZodOutput"),aC=Symbol("ZodInput"),am=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function xb(){return new am}(nC=globalThis).__zod_globalRegistry??(nC.__zod_globalRegistry=xb());var Li=globalThis.__zod_globalRegistry;function Eb(t,e){return new t({type:"string",...ie(e)})}function Tb(t,e){return new t({type:"string",coerce:!0,...ie(e)})}function Cb(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ie(e)})}function om(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ie(e)})}function Ib(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(e)})}function Ab(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(e)})}function Pb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(e)})}function Rb(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(e)})}function sm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ie(e)})}function Nb(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(e)})}function Ob(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(e)})}function Db(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(e)})}function Mb(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(e)})}function $b(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(e)})}function Lb(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ie(e)})}function zb(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(e)})}function Fb(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(e)})}function Bb(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(e)})}function jb(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(e)})}function Ub(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(e)})}function Gb(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ie(e)})}function Vb(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(e)})}function Hb(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ie(e)})}function qb(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(e)})}function Wb(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(e)})}function Zb(t,e){return new t({type:"string",format:"date",check:"string_format",...ie(e)})}function Kb(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ie(e)})}function Jb(t,e){return new t({type:"string",format:"duration",check:"string_format",...ie(e)})}function Xb(t,e){return new t({type:"number",checks:[],...ie(e)})}function Yb(t,e){return new t({type:"number",coerce:!0,checks:[],...ie(e)})}function Qb(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(e)})}function ev(t,e){return new t({type:"boolean",...ie(e)})}function tv(t,e){return new t({type:"boolean",coerce:!0,...ie(e)})}function rv(t,e){return new t({type:"bigint",coerce:!0,...ie(e)})}function nv(t,e){return new t({type:"null",...ie(e)})}function iv(t){return new t({type:"any"})}function av(t){return new t({type:"unknown"})}function ov(t,e){return new t({type:"never",...ie(e)})}function sv(t,e){return new t({type:"date",coerce:!0,...ie(e)})}function io(t,e){return new Cy({check:"less_than",...ie(e),value:t,inclusive:!1})}function Ln(t,e){return new Cy({check:"less_than",...ie(e),value:t,inclusive:!0})}function ao(t,e){return new Iy({check:"greater_than",...ie(e),value:t,inclusive:!1})}function rn(t,e){return new Iy({check:"greater_than",...ie(e),value:t,inclusive:!0})}function qs(t,e){return new I0({check:"multiple_of",...ie(e),value:t})}function Gc(t,e){return new P0({check:"max_length",...ie(e),maximum:t})}function oo(t,e){return new R0({check:"min_length",...ie(e),minimum:t})}function Vc(t,e){return new N0({check:"length_equals",...ie(e),length:t})}function lm(t,e){return new O0({check:"string_format",format:"regex",...ie(e),pattern:t})}function cm(t){return new D0({check:"string_format",format:"lowercase",...ie(t)})}function um(t){return new M0({check:"string_format",format:"uppercase",...ie(t)})}function dm(t,e){return new $0({check:"string_format",format:"includes",...ie(e),includes:t})}function pm(t,e){return new L0({check:"string_format",format:"starts_with",...ie(e),prefix:t})}function mm(t,e){return new z0({check:"string_format",format:"ends_with",...ie(e),suffix:t})}function zi(t){return new F0({check:"overwrite",tx:t})}function hm(t){return zi(e=>e.normalize(t))}function fm(){return zi(t=>t.trim())}function gm(){return zi(t=>t.toLowerCase())}function ym(){return zi(t=>t.toUpperCase())}function lv(){return zi(t=>vy(t))}function sC(t,e,r){return new t({type:"array",element:e,...ie(r)})}function cv(t,e,r){let n=ie(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function uv(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ie(r)})}function dv(t){let e=Zz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gs(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(Gs(i))}},t(r.value,r)));return e}function Zz(t,e){let r=new Zt({check:"custom",...ie(e)});return r._zod.check=t,r}function Ws(t){return!!t._zod}function Fn(t,e){return Ws(t)?Vs(t,e):t.safeParse(e)}function bm(t){var e,r;if(!t)return;let n;if(Ws(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function fC(t){var e;if(Ws(t)){let o=(e=t._zod)===null||e===void 0?void 0:e.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let i=t.value;if(i!==void 0)return i}var Hc={};rc(Hc,{ZodISODate:()=>hv,ZodISODateTime:()=>pv,ZodISODuration:()=>bv,ZodISOTime:()=>gv,date:()=>fv,datetime:()=>mv,duration:()=>vv,time:()=>yv});var pv=N("ZodISODateTime",(t,e)=>{jy.init(t,e),St.init(t,e)});function mv(t){return Wb(pv,t)}var hv=N("ZodISODate",(t,e)=>{Uy.init(t,e),St.init(t,e)});function fv(t){return Zb(hv,t)}var gv=N("ZodISOTime",(t,e)=>{Gy.init(t,e),St.init(t,e)});function yv(t){return Kb(gv,t)}var bv=N("ZodISODuration",(t,e)=>{Vy.init(t,e),St.init(t,e)});function vv(t){return Jb(bv,t)}var yC=(t,e)=>{Zp.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Jp(t,r)},flatten:{value:r=>Kp(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,js,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,js,2)}},isEmpty:{get(){return t.issues.length===0}}})},nae=N("ZodError",yC),nn=N("ZodError",yC,{Parent:Error});var bC=Xp(nn),vC=Yp(nn),_C=Fc(nn),SC=Bc(nn),wC=VT(nn),kC=HT(nn),xC=qT(nn),EC=WT(nn),TC=ZT(nn),CC=KT(nn),IC=JT(nn),AC=XT(nn);var pt=N("ZodType",(t,e)=>(Qe.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(U.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>zr(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>bC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>_C(t,r,n),t.parseAsync=async(r,n)=>vC(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>SC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>wC(t,r,n),t.decode=(r,n)=>kC(t,r,n),t.encodeAsync=async(r,n)=>xC(t,r,n),t.decodeAsync=async(r,n)=>EC(t,r,n),t.safeEncode=(r,n)=>TC(t,r,n),t.safeDecode=(r,n)=>CC(t,r,n),t.safeEncodeAsync=async(r,n)=>IC(t,r,n),t.safeDecodeAsync=async(r,n)=>AC(t,r,n),t.refine=(r,n)=>t.check(IF(r,n)),t.superRefine=r=>t.check(AF(r)),t.overwrite=r=>t.check(zi(r)),t.optional=()=>te(t),t.nullable=()=>NC(t),t.nullish=()=>te(NC(t)),t.nonoptional=r=>wF(t,r),t.array=()=>V(t),t.or=r=>ft([t,r]),t.and=r=>Sm(t,r),t.transform=r=>Sv(t,jC(r)),t.default=r=>vF(t,r),t.prefault=r=>SF(t,r),t.catch=r=>xF(t,r),t.pipe=r=>Sv(t,r),t.readonly=()=>CF(t),t.describe=r=>{let n=t.clone();return Li.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Li.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Li.get(t);let n=t.clone();return Li.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),OC=N("_ZodString",(t,e)=>{Hs.init(t,e),pt.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(lm(...n)),t.includes=(...n)=>t.check(dm(...n)),t.startsWith=(...n)=>t.check(pm(...n)),t.endsWith=(...n)=>t.check(mm(...n)),t.min=(...n)=>t.check(oo(...n)),t.max=(...n)=>t.check(Gc(...n)),t.length=(...n)=>t.check(Vc(...n)),t.nonempty=(...n)=>t.check(oo(1,...n)),t.lowercase=n=>t.check(cm(n)),t.uppercase=n=>t.check(um(n)),t.trim=()=>t.check(fm()),t.normalize=(...n)=>t.check(hm(...n)),t.toLowerCase=()=>t.check(gm()),t.toUpperCase=()=>t.check(ym()),t.slugify=()=>t.check(lv())}),wv=N("ZodString",(t,e)=>{Hs.init(t,e),OC.init(t,e),t.email=r=>t.check(Cb(G2,r)),t.url=r=>t.check(sm(DC,r)),t.jwt=r=>t.check(qb(iF,r)),t.emoji=r=>t.check(Nb(V2,r)),t.guid=r=>t.check(om(PC,r)),t.uuid=r=>t.check(Ib(vm,r)),t.uuidv4=r=>t.check(Ab(vm,r)),t.uuidv6=r=>t.check(Pb(vm,r)),t.uuidv7=r=>t.check(Rb(vm,r)),t.nanoid=r=>t.check(Ob(H2,r)),t.guid=r=>t.check(om(PC,r)),t.cuid=r=>t.check(Db(q2,r)),t.cuid2=r=>t.check(Mb(W2,r)),t.ulid=r=>t.check($b(Z2,r)),t.base64=r=>t.check(Gb(tF,r)),t.base64url=r=>t.check(Vb(rF,r)),t.xid=r=>t.check(Lb(K2,r)),t.ksuid=r=>t.check(zb(J2,r)),t.ipv4=r=>t.check(Fb(X2,r)),t.ipv6=r=>t.check(Bb(Y2,r)),t.cidrv4=r=>t.check(jb(Q2,r)),t.cidrv6=r=>t.check(Ub(eF,r)),t.e164=r=>t.check(Hb(nF,r)),t.datetime=r=>t.check(mv(r)),t.date=r=>t.check(fv(r)),t.time=r=>t.check(yv(r)),t.duration=r=>t.check(vv(r))});function w(t){return Eb(wv,t)}var St=N("ZodStringFormat",(t,e)=>{dt.init(t,e),OC.init(t,e)}),G2=N("ZodEmail",(t,e)=>{Ny.init(t,e),St.init(t,e)});var PC=N("ZodGUID",(t,e)=>{Py.init(t,e),St.init(t,e)});var vm=N("ZodUUID",(t,e)=>{Ry.init(t,e),St.init(t,e)});var DC=N("ZodURL",(t,e)=>{Oy.init(t,e),St.init(t,e)});function MC(t){return sm(DC,t)}var V2=N("ZodEmoji",(t,e)=>{Dy.init(t,e),St.init(t,e)});var H2=N("ZodNanoID",(t,e)=>{My.init(t,e),St.init(t,e)});var q2=N("ZodCUID",(t,e)=>{$y.init(t,e),St.init(t,e)});var W2=N("ZodCUID2",(t,e)=>{Ly.init(t,e),St.init(t,e)});var Z2=N("ZodULID",(t,e)=>{zy.init(t,e),St.init(t,e)});var K2=N("ZodXID",(t,e)=>{Fy.init(t,e),St.init(t,e)});var J2=N("ZodKSUID",(t,e)=>{By.init(t,e),St.init(t,e)});var X2=N("ZodIPv4",(t,e)=>{Hy.init(t,e),St.init(t,e)});var Y2=N("ZodIPv6",(t,e)=>{qy.init(t,e),St.init(t,e)});var Q2=N("ZodCIDRv4",(t,e)=>{Wy.init(t,e),St.init(t,e)});var eF=N("ZodCIDRv6",(t,e)=>{Zy.init(t,e),St.init(t,e)});var tF=N("ZodBase64",(t,e)=>{Ky.init(t,e),St.init(t,e)});var rF=N("ZodBase64URL",(t,e)=>{Jy.init(t,e),St.init(t,e)});var nF=N("ZodE164",(t,e)=>{Xy.init(t,e),St.init(t,e)});var iF=N("ZodJWT",(t,e)=>{Yy.init(t,e),St.init(t,e)});var _m=N("ZodNumber",(t,e)=>{rm.init(t,e),pt.init(t,e),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.int=n=>t.check(RC(n)),t.safe=n=>t.check(RC(n)),t.positive=n=>t.check(ao(0,n)),t.nonnegative=n=>t.check(rn(0,n)),t.negative=n=>t.check(io(0,n)),t.nonpositive=n=>t.check(Ln(0,n)),t.multipleOf=(n,i)=>t.check(qs(n,i)),t.step=(n,i)=>t.check(qs(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function et(t){return Xb(_m,t)}var aF=N("ZodNumberFormat",(t,e)=>{Qy.init(t,e),_m.init(t,e)});function RC(t){return Qb(aF,t)}var kv=N("ZodBoolean",(t,e)=>{nm.init(t,e),pt.init(t,e)});function mt(t){return ev(kv,t)}var $C=N("ZodBigInt",(t,e)=>{eb.init(t,e),pt.init(t,e),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.gt=(n,i)=>t.check(ao(n,i)),t.gte=(n,i)=>t.check(rn(n,i)),t.min=(n,i)=>t.check(rn(n,i)),t.lt=(n,i)=>t.check(io(n,i)),t.lte=(n,i)=>t.check(Ln(n,i)),t.max=(n,i)=>t.check(Ln(n,i)),t.positive=n=>t.check(ao(BigInt(0),n)),t.negative=n=>t.check(io(BigInt(0),n)),t.nonpositive=n=>t.check(Ln(BigInt(0),n)),t.nonnegative=n=>t.check(rn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(qs(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var oF=N("ZodNull",(t,e)=>{tb.init(t,e),pt.init(t,e)});function xv(t){return nv(oF,t)}var sF=N("ZodAny",(t,e)=>{rb.init(t,e),pt.init(t,e)});function LC(){return iv(sF)}var lF=N("ZodUnknown",(t,e)=>{nb.init(t,e),pt.init(t,e)});function Ut(){return av(lF)}var cF=N("ZodNever",(t,e)=>{ib.init(t,e),pt.init(t,e)});function uF(t){return ov(cF,t)}var zC=N("ZodDate",(t,e)=>{ab.init(t,e),pt.init(t,e),t.min=(n,i)=>t.check(rn(n,i)),t.max=(n,i)=>t.check(Ln(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var dF=N("ZodArray",(t,e)=>{ob.init(t,e),pt.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(oo(r,n)),t.nonempty=r=>t.check(oo(1,r)),t.max=(r,n)=>t.check(Gc(r,n)),t.length=(r,n)=>t.check(Vc(r,n)),t.unwrap=()=>t.element});function V(t,e){return sC(dF,t,e)}var FC=N("ZodObject",(t,e)=>{rC.init(t,e),pt.init(t,e),U.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>tr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ut()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ut()}),t.strict=()=>t.clone({...t._zod.def,catchall:uF()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>U.extend(t,r),t.safeExtend=r=>U.safeExtend(t,r),t.merge=r=>U.merge(t,r),t.pick=r=>U.pick(t,r),t.omit=r=>U.omit(t,r),t.partial=(...r)=>U.partial(UC,t,r[0]),t.required=(...r)=>U.required(GC,t,r[0])});function F(t,e){let r={type:"object",shape:t??{},...U.normalizeParams(e)};return new FC(r)}function hr(t,e){return new FC({type:"object",shape:t,catchall:Ut(),...U.normalizeParams(e)})}var BC=N("ZodUnion",(t,e)=>{im.init(t,e),pt.init(t,e),t.options=e.options});function ft(t,e){return new BC({type:"union",options:t,...U.normalizeParams(e)})}var pF=N("ZodDiscriminatedUnion",(t,e)=>{BC.init(t,e),sb.init(t,e)});function Ev(t,e,r){return new pF({type:"union",options:e,discriminator:t,...U.normalizeParams(r)})}var mF=N("ZodIntersection",(t,e)=>{lb.init(t,e),pt.init(t,e)});function Sm(t,e){return new mF({type:"intersection",left:t,right:e})}var hF=N("ZodRecord",(t,e)=>{cb.init(t,e),pt.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Gt(t,e,r){return new hF({type:"record",keyType:t,valueType:e,...U.normalizeParams(r)})}var _v=N("ZodEnum",(t,e)=>{ub.init(t,e),pt.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new _v({...e,checks:[],...U.normalizeParams(i),entries:a})},t.exclude=(n,i)=>{let a={...e.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new _v({...e,checks:[],...U.normalizeParams(i),entries:a})}});function tr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new _v({type:"enum",entries:r,...U.normalizeParams(e)})}var fF=N("ZodLiteral",(t,e)=>{db.init(t,e),pt.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ee(t,e){return new fF({type:"literal",values:Array.isArray(t)?t:[t],...U.normalizeParams(e)})}var gF=N("ZodTransform",(t,e)=>{pb.init(t,e),pt.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bs(t.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(U.issue(a,r.value,e));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),r.issues.push(U.issue(o))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function jC(t){return new gF({type:"transform",transform:t})}var UC=N("ZodOptional",(t,e)=>{mb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function te(t){return new UC({type:"optional",innerType:t})}var yF=N("ZodNullable",(t,e)=>{hb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function NC(t){return new yF({type:"nullable",innerType:t})}var bF=N("ZodDefault",(t,e)=>{fb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function vF(t,e){return new bF({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var _F=N("ZodPrefault",(t,e)=>{gb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function SF(t,e){return new _F({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var GC=N("ZodNonOptional",(t,e)=>{yb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function wF(t,e){return new GC({type:"nonoptional",innerType:t,...U.normalizeParams(e)})}var kF=N("ZodCatch",(t,e)=>{bb.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function xF(t,e){return new kF({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var EF=N("ZodPipe",(t,e)=>{vb.init(t,e),pt.init(t,e),t.in=e.in,t.out=e.out});function Sv(t,e){return new EF({type:"pipe",in:t,out:e})}var TF=N("ZodReadonly",(t,e)=>{_b.init(t,e),pt.init(t,e),t.unwrap=()=>t._zod.def.innerType});function CF(t){return new TF({type:"readonly",innerType:t})}var VC=N("ZodCustom",(t,e)=>{Sb.init(t,e),pt.init(t,e)});function HC(t,e){return cv(VC,t??(()=>!0),e)}function IF(t,e={}){return uv(VC,t,e)}function AF(t){return dv(t)}function Tv(t,e){return Sv(jC(t),e)}var WC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var qC;qC||(qC={});var wm={};rc(wm,{bigint:()=>OF,boolean:()=>NF,date:()=>DF,number:()=>RF,string:()=>PF});function PF(t){return Tb(wv,t)}function RF(t){return Yb(_m,t)}function NF(t){return tv(kv,t)}function OF(t){return rv($C,t)}function DF(t){return sv(zC,t)}mr(wb());var Ks="2025-11-25";var KC=[Ks,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oi="io.modelcontextprotocol/related-task",xm="2.0",ai=HC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),JC=ft([w(),et().int()]),XC=w(),$F=hr({ttl:ft([et(),xv()]).optional(),pollInterval:et().optional()}),Iv=hr({taskId:w()}),LF=hr({progressToken:JC.optional(),[oi]:Iv.optional()}),Fr=hr({task:$F.optional(),_meta:LF.optional()}),rr=F({method:w(),params:Fr.optional()}),so=hr({_meta:F({[oi]:te(Iv)}).passthrough().optional()}),vn=F({method:w(),params:so.optional()}),fr=hr({_meta:hr({[oi]:Iv.optional()}).optional()}),Em=ft([w(),et().int()]),YC=F({jsonrpc:ee(xm),id:Em,...rr.shape}).strict(),qc=t=>YC.safeParse(t).success,QC=F({jsonrpc:ee(xm),...vn.shape}).strict(),eI=t=>QC.safeParse(t).success,tI=F({jsonrpc:ee(xm),id:Em,result:fr}).strict(),lo=t=>tI.safeParse(t).success,he;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(he||(he={}));var rI=F({jsonrpc:ee(xm),id:Em,error:F({code:et().int(),message:w(),data:te(Ut())})}).strict(),nI=t=>rI.safeParse(t).success,Js=ft([YC,QC,tI,rI]),co=fr.strict(),zF=so.extend({requestId:Em,reason:w().optional()}),Tm=vn.extend({method:ee("notifications/cancelled"),params:zF}),FF=F({src:w(),mimeType:w().optional(),sizes:V(w()).optional()}),Wc=F({icons:V(FF).optional()}),Zs=F({name:w(),title:w().optional()}),iI=Zs.extend({...Zs.shape,...Wc.shape,version:w(),websiteUrl:w().optional()}),BF=Sm(F({applyDefaults:mt().optional()}),Gt(w(),Ut())),jF=Tv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Sm(F({form:BF.optional(),url:ai.optional()}),Gt(w(),Ut()).optional())),UF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({sampling:te(F({createMessage:te(F({}).passthrough())}).passthrough()),elicitation:te(F({create:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),GF=F({list:te(F({}).passthrough()),cancel:te(F({}).passthrough()),requests:te(F({tools:te(F({call:te(F({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),VF=F({experimental:Gt(w(),ai).optional(),sampling:F({context:ai.optional(),tools:ai.optional()}).optional(),elicitation:jF.optional(),roots:F({listChanged:mt().optional()}).optional(),tasks:te(UF)}),HF=Fr.extend({protocolVersion:w(),capabilities:VF,clientInfo:iI}),qF=rr.extend({method:ee("initialize"),params:HF});var WF=F({experimental:Gt(w(),ai).optional(),logging:ai.optional(),completions:ai.optional(),prompts:te(F({listChanged:te(mt())})),resources:F({subscribe:mt().optional(),listChanged:mt().optional()}).optional(),tools:F({listChanged:mt().optional()}).optional(),tasks:te(GF)}).passthrough(),Av=fr.extend({protocolVersion:w(),capabilities:WF,serverInfo:iI,instructions:w().optional()}),aI=vn.extend({method:ee("notifications/initialized")}),oI=t=>aI.safeParse(t).success,Cm=rr.extend({method:ee("ping")}),ZF=F({progress:et(),total:te(et()),message:te(w())}),KF=F({...so.shape,...ZF.shape,progressToken:JC}),Im=vn.extend({method:ee("notifications/progress"),params:KF}),JF=Fr.extend({cursor:XC.optional()}),Zc=rr.extend({params:JF.optional()}),Kc=fr.extend({nextCursor:te(XC)}),Jc=F({taskId:w(),status:tr(["working","input_required","completed","failed","cancelled"]),ttl:ft([et(),xv()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:te(et()),statusMessage:te(w())}),uo=fr.extend({task:Jc}),XF=so.merge(Jc),Xc=vn.extend({method:ee("notifications/tasks/status"),params:XF}),Am=rr.extend({method:ee("tasks/get"),params:Fr.extend({taskId:w()})}),Pm=fr.merge(Jc),Rm=rr.extend({method:ee("tasks/result"),params:Fr.extend({taskId:w()})}),Nm=Zc.extend({method:ee("tasks/list")}),Om=Kc.extend({tasks:V(Jc)}),sI=rr.extend({method:ee("tasks/cancel"),params:Fr.extend({taskId:w()})}),lI=fr.merge(Jc),cI=F({uri:w(),mimeType:te(w()),_meta:Gt(w(),Ut()).optional()}),uI=cI.extend({text:w()}),Pv=w().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),dI=cI.extend({blob:Pv}),Xs=F({audience:V(tr(["user","assistant"])).optional(),priority:et().min(0).max(1).optional(),lastModified:Hc.datetime({offset:!0}).optional()}),pI=F({...Zs.shape,...Wc.shape,uri:w(),description:te(w()),mimeType:te(w()),annotations:Xs.optional(),_meta:te(hr({}))}),YF=F({...Zs.shape,...Wc.shape,uriTemplate:w(),description:te(w()),mimeType:te(w()),annotations:Xs.optional(),_meta:te(hr({}))}),QF=Zc.extend({method:ee("resources/list")}),Rv=Kc.extend({resources:V(pI)}),eB=Zc.extend({method:ee("resources/templates/list")}),Nv=Kc.extend({resourceTemplates:V(YF)}),Ov=Fr.extend({uri:w()}),tB=Ov,rB=rr.extend({method:ee("resources/read"),params:tB}),Dv=fr.extend({contents:V(ft([uI,dI]))}),nB=vn.extend({method:ee("notifications/resources/list_changed")}),iB=Ov,aB=rr.extend({method:ee("resources/subscribe"),params:iB}),oB=Ov,sB=rr.extend({method:ee("resources/unsubscribe"),params:oB}),lB=so.extend({uri:w()}),cB=vn.extend({method:ee("notifications/resources/updated"),params:lB}),uB=F({name:w(),description:te(w()),required:te(mt())}),dB=F({...Zs.shape,...Wc.shape,description:te(w()),arguments:te(V(uB)),_meta:te(hr({}))}),pB=Zc.extend({method:ee("prompts/list")}),Mv=Kc.extend({prompts:V(dB)}),mB=Fr.extend({name:w(),arguments:Gt(w(),w()).optional()}),hB=rr.extend({method:ee("prompts/get"),params:mB}),$v=F({type:ee("text"),text:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),Lv=F({type:ee("image"),data:Pv,mimeType:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),zv=F({type:ee("audio"),data:Pv,mimeType:w(),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),fB=F({type:ee("tool_use"),name:w(),id:w(),input:F({}).passthrough(),_meta:te(F({}).passthrough())}).passthrough(),gB=F({type:ee("resource"),resource:ft([uI,dI]),annotations:Xs.optional(),_meta:Gt(w(),Ut()).optional()}),yB=pI.extend({type:ee("resource_link")}),Fv=ft([$v,Lv,zv,yB,gB]),bB=F({role:tr(["user","assistant"]),content:Fv}),Bv=fr.extend({description:te(w()),messages:V(bB)}),vB=vn.extend({method:ee("notifications/prompts/list_changed")}),_B=F({title:w().optional(),readOnlyHint:mt().optional(),destructiveHint:mt().optional(),idempotentHint:mt().optional(),openWorldHint:mt().optional()}),SB=F({taskSupport:tr(["required","optional","forbidden"]).optional()}),mI=F({...Zs.shape,...Wc.shape,description:w().optional(),inputSchema:F({type:ee("object"),properties:Gt(w(),ai).optional(),required:V(w()).optional()}).catchall(Ut()),outputSchema:F({type:ee("object"),properties:Gt(w(),ai).optional(),required:V(w()).optional()}).catchall(Ut()).optional(),annotations:te(_B),execution:te(SB),_meta:Gt(w(),Ut()).optional()}),wB=Zc.extend({method:ee("tools/list")}),jv=Kc.extend({tools:V(mI)}),Ys=fr.extend({content:V(Fv).default([]),structuredContent:Gt(w(),Ut()).optional(),isError:te(mt())}),kae=Ys.or(fr.extend({toolResult:Ut()})),kB=Fr.extend({name:w(),arguments:te(Gt(w(),Ut()))}),xB=rr.extend({method:ee("tools/call"),params:kB}),Uv=vn.extend({method:ee("notifications/tools/list_changed")}),hI=tr(["debug","info","notice","warning","error","critical","alert","emergency"]),EB=Fr.extend({level:hI}),TB=rr.extend({method:ee("logging/setLevel"),params:EB}),CB=so.extend({level:hI,logger:w().optional(),data:Ut()}),Gv=vn.extend({method:ee("notifications/message"),params:CB}),IB=F({name:w().optional()}),AB=F({hints:te(V(IB)),costPriority:te(et().min(0).max(1)),speedPriority:te(et().min(0).max(1)),intelligencePriority:te(et().min(0).max(1))}),PB=F({mode:te(tr(["auto","required","none"]))}),RB=F({type:ee("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:V(Fv).default([]),structuredContent:F({}).passthrough().optional(),isError:te(mt()),_meta:te(F({}).passthrough())}).passthrough(),NB=Ev("type",[$v,Lv,zv]),km=Ev("type",[$v,Lv,zv,fB,RB]),OB=F({role:tr(["user","assistant"]),content:ft([km,V(km)]),_meta:te(F({}).passthrough())}).passthrough(),DB=Fr.extend({messages:V(OB),modelPreferences:AB.optional(),systemPrompt:w().optional(),includeContext:tr(["none","thisServer","allServers"]).optional(),temperature:et().optional(),maxTokens:et().int(),stopSequences:V(w()).optional(),metadata:ai.optional(),tools:te(V(mI)),toolChoice:te(PB)}),Vv=rr.extend({method:ee("sampling/createMessage"),params:DB}),Hv=fr.extend({model:w(),stopReason:te(tr(["endTurn","stopSequence","maxTokens"]).or(w())),role:tr(["user","assistant"]),content:NB}),MB=fr.extend({model:w(),stopReason:te(tr(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:tr(["user","assistant"]),content:ft([km,V(km)])}),$B=F({type:ee("boolean"),title:w().optional(),description:w().optional(),default:mt().optional()}),LB=F({type:ee("string"),title:w().optional(),description:w().optional(),minLength:et().optional(),maxLength:et().optional(),format:tr(["email","uri","date","date-time"]).optional(),default:w().optional()}),zB=F({type:tr(["number","integer"]),title:w().optional(),description:w().optional(),minimum:et().optional(),maximum:et().optional(),default:et().optional()}),FB=F({type:ee("string"),title:w().optional(),description:w().optional(),enum:V(w()),default:w().optional()}),BB=F({type:ee("string"),title:w().optional(),description:w().optional(),oneOf:V(F({const:w(),title:w()})),default:w().optional()}),jB=F({type:ee("string"),title:w().optional(),description:w().optional(),enum:V(w()),enumNames:V(w()).optional(),default:w().optional()}),UB=ft([FB,BB]),GB=F({type:ee("array"),title:w().optional(),description:w().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({type:ee("string"),enum:V(w())}),default:V(w()).optional()}),VB=F({type:ee("array"),title:w().optional(),description:w().optional(),minItems:et().optional(),maxItems:et().optional(),items:F({anyOf:V(F({const:w(),title:w()}))}),default:V(w()).optional()}),HB=ft([GB,VB]),qB=ft([jB,UB,HB]),WB=ft([qB,$B,LB,zB]),ZB=Fr.extend({mode:ee("form").optional(),message:w(),requestedSchema:F({type:ee("object"),properties:Gt(w(),WB),required:V(w()).optional()})}),KB=Fr.extend({mode:ee("url"),message:w(),elicitationId:w(),url:w().url()}),JB=ft([ZB,KB]),qv=rr.extend({method:ee("elicitation/create"),params:JB}),XB=so.extend({elicitationId:w()}),YB=vn.extend({method:ee("notifications/elicitation/complete"),params:XB}),Wv=fr.extend({action:tr(["accept","decline","cancel"]),content:Tv(t=>t===null?void 0:t,Gt(w(),ft([w(),et(),mt(),V(w())])).optional())}),QB=F({type:ee("ref/resource"),uri:w()});var ej=F({type:ee("ref/prompt"),name:w()}),tj=Fr.extend({ref:ft([ej,QB]),argument:F({name:w(),value:w()}),context:F({arguments:Gt(w(),w()).optional()}).optional()}),rj=rr.extend({method:ee("completion/complete"),params:tj});var Zv=fr.extend({completion:hr({values:V(w()).max(100),total:te(et().int()),hasMore:te(mt())})}),nj=F({uri:w().startsWith("file://"),name:w().optional(),_meta:Gt(w(),Ut()).optional()}),ij=rr.extend({method:ee("roots/list")}),aj=fr.extend({roots:V(nj)}),oj=vn.extend({method:ee("notifications/roots/list_changed")}),xae=ft([Cm,qF,rj,TB,hB,pB,QF,eB,rB,aB,sB,xB,wB,Am,Rm,Nm]),Eae=ft([Tm,Im,aI,oj,Xc]),Tae=ft([co,Hv,MB,Wv,aj,Pm,Om,uo]),Cae=ft([Cm,Vv,qv,ij,Am,Rm,Nm]),Iae=ft([Tm,Im,Gv,cB,nB,Uv,vB,Xc,YB]),Aae=ft([co,Av,Zv,Bv,Mv,Rv,Nv,Dv,Ys,jv,Pm,Om,uo]),le=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===he.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Cv(i.elicitations,r)}return new t(e,r,n)}},Cv=class extends le{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(he.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};function Sa(t){return t==="completed"||t==="failed"||t==="cancelled"}var sj=Symbol("Let zodToJsonSchema decide on which parser to use");var coe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Kv(t){let e=bm(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=fC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Jv(t,e){let r=Fn(t,e);if(!r.success)throw r.error;return r.data}var mj=6e4,Dm=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Tm,r=>{this._oncancel(r)}),this.setNotificationHandler(Im,r=>{this._onprogress(r)}),this.setRequestHandler(Cm,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Am,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Rm,async(r,n)=>{let i=async()=>{var a;let o=r.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(l.type==="response"||l.type==="error"){let c=l.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),l.type==="response")d(c);else{let m=c,p=new le(m.error.code,m.error.message,m.error.data);d(p)}else{let m=l.type==="response"?"Response":"Error";this._onerror(new Error(`${m} handler missing for request ${u}`))}continue}await((a=this._transport)===null||a===void 0?void 0:a.send(l.message,{relatedRequestId:n.requestId}))}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new le(he.InvalidParams,`Task not found: ${o}`);if(!Sa(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(Sa(s.status)){let l=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...l,_meta:{...l._meta,[oi]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Nm,async(r,n)=>{var i;try{let{tasks:a,nextCursor:o}=await this._taskStore.listTasks((i=r.params)===null||i===void 0?void 0:i.cursor,n.sessionId);return{tasks:a,nextCursor:o,_meta:{}}}catch(a){throw new le(he.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(sI,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new le(he.InvalidParams,`Task not found: ${r.params.taskId}`);if(Sa(i.status))throw new le(he.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new le(he.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof le?i:new le(he.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){let r=this._requestHandlerAbortControllers.get(e.params.requestId);r?.abort(e.params.reason)}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),le.fromError(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=l=>{o?.(l),this._onerror(l)};let s=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(l,c)=>{s?.(l,c),lo(l)||nI(l)?this._onresponse(l):qc(l)?this._onrequest(l,c):eI(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=le.fromError(he.ConnectionClosed,"Connection closed");this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i,a,o,s,l;let c=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,u=this._transport,d=(o=(a=(i=e.params)===null||i===void 0?void 0:i._meta)===null||a===void 0?void 0:a[oi])===null||o===void 0?void 0:o.taskId;if(c===void 0){let y={jsonrpc:"2.0",id:e.id,error:{code:he.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:y,timestamp:Date.now()},u?.sessionId).catch(g=>this._onerror(new Error(`Failed to enqueue error response: ${g}`))):u?.send(y).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)));return}let m=new AbortController;this._requestHandlerAbortControllers.set(e.id,m);let p=(s=e.params)===null||s===void 0?void 0:s.task,h=this._taskStore?this.requestTaskStore(e,u?.sessionId):void 0,f={signal:m.signal,sessionId:u?.sessionId,_meta:(l=e.params)===null||l===void 0?void 0:l._meta,sendNotification:async y=>{let g={relatedRequestId:e.id};d&&(g.relatedTask={taskId:d}),await this.notification(y,g)},sendRequest:async(y,g,x)=>{var v,I;let T={...x,relatedRequestId:e.id};d&&!T.relatedTask&&(T.relatedTask={taskId:d});let C=(I=(v=T.relatedTask)===null||v===void 0?void 0:v.taskId)!==null&&I!==void 0?I:d;return C&&h&&await h.updateTaskStatus(C,"input_required"),await this.request(y,g,T)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:d,taskStore:h,taskRequestedTtl:p?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>c(e,f)).then(async y=>{if(m.signal.aborted)return;let g={result:y,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:g,timestamp:Date.now()},u?.sessionId):await u?.send(g)},async y=>{var g;if(m.signal.aborted)return;let x={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(y.code)?y.code:he.InternalError,message:(g=y.message)!==null&&g!==void 0?g:"Internal error",...y.data!==void 0&&{data:y.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:x,timestamp:Date.now()},u?.sessionId):await u?.send(x)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(l);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),lo(e))n(e);else{let o=new le(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(lo(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),lo(e))i(e);else{let o=le.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}async*requestStream(e,r,n){var i,a,o,s;let{task:l}=n??{};if(!l){try{yield{type:"result",result:await this.request(e,r,n)}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}return}let c;try{let u=await this.request(e,uo,n);if(u.task)c=u.task.taskId,yield{type:"taskCreated",task:u.task};else throw new le(he.InternalError,"Task creation did not return a task");for(;;){let d=await this.getTask({taskId:c},n);if(yield{type:"taskStatus",task:d},Sa(d.status)){d.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)}:d.status==="failed"?yield{type:"error",error:new le(he.InternalError,`Task ${c} failed`)}:d.status==="cancelled"&&(yield{type:"error",error:new le(he.InternalError,`Task ${c} was cancelled`)});return}if(d.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:c},r,n)};return}let m=(o=(i=d.pollInterval)!==null&&i!==void 0?i:(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&o!==void 0?o:1e3;await new Promise(p=>setTimeout(p,m)),(s=n?.signal)===null||s===void 0||s.throwIfAborted()}}catch(u){yield{type:"error",error:u instanceof le?u:new le(he.InternalError,String(u))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:l}=n??{};return new Promise((c,u)=>{var d,m,p,h,f,y,g;let x=$=>{u($)};if(!this._transport){x(new Error("Not connected"));return}if(((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch($){x($);return}(m=n?.signal)===null||m===void 0||m.throwIfAborted();let v=this._requestMessageId++,I={...e,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),I.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:v}}),s&&(I.params={...I.params,task:s}),l&&(I.params={...I.params,_meta:{...((h=I.params)===null||h===void 0?void 0:h._meta)||{},[oi]:l}});let T=$=>{var B;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String($)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(H=>this._onerror(new Error(`Failed to send cancellation: ${H}`)));let Y=$ instanceof le?$:new le(he.RequestTimeout,String($));u(Y)};this._responseHandlers.set(v,$=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if($ instanceof Error)return u($);try{let Y=Fn(r,$.result);Y.success?c(Y.data):u(Y.error)}catch(Y){u(Y)}}}),(f=n?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var $;T(($=n?.signal)===null||$===void 0?void 0:$.reason)});let C=(y=n?.timeout)!==null&&y!==void 0?y:mj,M=()=>T(le.fromError(he.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(v,C,n?.maxTotalTimeout,M,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1);let W=l?.taskId;if(W){let $=B=>{let Y=this._responseHandlers.get(v);Y?Y(B):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,$),this._enqueueTaskMessage(W,{type:"request",message:I,timestamp:Date.now()}).catch(B=>{this._cleanupTimeout(v),u(B)})}else this._transport.send(I,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch($=>{this._cleanupTimeout(v),u($)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Pm,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Om,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},lI,r)}async notification(e,r){var n,i,a,o,s;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let l=(n=r?.relatedTask)===null||n===void 0?void 0:n.taskId;if(l){let m={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((i=e.params)===null||i===void 0?void 0:i._meta)||{},[oi]:r.relatedTask}}};await this._enqueueTaskMessage(l,{type:"notification",message:m,timestamp:Date.now()});return}if(((o=(a=this._options)===null||a===void 0?void 0:a.debouncedNotificationMethods)!==null&&o!==void 0?o:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var m,p;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let h={...e,jsonrpc:"2.0"};r?.relatedTask&&(h={...h,params:{...h.params,_meta:{...((m=h.params)===null||m===void 0?void 0:m._meta)||{},[oi]:r.relatedTask}}}),(p=this._transport)===null||p===void 0||p.send(h,r).catch(f=>this._onerror(f))});return}let d={...e,jsonrpc:"2.0"};r?.relatedTask&&(d={...d,params:{...d.params,_meta:{...((s=d.params)===null||s===void 0?void 0:s._meta)||{},[oi]:r.relatedTask}}}),await this._transport.send(d,r)}setRequestHandler(e,r){let n=Kv(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=Jv(e,i);return Promise.resolve(r(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Kv(e);this._notificationHandlers.set(n,i=>{let a=Jv(e,i);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){var i;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let a=(i=this._options)===null||i===void 0?void 0:i.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,a)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&qc(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new le(he.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var n,i,a;let o=(i=(n=this._options)===null||n===void 0?void 0:n.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;try{let s=await((a=this._taskStore)===null||a===void 0?void 0:a.getTask(e));s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,l)=>{if(r.aborted){l(new le(he.InvalidRequest,"Request cancelled"));return}let c=setTimeout(s,o);r.addEventListener("abort",()=>{clearTimeout(c),l(new le(he.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new le(he.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let l=Xc.parse({method:"notifications/tasks/status",params:s});await this.notification(l),Sa(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new le(he.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Sa(s.status))throw new le(he.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let l=await n.getTask(i,r);if(l){let c=Xc.parse({method:"notifications/tasks/status",params:l});await this.notification(c),Sa(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function fI(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gI(t,e){let r={...t};for(let n in e){let i=n,a=e[i];if(a===void 0)continue;let o=r[i];fI(o)&&fI(a)?r[i]={...o,...a}:r[i]=a}return r}var yO=ep(UP(),1),bO=ep(gO(),1);function J5(){let t=new yO.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bO.default)(t),t}var Zh=class{constructor(e){this._ajv=e??J5()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Kh=class{constructor(e){this._client=e}async*callToolStream(e,r=Ys,n){var i;let a=this._client,o={...n,task:(i=n?.task)!==null&&i!==void 0?i:a.isToolTask(e.name)?{}:void 0},s=a.requestStream({method:"tools/call",params:e},r,o),l=a.getToolOutputValidator(e.name);for await(let c of s){if(c.type==="result"&&l){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let d=l(u.structuredContent);if(!d.valid){yield{type:"error",error:new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof le){yield{type:"error",error:d};return}yield{type:"error",error:new le(he.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function vO(t,e,r){var n;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!(!((n=t.tools)===null||n===void 0)&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function _O(t,e,r){var n,i;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(!((n=t.sampling)===null||n===void 0)&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(!((i=t.elicitation)===null||i===void 0)&&i.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Jh(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let a=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[i]=a.default),r[i]!==void 0&&Jh(a,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)Jh(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)Jh(r,e)}}function X5(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var nd=class extends Dm{constructor(e,r){var n,i;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(i=r?.jsonSchemaValidator)!==null&&i!==void 0?i:new Zh}get experimental(){return this._experimental||(this._experimental={tasks:new Kh(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=gI(this._capabilities,e)}setRequestHandler(e,r){var n,i,a;let o=bm(e),s=o?.method;if(!s)throw new Error("Schema is missing a method literal");let l;if(Ws(s)){let u=s,d=(n=u._zod)===null||n===void 0?void 0:n.def;l=(i=d?.value)!==null&&i!==void 0?i:u.value}else{let u=s,d=u._def;l=(a=d?.value)!==null&&a!==void 0?a:u.value}if(typeof l!="string")throw new Error("Schema method literal must be a string");let c=l;if(c==="elicitation/create"){let u=async(d,m)=>{var p,h,f;let y=Fn(qv,d);if(!y.success){let $=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid elicitation request: ${$}`)}let{params:g}=y.data,x=(p=g.mode)!==null&&p!==void 0?p:"form",{supportsFormMode:v,supportsUrlMode:I}=X5(this._capabilities.elicitation);if(x==="form"&&!v)throw new le(he.InvalidParams,"Client does not support form-mode elicitation requests");if(x==="url"&&!I)throw new le(he.InvalidParams,"Client does not support URL-mode elicitation requests");let T=await Promise.resolve(r(d,m));if(g.task){let $=Fn(uo,T);if(!$.success){let B=$.error instanceof Error?$.error.message:String($.error);throw new le(he.InvalidParams,`Invalid task creation result: ${B}`)}return $.data}let C=Fn(Wv,T);if(!C.success){let $=C.error instanceof Error?C.error.message:String(C.error);throw new le(he.InvalidParams,`Invalid elicitation result: ${$}`)}let M=C.data,W=x==="form"?g.requestedSchema:void 0;if(x==="form"&&M.action==="accept"&&M.content&&W&&!((f=(h=this._capabilities.elicitation)===null||h===void 0?void 0:h.form)===null||f===void 0)&&f.applyDefaults)try{Jh(W,M.content)}catch{}return M};return super.setRequestHandler(e,u)}if(c==="sampling/createMessage"){let u=async(d,m)=>{let p=Fn(Vv,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new le(he.InvalidParams,`Invalid sampling request: ${g}`)}let{params:h}=p.data,f=await Promise.resolve(r(d,m));if(h.task){let g=Fn(uo,f);if(!g.success){let x=g.error instanceof Error?g.error.message:String(g.error);throw new le(he.InvalidParams,`Invalid task creation result: ${x}`)}return g.data}let y=Fn(Hv,f);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new le(he.InvalidParams,`Invalid sampling result: ${g}`)}return y.data};return super.setRequestHandler(e,u)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Ks,capabilities:this._capabilities,clientInfo:this._clientInfo}},Av,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!KC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,a,o;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){var r,n;vO((n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&_O((r=this._capabilities.tasks)===null||r===void 0?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},co,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Zv,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},co,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Bv,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Mv,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Rv,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Nv,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Dv,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},co,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},co,r)}async callTool(e,r=Ys,n){if(this.isToolTaskRequired(e.name))throw new le(he.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),a=this.getToolOutputValidator(e.name);if(a){if(!i.structuredContent&&!i.isError)throw new le(he.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let o=a(i.structuredContent);if(!o.valid)throw new le(he.InvalidParams,`Structured content does not match the tool's output schema: ${o.errorMessage}`)}catch(o){throw o instanceof le?o:new le(he.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return i}isToolTask(e){var r,n,i,a;return!((a=(i=(n=(r=this._serverCapabilities)===null||r===void 0?void 0:r.tasks)===null||n===void 0?void 0:n.requests)===null||i===void 0?void 0:i.tools)===null||a===void 0)&&a.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let n of e){if(n.outputSchema){let a=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,a)}let i=(r=n.execution)===null||r===void 0?void 0:r.taskSupport;(i==="required"||i==="optional")&&this._cachedKnownTaskTools.add(n.name),i==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},jv,r);return this.cacheToolMetadata(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function Cl(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Xh(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...Cl(e.headers),...Cl(n.headers)}:e.headers};return t(r,i)}:t}var vk;vk=globalThis.crypto;async function Y5(t){return(await vk).getRandomValues(new Uint8Array(t))}async function Q5(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await Y5(t);for(let i=0;i<t;i++){let a=n[i]%e.length;r+=e[a]}return r}async function e9(t){return await Q5(t)}async function t9(t){let e=await(await vk).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function _k(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await e9(t),r=await t9(e);return{code_verifier:e,code_challenge:r}}var cr=MC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:WC.custom,message:"URL must be parseable",fatal:!0}),Vp}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),wO=hr({resource:w().url(),authorization_servers:V(cr).optional(),jwks_uri:w().url().optional(),scopes_supported:V(w()).optional(),bearer_methods_supported:V(w()).optional(),resource_signing_alg_values_supported:V(w()).optional(),resource_name:w().optional(),resource_documentation:w().optional(),resource_policy_uri:w().url().optional(),resource_tos_uri:w().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:V(w()).optional(),dpop_signing_alg_values_supported:V(w()).optional(),dpop_bound_access_tokens_required:mt().optional()}),Sk=hr({issuer:w(),authorization_endpoint:cr,token_endpoint:cr,registration_endpoint:cr.optional(),scopes_supported:V(w()).optional(),response_types_supported:V(w()),response_modes_supported:V(w()).optional(),grant_types_supported:V(w()).optional(),token_endpoint_auth_methods_supported:V(w()).optional(),token_endpoint_auth_signing_alg_values_supported:V(w()).optional(),service_documentation:cr.optional(),revocation_endpoint:cr.optional(),revocation_endpoint_auth_methods_supported:V(w()).optional(),revocation_endpoint_auth_signing_alg_values_supported:V(w()).optional(),introspection_endpoint:w().optional(),introspection_endpoint_auth_methods_supported:V(w()).optional(),introspection_endpoint_auth_signing_alg_values_supported:V(w()).optional(),code_challenge_methods_supported:V(w()).optional(),client_id_metadata_document_supported:mt().optional()}),r9=hr({issuer:w(),authorization_endpoint:cr,token_endpoint:cr,userinfo_endpoint:cr.optional(),jwks_uri:cr,registration_endpoint:cr.optional(),scopes_supported:V(w()).optional(),response_types_supported:V(w()),response_modes_supported:V(w()).optional(),grant_types_supported:V(w()).optional(),acr_values_supported:V(w()).optional(),subject_types_supported:V(w()),id_token_signing_alg_values_supported:V(w()),id_token_encryption_alg_values_supported:V(w()).optional(),id_token_encryption_enc_values_supported:V(w()).optional(),userinfo_signing_alg_values_supported:V(w()).optional(),userinfo_encryption_alg_values_supported:V(w()).optional(),userinfo_encryption_enc_values_supported:V(w()).optional(),request_object_signing_alg_values_supported:V(w()).optional(),request_object_encryption_alg_values_supported:V(w()).optional(),request_object_encryption_enc_values_supported:V(w()).optional(),token_endpoint_auth_methods_supported:V(w()).optional(),token_endpoint_auth_signing_alg_values_supported:V(w()).optional(),display_values_supported:V(w()).optional(),claim_types_supported:V(w()).optional(),claims_supported:V(w()).optional(),service_documentation:w().optional(),claims_locales_supported:V(w()).optional(),ui_locales_supported:V(w()).optional(),claims_parameter_supported:mt().optional(),request_parameter_supported:mt().optional(),request_uri_parameter_supported:mt().optional(),require_request_uri_registration:mt().optional(),op_policy_uri:cr.optional(),op_tos_uri:cr.optional(),client_id_metadata_document_supported:mt().optional()}),kO=F({...r9.shape,...Sk.pick({code_challenge_methods_supported:!0}).shape}),xO=F({access_token:w(),id_token:w().optional(),token_type:w(),expires_in:wm.number().optional(),scope:w().optional(),refresh_token:w().optional()}).strip(),EO=F({error:w(),error_description:w().optional(),error_uri:w().optional()}),SO=cr.optional().or(ee("").transform(()=>{})),n9=F({redirect_uris:V(cr),token_endpoint_auth_method:w().optional(),grant_types:V(w()).optional(),response_types:V(w()).optional(),client_name:w().optional(),client_uri:cr.optional(),logo_uri:SO,scope:w().optional(),contacts:V(w()).optional(),tos_uri:SO,policy_uri:w().optional(),jwks_uri:cr.optional(),jwks:LC().optional(),software_id:w().optional(),software_version:w().optional(),software_statement:w().optional()}).strip(),i9=F({client_id:w(),client_secret:w().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),TO=n9.merge(i9),Hde=F({error:w(),error_description:w().optional()}).strip(),qde=F({token:w(),token_type_hint:w().optional()}).strip();function CO(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function IO({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(a)}var Dt=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},id=class extends Dt{};id.errorCode="invalid_request";var No=class extends Dt{};No.errorCode="invalid_client";var Oo=class extends Dt{};Oo.errorCode="invalid_grant";var Do=class extends Dt{};Do.errorCode="unauthorized_client";var ad=class extends Dt{};ad.errorCode="unsupported_grant_type";var od=class extends Dt{};od.errorCode="invalid_scope";var sd=class extends Dt{};sd.errorCode="access_denied";var Ki=class extends Dt{};Ki.errorCode="server_error";var ld=class extends Dt{};ld.errorCode="temporarily_unavailable";var cd=class extends Dt{};cd.errorCode="unsupported_response_type";var ud=class extends Dt{};ud.errorCode="unsupported_token_type";var dd=class extends Dt{};dd.errorCode="invalid_token";var pd=class extends Dt{};pd.errorCode="method_not_allowed";var md=class extends Dt{};md.errorCode="too_many_requests";var Mo=class extends Dt{};Mo.errorCode="invalid_client_metadata";var hd=class extends Dt{};hd.errorCode="insufficient_scope";var fd=class extends Dt{};fd.errorCode="invalid_target";var AO={[id.errorCode]:id,[No.errorCode]:No,[Oo.errorCode]:Oo,[Do.errorCode]:Do,[ad.errorCode]:ad,[od.errorCode]:od,[sd.errorCode]:sd,[Ki.errorCode]:Ki,[ld.errorCode]:ld,[cd.errorCode]:cd,[ud.errorCode]:ud,[dd.errorCode]:dd,[pd.errorCode]:pd,[md.errorCode]:md,[Mo.errorCode]:Mo,[hd.errorCode]:hd,[fd.errorCode]:fd};var Rr=class extends Error{constructor(e){super(e??"Unauthorized")}};function a9(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var wk="code",kk="S256";function o9(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&a9(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function s9(t,e,r,n){let{client_id:i,client_secret:a}=e;switch(t){case"client_secret_basic":l9(i,a,r);return;case"client_secret_post":c9(i,a,n);return;case"none":u9(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function l9(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function c9(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function u9(t,e){e.set("client_id",t)}async function RO(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=EO.parse(JSON.parse(r)),{error:i,error_description:a,error_uri:o}=n,s=AO[i]||Ki;return new s(a||"",o)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ki(i)}}async function Ji(t,e){var r,n;try{return await xk(t,e)}catch(i){if(i instanceof No||i instanceof Do)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await xk(t,e);if(i instanceof Oo)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await xk(t,e);throw i}}async function xk(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:a}){var o,s;let l,c;try{l=await m9(e,{resourceMetadataUrl:i},a),l.authorization_servers&&l.authorization_servers.length>0&&(c=l.authorization_servers[0])}catch{}c||(c=new URL("/",e));let u=await p9(e,t,l),d=await b9(c,{fetchFn:a}),m=await Promise.resolve(t.clientInformation());if(!m){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let x=d?.client_id_metadata_document_supported===!0,v=t.clientMetadataUrl;if(v&&!d9(v))throw new Mo(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(x&&v)m={client_id:v},await((o=t.saveClientInformation)===null||o===void 0?void 0:o.call(t,m));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let T=await k9(c,{metadata:d,clientMetadata:t.clientMetadata,fetchFn:a});await t.saveClientInformation(T),m=T}}let p=!t.redirectUrl;if(r!==void 0||p){let x=await w9(t,c,{metadata:d,resource:u,authorizationCode:r,fetchFn:a});return await t.saveTokens(x),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let x=await S9(c,{metadata:d,clientInformation:m,refreshToken:h.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:a});return await t.saveTokens(x),"AUTHORIZED"}catch(x){if(!(!(x instanceof Dt)||x instanceof Ki))throw x}let f=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await v9(c,{metadata:d,clientInformation:m,state:f,redirectUrl:t.redirectUrl,scope:n||((s=l?.scopes_supported)===null||s===void 0?void 0:s.join(" "))||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function d9(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function p9(t,e,r){let n=CO(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!IO({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Il(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=Ek(t,"resource_metadata")||void 0,a;if(i)try{a=new URL(i)}catch{}let o=Ek(t,"scope")||void 0,s=Ek(t,"error")||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function Ek(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function m9(t,e,r=fetch){var n,i;let a=await g9(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!a||a.status===404)throw await((n=a?.body)===null||n===void 0?void 0:n.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!a.ok)throw await((i=a.body)===null||i===void 0?void 0:i.cancel()),new Error(`HTTP ${a.status} trying to load well-known OAuth protected resource metadata.`);return wO.parse(await a.json())}async function Tk(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Tk(t,void 0,r):void 0;throw n}}function h9(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function PO(t,e,r=fetch){return await Tk(t,{"MCP-Protocol-Version":e},r)}function f9(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function g9(t,e,r,n){var i,a;let o=new URL(t),s=(i=n?.protocolVersion)!==null&&i!==void 0?i:Ks,l;if(n?.metadataUrl)l=new URL(n.metadataUrl);else{let u=h9(e,o.pathname);l=new URL(u,(a=n?.metadataServerUrl)!==null&&a!==void 0?a:o),l.search=o.search}let c=await PO(l,s,r);if(!n?.metadataUrl&&f9(c,o.pathname)){let u=new URL(`/.well-known/${e}`,o);c=await PO(u,s,r)}return c}function y9(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function b9(t,{fetchFn:e=fetch,protocolVersion:r=Ks}={}){var n;let i={"MCP-Protocol-Version":r,Accept:"application/json"},a=y9(t);for(let{url:o,type:s}of a){let l=await Tk(o,i,e);if(l){if(!l.ok){if(await((n=l.body)===null||n===void 0?void 0:n.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?Sk.parse(await l.json()):kO.parse(await l.json())}}}async function v9(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:a,resource:o}){let s;if(e){if(s=new URL(e.authorization_endpoint),!e.response_types_supported.includes(wk))throw new Error(`Incompatible auth server: does not support response type ${wk}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(kk))throw new Error(`Incompatible auth server: does not support code challenge method ${kk}`)}else s=new URL("/authorize",t);let l=await _k(),c=l.code_verifier,u=l.code_challenge;return s.searchParams.set("response_type",wk),s.searchParams.set("client_id",r.client_id),s.searchParams.set("code_challenge",u),s.searchParams.set("code_challenge_method",kk),s.searchParams.set("redirect_uri",String(n)),a&&s.searchParams.set("state",a),i&&s.searchParams.set("scope",i),i?.includes("offline_access")&&s.searchParams.append("prompt","consent"),o&&s.searchParams.set("resource",o.href),{authorizationUrl:s,codeVerifier:c}}function _9(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function NO(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:o}){var s;let l=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(a&&r.set("resource",a.href),i)await i(c,r,l,e);else if(n){let d=(s=e?.token_endpoint_auth_methods_supported)!==null&&s!==void 0?s:[],m=o9(n,d);s9(m,n,c,r)}let u=await(o??fetch)(l,{method:"POST",headers:c,body:r});if(!u.ok)throw await RO(u);return xO.parse(await u.json())}async function S9(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:a,fetchFn:o}){let s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await NO(t,{metadata:e,tokenRequestParams:s,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:o});return{refresh_token:n,...l}}async function w9(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:a}={}){let o=t.clientMetadata.scope,s;if(t.prepareTokenRequest&&(s=await t.prepareTokenRequest(o)),!s){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();s=_9(i,c,t.redirectUrl)}let l=await t.clientInformation();return NO(e,{metadata:r,tokenRequestParams:s,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:a})}async function k9(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let a=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await RO(a);return TO.parse(await a.json())}var Yh=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Ck(t){}function Qh(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ck,onError:r=Ck,onRetry:n=Ck,onComment:i}=t,a="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[g,x]=x9(`${a}${y}`);for(let v of g)d(v);a=x,o=!1}function d(f){if(f===""){p();return}if(f.startsWith(":")){i&&i(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let g=f.slice(0,y),x=f[y+1]===" "?2:1,v=f.slice(y+x);m(g,v,f);return}m(f,"",f)}function m(f,y,g){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3311
|
+
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new Yh(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:g}));break;default:r(new Yh(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:y,line:g}));break}}function p(){l.length>0&&e({id:s,event:c||void 0,data:l.endsWith(`
|
|
3312
|
+
`)?l.slice(0,-1):l}),s=void 0,l="",c=""}function h(f={}){a&&f.consume&&d(a),o=!0,s=void 0,l="",c="",a=""}return{feed:u,reset:h}}function x9(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),a=t.indexOf(`
|
|
3313
3313
|
`,n),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i!==-1?o=i:a!==-1&&(o=a),o===-1){r=t.slice(n);break}else{let s=t.slice(n,o);e.push(s),n=o+1,t[n-1]==="\r"&&t[n]===`
|
|
3314
|
-
`&&n++}}return[e,r]}var Yh=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(a){i=Xh({onEvent:o=>{a.enqueue(o)},onError(o){e==="terminate"?a.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:n})},transform(a){i.feed(a)}})}};var x9={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},$a=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Qh=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Kh(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:x9}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Tl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i,a;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let l=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!l.ok){if(await((i=l.body)===null||i===void 0?void 0:i.cancel()),l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new $a(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:a}=r,o,s=!1,l=!1;(async()=>{var u,d,m,p;try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new Yh({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){let{value:g,done:S}=await h.read();if(S)break;if(g.id&&(o=g.id,s=!0,i?.(g.id)),!!g.data&&(!g.event||g.event==="message"))try{let v=Js.parse(JSON.parse(g.data));lo(v)&&(l=!0,a!==void 0&&(v.id=a)),(u=this.onmessage)===null||u===void 0||u.call(this,v)}catch(v){(d=this.onerror)===null||d===void 0||d.call(this,v)}}(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(h){if((m=this.onerror)===null||m===void 0||m.call(this,new Error(`SSE stream disconnected: ${h}`)),(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(g){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,a,o,s;try{let{resumptionToken:l,onresumptiontoken:c}=r||{};if(l){this._startOrAuthSse({resumptionToken:l,replayMessageId:Gc(e)?e.id:void 0}).catch(g=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,g)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},m=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=m.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!m.ok){let g=await m.text().catch(()=>null);if(m.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $a(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:S,scope:v}=Cl(m);if(this._resourceMetadataUrl=S,this._scope=v,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(m.status===403&&this._authProvider){let{resourceMetadataUrl:S,scope:v,error:I}=Cl(m);if(I==="insufficient_scope"){let T=m.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===T)throw new $a(403,"Server returned 403 after trying upscoping");if(v&&(this._scope=v),S&&(this._resourceMetadataUrl=S),this._lastUpscopingHeader=T??void 0,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rr;return this.send(e)}}throw new $a(m.status,`Error POSTing to endpoint: ${g}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,m.status===202){await((a=m.body)===null||a===void 0?void 0:a.cancel()),aI(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>{var S;return(S=this.onerror)===null||S===void 0?void 0:S.call(this,g)});return}let f=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,y=m.headers.get("content-type");if(f)if(y?.includes("text/event-stream"))this._handleSseStream(m.body,{onresumptiontoken:c},!1);else if(y?.includes("application/json")){let g=await m.json(),S=Array.isArray(g)?g.map(v=>Js.parse(v)):[Js.parse(g)];for(let v of S)(o=this.onmessage)===null||o===void 0||o.call(this,v)}else throw new $a(-1,`Unexpected content type: ${y}`)}catch(l){throw(s=this.onerror)===null||s===void 0||s.call(this,l),l}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,i;if(this._sessionId)try{let a=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(await((n=s.body)===null||n===void 0?void 0:n.cancel()),!s.ok&&s.status!==405)throw new $a(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var tf=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(NO(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(NO(this),r)}};function E9(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function bk(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(bk).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${bk(t.cause)}`:t.message:`${t}`}function NO(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var DO=t=>{throw TypeError(t)},Tk=(t,e,r)=>e.has(t)||DO("Cannot "+r),De=(t,e,r)=>(Tk(t,e,"read from private field"),r?r.call(t):e.get(t)),Vt=(t,e,r)=>e.has(t)?DO("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),wt=(t,e,r,n)=>(Tk(t,e,"write to private field"),e.set(t,r),r),Xi=(t,e,r)=>(Tk(t,e,"access private method"),r),Wr,$o,Il,ef,rf,fd,Rl,gd,La,Al,Nl,Pl,md,Kn,vk,_k,Sk,OO,wk,kk,hd,xk,Ek,Lo=class extends EventTarget{constructor(e,r){var n,i;super(),Vt(this,Kn),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Vt(this,Wr),Vt(this,$o),Vt(this,Il),Vt(this,ef),Vt(this,rf),Vt(this,fd),Vt(this,Rl),Vt(this,gd,null),Vt(this,La),Vt(this,Al),Vt(this,Nl,null),Vt(this,Pl,null),Vt(this,md,null),Vt(this,_k,async a=>{var o;De(this,Al).reset();let{body:s,redirected:l,status:c,headers:u}=a;if(c===204){Xi(this,Kn,hd).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?wt(this,Il,new URL(a.url)):wt(this,Il,void 0),c!==200){Xi(this,Kn,hd).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Xi(this,Kn,hd).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.OPEN);let d=new Event("open");if((o=De(this,md))==null||o.call(this,d),this.dispatchEvent(d),typeof s!="object"||!s||!("getReader"in s)){Xi(this,Kn,hd).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,p=s.getReader(),h=!0;do{let{done:f,value:y}=await p.read();y&&De(this,Al).feed(m.decode(y,{stream:!f})),f&&(h=!1,De(this,Al).reset(),Xi(this,Kn,xk).call(this))}while(h)}),Vt(this,Sk,a=>{wt(this,La,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Xi(this,Kn,xk).call(this,bk(a))}),Vt(this,wk,a=>{typeof a.id=="string"&&wt(this,gd,a.id);let o=new MessageEvent(a.event||"message",{data:a.data,origin:De(this,Il)?De(this,Il).origin:De(this,$o).origin,lastEventId:a.id||""});De(this,Pl)&&(!a.event||a.event==="message")&&De(this,Pl).call(this,o),this.dispatchEvent(o)}),Vt(this,kk,a=>{wt(this,fd,a)}),Vt(this,Ek,()=>{wt(this,Rl,void 0),De(this,Wr)===this.CONNECTING&&Xi(this,Kn,vk).call(this)});try{if(e instanceof URL)wt(this,$o,e);else if(typeof e=="string")wt(this,$o,new URL(e,T9()));else throw new Error("Invalid URL")}catch{throw E9("An invalid or illegal string was specified")}wt(this,Al,Xh({onEvent:De(this,wk),onRetry:De(this,kk)})),wt(this,Wr,this.CONNECTING),wt(this,fd,3e3),wt(this,rf,(n=r?.fetch)!=null?n:globalThis.fetch),wt(this,ef,(i=r?.withCredentials)!=null?i:!1),Xi(this,Kn,vk).call(this)}get readyState(){return De(this,Wr)}get url(){return De(this,$o).href}get withCredentials(){return De(this,ef)}get onerror(){return De(this,Nl)}set onerror(e){wt(this,Nl,e)}get onmessage(){return De(this,Pl)}set onmessage(e){wt(this,Pl,e)}get onopen(){return De(this,md)}set onopen(e){wt(this,md,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){De(this,Rl)&&clearTimeout(De(this,Rl)),De(this,Wr)!==this.CLOSED&&(De(this,La)&&De(this,La).abort(),wt(this,Wr,this.CLOSED),wt(this,La,void 0))}};Wr=new WeakMap,$o=new WeakMap,Il=new WeakMap,ef=new WeakMap,rf=new WeakMap,fd=new WeakMap,Rl=new WeakMap,gd=new WeakMap,La=new WeakMap,Al=new WeakMap,Nl=new WeakMap,Pl=new WeakMap,md=new WeakMap,Kn=new WeakSet,vk=function(){wt(this,Wr,this.CONNECTING),wt(this,La,new AbortController),De(this,rf)(De(this,$o),Xi(this,Kn,OO).call(this)).then(De(this,_k)).catch(De(this,Sk))},_k=new WeakMap,Sk=new WeakMap,OO=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...De(this,gd)?{"Last-Event-ID":De(this,gd)}:void 0},cache:"no-store",signal:(t=De(this,La))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},wk=new WeakMap,kk=new WeakMap,hd=function(t,e){var r;De(this,Wr)!==this.CLOSED&&wt(this,Wr,this.CLOSED);let n=new tf("error",{code:e,message:t});(r=De(this,Nl))==null||r.call(this,n),this.dispatchEvent(n)},xk=function(t,e){var r;if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.CONNECTING);let n=new tf("error",{code:e,message:t});(r=De(this,Nl))==null||r.call(this,n),this.dispatchEvent(n),wt(this,Rl,setTimeout(De(this,Ek),De(this,fd)))},Ek=new WeakMap,Lo.CONNECTING=0,Lo.OPEN=1,Lo.CLOSED=2;function T9(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Ck=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},nf=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Kh(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Tl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((a,o)=>{this._eventSource=new Lo(this._url.href,{...this._eventSourceInit,fetch:async(s,l)=>{let c=await this._commonHeaders();c.set("Accept","text/event-stream");let u=await i(s,{...l,headers:c});if(u.status===401&&u.headers.has("www-authenticate")){let{resourceMetadataUrl:d,scope:m}=Cl(u);this._resourceMetadataUrl=d,this._scope=m}return u}}),this._abortController=new AbortController,this._eventSource.onerror=s=>{var l;if(s.code===401&&this._authProvider){this._authThenStart().then(a,o);return}let c=new Ck(s.code,s.message,s);o(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",s=>{var l;let c=s;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){o(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}a()}),this._eventSource.onmessage=s=>{var l,c;let u=s,d;try{d=Js.parse(JSON.parse(u.data))}catch(m){(l=this.onerror)===null||l===void 0||l.call(this,m);return}(c=this.onmessage)===null||c===void 0||c.call(this,d)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let a=await this._commonHeaders();a.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},s=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,o);if(!s.ok){let l=await s.text().catch(()=>null);if(s.status===401&&this._authProvider){let{resourceMetadataUrl:c,scope:u}=Cl(s);if(this._resourceMetadataUrl=c,this._scope=u,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${s.status}): ${l}`)}}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}};var Yi={name:"@intelliweave/embedded",version:"1.9.69-beta.5",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.60.0","@modelcontextprotocol/sdk":"^1.24.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ht=new Re("MCPKnowledgeClient"),af=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ht.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new ed({name:Yi.name,version:Yi.version}),n=new Qh(new URL(this.config.baseURL));return await r.connect(n),Ht.debug("Connected with HTTP streaming mode"),r}).catch(async r=>{let n=new ed({name:Yi.name,version:Yi.version}),i=new nf(new URL(this.config.baseURL));return await n.connect(i),Ht.debug("Connected with SSE mode"),n});return await this.disconnect(),this.client=e,e.onerror=r=>{Ht.error(`MCP client error: ${r.message}`)},e.onclose=()=>{Ht.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(Ov,r=>{r.params.level=="critical"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="error"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="warning"?Ht.warn(`[Server] ${r.params.data}`):r.params.level=="info"?Ht.info(`[Server] ${r.params.data}`):r.params.level=="debug"?Ht.debug(`[Server] ${r.params.data}`):Ht.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(Nv,r=>{Ht.debug("Tool list changed",r),this.fetchTools()}),Ht.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let i=await this.client.listTools({cursor:r});r=i.nextCursor;for(let a of i.tools||[])e.push(a);if(!i?.tools?.length||!r)break}let n=[];for(let i of e){let a=!!(this.config.searchToolName&&i.name==this.config.searchToolName&&!this.config.searchToolVisible);n.push({id:i.name,name:i.name,content:i.description||"",type:"action",isContext:!0,parameters:i.inputSchema,action:o=>this.performToolCall(i.name,o),disabled:a})}Ht.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,Ht.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(a=>a.name==this.config.searchToolName);if(!n)return Ht.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let a=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let a=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];r.push({id:this.config.id+":"+this.config.searchToolName+":"+a,name:`Search result ${a+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),Ht.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw Ht.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var I9=new Re("Statistics"),yd=[];async function Nr(t,e){let r={...e,event_id:_t(),event_date:new Date().toISOString(),sdk_version:Yi.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(yd.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),yd.length===0))return;let n=yd.slice();yd.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){I9.warn("Failed to submit analytics event:",i),yd.push(...n);return}}var zo=new Re("KnowledgeBase"),Ik=1,of=class t{constructor(e){this._sources=[{id:"core.internal",query:async()=>_T(this.ai)}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${Ik++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return ht().knowledgeBaseSources&&(e=e.concat(ht().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(r=>!r.disabled),e}async search(e){let r=Date.now();zo.debug(`Searching knowledge base for: ${e}`);let n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],typeof document<"u"&&document.dispatchEvent(n),this._windowSources=n.sources;let a=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),d=await c.query(e);return zo.debug(`Source '${c.id}' took ${Date.now()-u}ms`),d||[]}catch(u){return zo.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();a=a.concat(n.entries),a=a.concat(this.manualEntries),ht().knowledgeBase&&(a=a.concat(ht().knowledgeBase)),a=a.filter(c=>c&&!c.disabled);for(let c=0;c<a.length;c++){let u=a[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=d=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=d=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let o=new vT({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});o.addAll(a);let l=o.search(e).map(c=>a.find(u=>u.id==c.id));for(let c of a)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Nr(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),zo.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${Ik++}`),zo.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],a=!0,o=async(l,c)=>{zo.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){zo.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>o(c,d)})}};this.registerSource(r,async l=>{if(a&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,i.includes(l)||i.push(l),s(d.items),n})}clone(){let e=new t(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${Ik++}`);let r=new af(e);return this.registerSource(e.id,n=>r.search(n)),r}};var sf=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
3314
|
+
`&&n++}}return[e,r]}var ef=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(a){i=Qh({onEvent:o=>{a.enqueue(o)},onError(o){e==="terminate"?a.error(o):typeof e=="function"&&e(o)},onRetry:r,onComment:n})},transform(a){i.feed(a)}})}};var E9={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},$a=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},tf=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Xh(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:E9}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Cl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i,a;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let l=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!l.ok){if(await((i=l.body)===null||i===void 0?void 0:i.cancel()),l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new $a(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:a}=r,o,s=!1,l=!1;(async()=>{var u,d,m,p;try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new ef({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){let{value:g,done:x}=await h.read();if(x)break;if(g.id&&(o=g.id,s=!0,i?.(g.id)),!!g.data&&(!g.event||g.event==="message"))try{let v=Js.parse(JSON.parse(g.data));lo(v)&&(l=!0,a!==void 0&&(v.id=a)),(u=this.onmessage)===null||u===void 0||u.call(this,v)}catch(v){(d=this.onerror)===null||d===void 0||d.call(this,v)}}(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(h){if((m=this.onerror)===null||m===void 0||m.call(this,new Error(`SSE stream disconnected: ${h}`)),(n||s)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:i,replayMessageId:a},0)}catch(g){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,a,o,s,l,c;try{let{resumptionToken:u,onresumptiontoken:d}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:qc(e)?e.id:void 0}).catch(v=>{var I;return(I=this.onerror)===null||I===void 0?void 0:I.call(this,v)});return}let m=await this._commonHeaders();m.set("content-type","application/json"),m.set("accept","application/json, text/event-stream");let p={...this._requestInit,method:"POST",headers:m,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},h=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,p),f=h.headers.get("mcp-session-id");if(f&&(this._sessionId=f),!h.ok){let v=await h.text().catch(()=>null);if(h.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $a(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:I,scope:T}=Il(h);if(this._resourceMetadataUrl=I,this._scope=T,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(h.status===403&&this._authProvider){let{resourceMetadataUrl:I,scope:T,error:C}=Il(h);if(C==="insufficient_scope"){let M=h.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===M)throw new $a(403,"Server returned 403 after trying upscoping");if(T&&(this._scope=T),I&&(this._resourceMetadataUrl=I),this._lastUpscopingHeader=M??void 0,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rr;return this.send(e)}}throw new $a(h.status,`Error POSTing to endpoint: ${v}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,h.status===202){await((a=h.body)===null||a===void 0?void 0:a.cancel()),oI(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var I;return(I=this.onerror)===null||I===void 0?void 0:I.call(this,v)});return}let g=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,x=h.headers.get("content-type");if(g)if(x?.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:d},!1);else if(x?.includes("application/json")){let v=await h.json(),I=Array.isArray(v)?v.map(T=>Js.parse(T)):[Js.parse(v)];for(let T of I)(o=this.onmessage)===null||o===void 0||o.call(this,T)}else throw await((s=h.body)===null||s===void 0?void 0:s.cancel()),new $a(-1,`Unexpected content type: ${x}`);else await((l=h.body)===null||l===void 0?void 0:l.cancel())}catch(u){throw(c=this.onerror)===null||c===void 0||c.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n,i;if(this._sessionId)try{let a=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(await((n=s.body)===null||n===void 0?void 0:n.cancel()),!s.ok&&s.status!==405)throw new $a(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(a){throw(i=this.onerror)===null||i===void 0||i.call(this,a),a}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var nf=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(OO(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(OO(this),r)}};function T9(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Ik(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Ik).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Ik(t.cause)}`:t.message:`${t}`}function OO(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var MO=t=>{throw TypeError(t)},$k=(t,e,r)=>e.has(t)||MO("Cannot "+r),De=(t,e,r)=>($k(t,e,"read from private field"),r?r.call(t):e.get(t)),Vt=(t,e,r)=>e.has(t)?MO("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),wt=(t,e,r,n)=>($k(t,e,"write to private field"),e.set(t,r),r),Xi=(t,e,r)=>($k(t,e,"access private method"),r),Wr,$o,Al,rf,af,bd,Nl,vd,La,Pl,Ol,Rl,gd,Kn,Ak,Pk,Rk,DO,Nk,Ok,yd,Dk,Mk,Lo=class extends EventTarget{constructor(e,r){var n,i;super(),Vt(this,Kn),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Vt(this,Wr),Vt(this,$o),Vt(this,Al),Vt(this,rf),Vt(this,af),Vt(this,bd),Vt(this,Nl),Vt(this,vd,null),Vt(this,La),Vt(this,Pl),Vt(this,Ol,null),Vt(this,Rl,null),Vt(this,gd,null),Vt(this,Pk,async a=>{var o;De(this,Pl).reset();let{body:s,redirected:l,status:c,headers:u}=a;if(c===204){Xi(this,Kn,yd).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?wt(this,Al,new URL(a.url)):wt(this,Al,void 0),c!==200){Xi(this,Kn,yd).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Xi(this,Kn,yd).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.OPEN);let d=new Event("open");if((o=De(this,gd))==null||o.call(this,d),this.dispatchEvent(d),typeof s!="object"||!s||!("getReader"in s)){Xi(this,Kn,yd).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,p=s.getReader(),h=!0;do{let{done:f,value:y}=await p.read();y&&De(this,Pl).feed(m.decode(y,{stream:!f})),f&&(h=!1,De(this,Pl).reset(),Xi(this,Kn,Dk).call(this))}while(h)}),Vt(this,Rk,a=>{wt(this,La,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Xi(this,Kn,Dk).call(this,Ik(a))}),Vt(this,Nk,a=>{typeof a.id=="string"&&wt(this,vd,a.id);let o=new MessageEvent(a.event||"message",{data:a.data,origin:De(this,Al)?De(this,Al).origin:De(this,$o).origin,lastEventId:a.id||""});De(this,Rl)&&(!a.event||a.event==="message")&&De(this,Rl).call(this,o),this.dispatchEvent(o)}),Vt(this,Ok,a=>{wt(this,bd,a)}),Vt(this,Mk,()=>{wt(this,Nl,void 0),De(this,Wr)===this.CONNECTING&&Xi(this,Kn,Ak).call(this)});try{if(e instanceof URL)wt(this,$o,e);else if(typeof e=="string")wt(this,$o,new URL(e,C9()));else throw new Error("Invalid URL")}catch{throw T9("An invalid or illegal string was specified")}wt(this,Pl,Qh({onEvent:De(this,Nk),onRetry:De(this,Ok)})),wt(this,Wr,this.CONNECTING),wt(this,bd,3e3),wt(this,af,(n=r?.fetch)!=null?n:globalThis.fetch),wt(this,rf,(i=r?.withCredentials)!=null?i:!1),Xi(this,Kn,Ak).call(this)}get readyState(){return De(this,Wr)}get url(){return De(this,$o).href}get withCredentials(){return De(this,rf)}get onerror(){return De(this,Ol)}set onerror(e){wt(this,Ol,e)}get onmessage(){return De(this,Rl)}set onmessage(e){wt(this,Rl,e)}get onopen(){return De(this,gd)}set onopen(e){wt(this,gd,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){De(this,Nl)&&clearTimeout(De(this,Nl)),De(this,Wr)!==this.CLOSED&&(De(this,La)&&De(this,La).abort(),wt(this,Wr,this.CLOSED),wt(this,La,void 0))}};Wr=new WeakMap,$o=new WeakMap,Al=new WeakMap,rf=new WeakMap,af=new WeakMap,bd=new WeakMap,Nl=new WeakMap,vd=new WeakMap,La=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,Rl=new WeakMap,gd=new WeakMap,Kn=new WeakSet,Ak=function(){wt(this,Wr,this.CONNECTING),wt(this,La,new AbortController),De(this,af)(De(this,$o),Xi(this,Kn,DO).call(this)).then(De(this,Pk)).catch(De(this,Rk))},Pk=new WeakMap,Rk=new WeakMap,DO=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...De(this,vd)?{"Last-Event-ID":De(this,vd)}:void 0},cache:"no-store",signal:(t=De(this,La))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Nk=new WeakMap,Ok=new WeakMap,yd=function(t,e){var r;De(this,Wr)!==this.CLOSED&&wt(this,Wr,this.CLOSED);let n=new nf("error",{code:e,message:t});(r=De(this,Ol))==null||r.call(this,n),this.dispatchEvent(n)},Dk=function(t,e){var r;if(De(this,Wr)===this.CLOSED)return;wt(this,Wr,this.CONNECTING);let n=new nf("error",{code:e,message:t});(r=De(this,Ol))==null||r.call(this,n),this.dispatchEvent(n),wt(this,Nl,setTimeout(De(this,Mk),De(this,bd)))},Mk=new WeakMap,Lo.CONNECTING=0,Lo.OPEN=1,Lo.CLOSED=2;function C9(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Lk=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},of=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Xh(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new Rr("No auth provider");let r;try{r=await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new Rr;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=Cl((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((a,o)=>{this._eventSource=new Lo(this._url.href,{...this._eventSourceInit,fetch:async(s,l)=>{let c=await this._commonHeaders();c.set("Accept","text/event-stream");let u=await i(s,{...l,headers:c});if(u.status===401&&u.headers.has("www-authenticate")){let{resourceMetadataUrl:d,scope:m}=Il(u);this._resourceMetadataUrl=d,this._scope=m}return u}}),this._abortController=new AbortController,this._eventSource.onerror=s=>{var l;if(s.code===401&&this._authProvider){this._authThenStart().then(a,o);return}let c=new Lk(s.code,s.message,s);o(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",s=>{var l;let c=s;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){o(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}a()}),this._eventSource.onmessage=s=>{var l,c;let u=s,d;try{d=Js.parse(JSON.parse(u.data))}catch(m){(l=this.onerror)===null||l===void 0||l.call(this,m);return}(c=this.onmessage)===null||c===void 0||c.call(this,d)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rr("No auth provider");if(await Ji(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i,a;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},l=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!l.ok){let c=await l.text().catch(()=>null);if(l.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=Il(l);if(this._resourceMetadataUrl=u,this._scope=d,await Ji(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Rr;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}await((i=l.body)===null||i===void 0?void 0:i.cancel())}catch(o){throw(a=this.onerror)===null||a===void 0||a.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}};var Yi={name:"@intelliweave/embedded",version:"2.0.70",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.60.0","@modelcontextprotocol/sdk":"^1.24.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ht=new Re("MCPKnowledgeClient"),sf=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ht.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new nd({name:Yi.name,version:Yi.version}),n=new tf(new URL(this.config.baseURL));return await r.connect(n),Ht.debug("Connected with HTTP streaming mode"),r}).catch(async r=>{let n=new nd({name:Yi.name,version:Yi.version}),i=new of(new URL(this.config.baseURL));return await n.connect(i),Ht.debug("Connected with SSE mode"),n});return await this.disconnect(),this.client=e,e.onerror=r=>{Ht.error(`MCP client error: ${r.message}`)},e.onclose=()=>{Ht.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(Gv,r=>{r.params.level=="critical"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="error"?Ht.error(`[Server] ${r.params.data}`):r.params.level=="warning"?Ht.warn(`[Server] ${r.params.data}`):r.params.level=="info"?Ht.info(`[Server] ${r.params.data}`):r.params.level=="debug"?Ht.debug(`[Server] ${r.params.data}`):Ht.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(Uv,r=>{Ht.debug("Tool list changed",r),this.fetchTools()}),Ht.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let i=await this.client.listTools({cursor:r});r=i.nextCursor;for(let a of i.tools||[])e.push(a);if(!i?.tools?.length||!r)break}let n=[];for(let i of e){let a=!!(this.config.searchToolName&&i.name==this.config.searchToolName&&!this.config.searchToolVisible);n.push({id:i.name,name:i.name,content:i.description||"",type:"action",isContext:!0,parameters:i.inputSchema,action:o=>this.performToolCall(i.name,o),disabled:a})}Ht.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,Ht.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(a=>a.name==this.config.searchToolName);if(!n)return Ht.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let a=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let a=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[a]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];r.push({id:this.config.id+":"+this.config.searchToolName+":"+a,name:`Search result ${a+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),Ht.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw Ht.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var A9=new Re("Statistics"),_d=[];async function Nr(t,e){let r={...e,event_id:_t(),event_date:new Date().toISOString(),sdk_version:Yi.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(_d.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),_d.length===0))return;let n=_d.slice();_d.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){A9.warn("Failed to submit analytics event:",i),_d.push(...n);return}}var zo=new Re("KnowledgeBase"),zk=1,lf=class t{constructor(e){this._sources=[{id:"core.internal",query:async()=>PT(this.ai)}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${zk++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return ht().knowledgeBaseSources&&(e=e.concat(ht().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(r=>!r.disabled),e}async search(e){let r=Date.now();zo.debug(`Searching knowledge base for: ${e}`);let n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],typeof document<"u"&&document.dispatchEvent(n),this._windowSources=n.sources;let a=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),d=await c.query(e);return zo.debug(`Source '${c.id}' took ${Date.now()-u}ms`),d||[]}catch(u){return zo.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();a=a.concat(n.entries),a=a.concat(this.manualEntries),ht().knowledgeBase&&(a=a.concat(ht().knowledgeBase)),a=a.filter(c=>c&&!c.disabled);for(let c=0;c<a.length;c++){let u=a[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=d=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=d=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let o=new AT({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});o.addAll(a);let l=o.search(e).map(c=>a.find(u=>u.id==c.id));for(let c of a)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Nr(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),zo.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${zk++}`),zo.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],a=!0,o=async(l,c)=>{zo.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){zo.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>o(c,d)})}};this.registerSource(r,async l=>{if(a&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,i.includes(l)||i.push(l),s(d.items),n})}clone(){let e=new t(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${zk++}`);let r=new sf(e);return this.registerSource(e.id,n=>r.search(n)),r}};var cf=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
3315
3315
|
|
|
3316
3316
|
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(r.toLowerCase().includes("true"))return!0;if(r.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+r)}async choose(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
3317
3317
|
|
|
@@ -3328,11 +3328,11 @@ Objects should have the following keys:
|
|
|
3328
3328
|
${e.extractions.map(i=>`- ${i.name} (${i.type}): ${i.description||"No description provided."}`).join(`
|
|
3329
3329
|
`)}
|
|
3330
3330
|
`,n=await this.instruct({...e,instruction:r});if(n=n.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),e.allowMultiple){let i=n.split(`
|
|
3331
|
-
`).map(o=>o.trim()).filter(o=>!!o.trim()),a=[];for(let o of i)try{a.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return a}else return[JSON.parse(n.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let r=this.ai.clone();return r.resetConversation(),r.getContextPrefix=async()=>e.instruction,e.callback&&r.addEventListener("output",n=>{e.callback(n.detail.message)}),e.allowKB||(r.knowledgeBase._sources=[]),await r.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var Jn=new Re("Main")
|
|
3332
|
-
You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time).${
|
|
3331
|
+
`).map(o=>o.trim()).filter(o=>!!o.trim()),a=[];for(let o of i)try{a.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return a}else return[JSON.parse(n.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let r=this.ai.clone();return r.resetConversation(),r.getContextPrefix=async()=>e.instruction,e.callback&&r.addEventListener("output",n=>{e.callback(n.detail.message)}),e.allowKB||(r.knowledgeBase._sources=[]),await r.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var Jn=new Re("Main"),$O=new Set,Fo=class Fo extends EventTarget{constructor(){super(...arguments);this.conversationID=_t();this.knowledgeBase=new lf(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new cf(this);this.userID=oE();this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1;this._lastTrackedTokens=0}get loaded(){return!!(this.config&&this.currentModel)}get flags(){return this.config?.flags||{}}getBuiltInActionsInfo(){return{version:Fo.builtInActionsVersion,availableActions:["ui.openURL - Open URLs in new tabs","ui.changeRoute - Change page routes","ui.sendEmail - Send emails via mailto links","search - Search knowledge base"],enabledFlags:this.flags}}async load(r){if(this.apiKey=r,!r)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Jn.debug("Loading configuration...");let n=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:r})});if(!n.ok)throw new Error(`Failed to load configuration: ${n.status} ${n.statusText}`);try{this.config=await n.json(),Jn.debug("Config loaded successfully:",this.config),this.config&&Jn.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(i){Jn.error("Failed to parse JSON response:",i);try{let a=await n.clone().text();Jn.error("Raw response that failed parsing:",a)}catch{Jn.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${i}`)}})(),(async()=>{try{let n=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!n.ok)throw new Error(`Failed to load VAD model: ${n.status} ${n.statusText}`);this.vadModel=await n.blob()}catch(n){Jn.warn(`Failed to load VAD model, some features will be unavailable. ${n.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let n of this.config.knowledge||[])n.url&&n.backendType=="mcp"?this.knowledgeBase.registerMCPSource({id:n.id,searchToolName:n.mcpSearchToolName,baseURL:n.url}):n.url&&this.knowledgeBase.registerSourceFromURL(n.url);for(let n of this.config.knowledge||[])n.entries?.length&&this.knowledgeBase.registerSource(n.id,()=>n.entries||[]);if(this.config.mcpServers)for(let n of this.config.mcpServers)this.knowledgeBase.registerMCPSource(n);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(n){throw Jn.warn("Failed to load:",n),this.error=n,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:n}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:n}})),n}}setModel(r){let n=this.models.find(a=>a.id==r);if(!n)throw new Error(`Model with ID "${r}" not found.`);let i={...n.config,stream:!0,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(a,o)=>{let s=this.knowledgeBase.getCachedEntry(a);this.onAIToolStart?.(s?.id||a,o)}};n.config.providerID==="anthropic"?this.currentModel=new Lp(i):this.currentModel=new up(i),this.currentModel.id=n.id,this.currentModel.metadata=n}async getContextPrefix(){let r=ht().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof r=="function"&&(r=await r()),r}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let r=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;let n=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:n}),this.currentModel.contextGroup.add({id:"_iw_kb_only_rule",sortOrder:2,cannotRemove:!0,disabled:!this.flags.onlyUseKnowledgeBase,content:"Important rule: Only use knowledge from your knowledge base to answer questions, do not speak about anything that is not included in your knowledge base."}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:`# Knowledge Database
|
|
3332
|
+
You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time).${r.length==0?`
|
|
3333
3333
|
|
|
3334
|
-
(no items found)`:""}`});for(let a of
|
|
3335
|
-
${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeof a.content=="function"?a.content():a.content),params:Xx(a.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!a.removeFromMessageHistory,callback:s=>this.toolRunKBAction(a,s),kb:a};this.currentModel.registerTool(o)}else continue;let i=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=i&&(this._lastSystemMsg=i,this.submitAnalyticsEvent({type:"system-msg",txt:i}))}processIncomingMessage(r,n){if(!n){let i=this.currentModel?.stats?.tokensUsed||0,a=i-(this._lastTrackedTokens||0);this._lastTrackedTokens=i,Nr(this,{event_type:"message_receive",value:a,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:n,message:r}})),this.onAIMessage?.(r,!!n)}async sendMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Jn.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{this._messageStartTime=Date.now(),MO.has(this.conversationID)||(MO.add(this.conversationID),Nr(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,Nr(this,{event_type:"message_send",value_str:"",event_properties:{message_length:r.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:r}})),this.submitAnalyticsEvent({type:"message",role:"user",message:r,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()});let n=await this.currentModel.sendMessage(r);return n&&typeof n=="string"&&n.trim().length>0&&this.submitAnalyticsEvent({type:"message",role:"assistant",message:n,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()}),n}finally{this.isProcessing=!1}}async toolRunKBAction(r,n){let i=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:r,input:n,ai:this}}));let a=await r.action(n,this),o=Date.now()-i;return Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,result:a}})),a}catch(a){let o=Date.now()-i;throw Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!1,error_message:a.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,error:a}})),a}}submitAnalyticsEvent(r){ht().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(n=>{Jn.debug("Failed to submit analytics event:",n)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=_t(),this._lastSystemMsg="")}insertAssistantMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(r)}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(r=>r.customData)}}importState(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(r?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${r.type}`);this.conversationID=r.conversationID;for(let n of r.messages)this.currentModel.messageGroup.add({id:_t(),content:JSON.stringify(n),customData:n})}clone(){let r=new Fo;return r.apiKey=this.apiKey,r.config=this.config,r.models=this.models,this.config?.id&&r.setModel(this.config.id),r.audio=this.audio,r.vadModel=this.vadModel,r.userID=this.userID,r.knowledgeBase=this.knowledgeBase.clone(),r}};Fo.version=Yi.version,Fo.builtInActionsVersion="1.0.0",Jn.debug("\u{1F6A8}\u{1F6A8}\u{1F6A8} NEW SDK BUILD LOADED - Built-in Actions Version:",Fo.builtInActionsVersion);var Ol=Fo;var an=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(r={},n=""){this.register();let i=document.createElement(this.tagName);for(let a in r)i.setAttribute(a,r[a]);return i.onBeforeCreate(),i.innerHTML=n,i}static add(r={},n=""){this.register();let i=a=>a.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(r).map(a=>`${a}="${i(r[a]+"")}"`).join(" ")}>${n}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(r,n,i){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(r,n)=>this.getAttribute(n.toString())||"",set:(r,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(r,n)=>this._state[n],set:(r,n,i)=>(this._state[n]=i,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(r){return!!this.root?.getElementById(r)}child(r){let n=this.root?.getElementById(r);if(!n)throw new Error(`Child with ID ${r} not found`);return n}};an.observedAttributes=[],an.tagName="",an._isRegistered=!1;var $O='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var LO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var zO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var bd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3334
|
+
(no items found)`:""}`});for(let a of r)if(a.type=="info"||a.type=="tour"||a.type=="input-event"){let o=yg(typeof a.content=="function"?a.content():a.content);this.currentModel.contextGroup.add({id:a.id,customData:a,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:`## ${a.type}: ${a.name}
|
|
3335
|
+
${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:yg(typeof a.content=="function"?a.content():a.content),params:sE(a.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!a.removeFromMessageHistory,callback:s=>this.toolRunKBAction(a,s),kb:a};this.currentModel.registerTool(o)}else continue;let i=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=i&&(this._lastSystemMsg=i,this.submitAnalyticsEvent({type:"system-msg",txt:i}))}processIncomingMessage(r,n){if(!n){let i=this.currentModel?.stats?.tokensUsed||0,a=i-(this._lastTrackedTokens||0);this._lastTrackedTokens=i,Nr(this,{event_type:"message_receive",value:a,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:n,message:r}})),this.onAIMessage?.(r,!!n)}async sendMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Jn.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{this._messageStartTime=Date.now(),$O.has(this.conversationID)||($O.add(this.conversationID),Nr(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,Nr(this,{event_type:"message_send",value_str:"",event_properties:{message_length:r.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:r}})),this.submitAnalyticsEvent({type:"message",role:"user",message:r,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()});let n=await this.currentModel.sendMessage(r);return n&&typeof n=="string"&&n.trim().length>0&&this.submitAnalyticsEvent({type:"message",role:"assistant",message:n,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()}),n}finally{this.isProcessing=!1}}async toolRunKBAction(r,n){let i=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:r,input:n,ai:this}}));let a=await r.action(n,this),o=Date.now()-i;return Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,result:a}})),a}catch(a){let o=Date.now()-i;throw Nr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:o,success:!1,error_message:a.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,error:a}})),a}}submitAnalyticsEvent(r){ht().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(n=>{Jn.debug("Failed to submit analytics event:",n)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=_t(),this._lastSystemMsg="")}insertAssistantMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(r)}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(r=>r.customData)}}importState(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(r?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${r.type}`);this.conversationID=r.conversationID;for(let n of r.messages)this.currentModel.messageGroup.add({id:_t(),content:JSON.stringify(n),customData:n})}clone(){let r=new Fo;return r.apiKey=this.apiKey,r.config=this.config,r.models=this.models,this.config?.id&&r.setModel(this.config.id),r.audio=this.audio,r.vadModel=this.vadModel,r.userID=this.userID,r.knowledgeBase=this.knowledgeBase.clone(),r}};Fo.version=Yi.version,Fo.builtInActionsVersion="1.0.0",Jn.debug("\u{1F6A8}\u{1F6A8}\u{1F6A8} NEW SDK BUILD LOADED - Built-in Actions Version:",Fo.builtInActionsVersion);var Dl=Fo;var an=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(r={},n=""){this.register();let i=document.createElement(this.tagName);for(let a in r)i.setAttribute(a,r[a]);return i.onBeforeCreate(),i.innerHTML=n,i}static add(r={},n=""){this.register();let i=a=>a.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(r).map(a=>`${a}="${i(r[a]+"")}"`).join(" ")}>${n}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(r,n,i){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(r,n)=>this.getAttribute(n.toString())||"",set:(r,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(r,n)=>this._state[n],set:(r,n,i)=>(this._state[n]=i,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(r){return!!this.root?.getElementById(r)}child(r){let n=this.root?.getElementById(r);if(!n)throw new Error(`Child with ID ${r} not found`);return n}};an.observedAttributes=[],an.tagName="",an._isRegistered=!1;var LO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var zO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var FO='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Sd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3336
3336
|
|
|
3337
3337
|
<!-- Styling -->
|
|
3338
3338
|
<style>
|
|
@@ -3372,7 +3372,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3372
3372
|
}
|
|
3373
3373
|
|
|
3374
3374
|
:host #loader {
|
|
3375
|
-
background-image: url('${
|
|
3375
|
+
background-image: url('${LO}');
|
|
3376
3376
|
background-size: 64px 64px;
|
|
3377
3377
|
background-position: center;
|
|
3378
3378
|
background-repeat: no-repeat;
|
|
@@ -3395,7 +3395,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3395
3395
|
}
|
|
3396
3396
|
|
|
3397
3397
|
:host #microphone-button {
|
|
3398
|
-
background-image: url('${
|
|
3398
|
+
background-image: url('${zO}');
|
|
3399
3399
|
z-index: 2;
|
|
3400
3400
|
margin-right: -10px;
|
|
3401
3401
|
}
|
|
@@ -3419,7 +3419,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3419
3419
|
}
|
|
3420
3420
|
|
|
3421
3421
|
:host #cancel-speech-button {
|
|
3422
|
-
background-image: url('${
|
|
3422
|
+
background-image: url('${FO}');
|
|
3423
3423
|
z-index: 2;
|
|
3424
3424
|
}
|
|
3425
3425
|
|
|
@@ -3443,7 +3443,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3443
3443
|
<!-- Loader bar -->
|
|
3444
3444
|
<div id='loader'></div>
|
|
3445
3445
|
|
|
3446
|
-
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",r=>this.onInputKeyPress(r),{capture:!0}),this.child("input-field").addEventListener("keydown",r=>r.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",r=>this.onLLMButtonClick(r)),this.child("microphone-button").addEventListener("click",r=>this.onMicButtonClick(r)),this.child("cancel-speech-button").addEventListener("click",r=>this.onCancelSpeechButtonClick(r))}connectAI(r){this.ai=r,this.ai.audio?.speechRecognition.addEventListener("speech",n=>this.onSpeechEvent(n)),this.ai.audio?.speechRecognition.addEventListener("start",n=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",n=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let r=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;r&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!r&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(n=>n.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(r){if(r.stopPropagation(),r.key!="Enter")return;let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onLLMButtonClick(r){r.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(r){r.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let r="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(r="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(r="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(r="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(r="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(r="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(r="rgba(0, 255, 0, 0.5)");let n=this.ai?.audio?.speechRecognition.volumeLevel||0,i=30,a=6,o=Math.round(n*(i-a)+a),s=document.createElement("div");s.posX=50,s.style.cssText=`position: absolute; top: calc(50% - ${o}px/2); left: 0px; width: 6px; height: ${o}px; background-color: ${r}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(s),this.voiceAnimationPieces.push(s)}for(let r=0;r<this.voiceAnimationPieces.length;r++){let n=this.voiceAnimationPieces[r];n.posX+=2,n.style.transform=`translate(${n.posX}px, 0px)`,!(n.posX<400)&&(this.voiceAnimationPieces.splice(r--,1),n.remove())}}}onSpeechEvent(r){this.attr.loading||r.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:r.detail.transcript}))}onCancelSpeechButtonClick(r){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};
|
|
3446
|
+
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",r=>this.onInputKeyPress(r),{capture:!0}),this.child("input-field").addEventListener("keydown",r=>r.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",r=>this.onLLMButtonClick(r)),this.child("microphone-button").addEventListener("click",r=>this.onMicButtonClick(r)),this.child("cancel-speech-button").addEventListener("click",r=>this.onCancelSpeechButtonClick(r))}connectAI(r){this.ai=r,this.ai.audio?.speechRecognition.addEventListener("speech",n=>this.onSpeechEvent(n)),this.ai.audio?.speechRecognition.addEventListener("start",n=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",n=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let r=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;r&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!r&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(n=>n.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(r){if(r.stopPropagation(),r.key!="Enter")return;let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onLLMButtonClick(r){r.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(r){r.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let r="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(r="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(r="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(r="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(r="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(r="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(r="rgba(0, 255, 0, 0.5)");let n=this.ai?.audio?.speechRecognition.volumeLevel||0,i=30,a=6,o=Math.round(n*(i-a)+a),s=document.createElement("div");s.posX=50,s.style.cssText=`position: absolute; top: calc(50% - ${o}px/2); left: 0px; width: 6px; height: ${o}px; background-color: ${r}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(s),this.voiceAnimationPieces.push(s)}for(let r=0;r<this.voiceAnimationPieces.length;r++){let n=this.voiceAnimationPieces[r];n.posX+=2,n.style.transform=`translate(${n.posX}px, 0px)`,!(n.posX<400)&&(this.voiceAnimationPieces.splice(r--,1),n.remove())}}}onSpeechEvent(r){this.attr.loading||r.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:r.detail.transcript}))}onCancelSpeechButtonClick(r){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};Sd.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var BO='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var wd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3447
3447
|
|
|
3448
3448
|
<!-- Styling -->
|
|
3449
3449
|
<style>
|
|
@@ -3496,12 +3496,12 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3496
3496
|
<!-- Logo -->
|
|
3497
3497
|
<img id='root' />
|
|
3498
3498
|
|
|
3499
|
-
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),100)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let r=this.child("root");if(!r)return;let n=this.attr.logo||FO;this._lastLogoSrc!=n&&(this._lastLogoSrc=n,r.src=n);let i=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(i){let a=window.visualViewport?.offsetTop||0,o=window.visualViewport?.offsetLeft||0,s=i.getBoundingClientRect();if(!s)return;r.classList.add("focused-mode"),r.style.width="128px",r.style.height="128px",r.style.left=Math.round(s.x+s.width/2-128/2+o)+"px",r.style.top=Math.round(s.y+s.height/2-128/2+a)+"px"}else r.classList.remove("focused-mode"),r.style.width="",r.style.height="",r.style.left="",r.style.top=""}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};vd.observedAttributes=["logo","focusID"];var BO=typeof self=="object"?self:globalThis,O9=(t,e)=>{let r=(i,a)=>(t.set(a,i),i),n=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case-1:return r(o,i);case 1:{let s=r([],i);for(let l of o)s.push(n(l));return s}case 2:{let s=r({},i);for(let[l,c]of o)s[n(l)]=n(c);return s}case 3:return r(new Date(o),i);case 4:{let{source:s,flags:l}=o;return r(new RegExp(s,l),i)}case 5:{let s=r(new Map,i);for(let[l,c]of o)s.set(n(l),n(c));return s}case 6:{let s=r(new Set,i);for(let l of o)s.add(n(l));return s}case 7:{let{name:s,message:l}=o;return r(new BO[s](l),i)}case 8:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i)}return r(new BO[a](o),i)};return n},Nk=t=>O9(new Map,t)(0);var Dl="",{toString:D9}={},{keys:M9}=Object,kd=t=>{let e=typeof t;if(e!=="object"||!t)return[0,e];let r=D9.call(t).slice(8,-1);switch(r){case"Array":return[1,Dl];case"Object":return[2,Dl];case"Date":return[3,Dl];case"RegExp":return[4,Dl];case"Map":return[5,Dl];case"Set":return[6,Dl]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},pf=([t,e])=>t===0&&(e==="function"||e==="symbol"),$9=(t,e,r,n)=>{let i=(o,s)=>{let l=n.push(o)-1;return r.set(s,l),l},a=o=>{if(r.has(o))return r.get(o);let[s,l]=kd(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],o)}return i([s,u],o)}case 1:{if(l)return i([l,[...o]],o);let u=[],d=i([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return a(o.toJSON());let u=[],d=i([s,u],o);for(let m of M9(o))(t||!pf(kd(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return i([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return i([s,{source:u,flags:d}],o)}case 5:{let u=[],d=i([s,u],o);for(let[m,p]of o)(t||!(pf(kd(m))||pf(kd(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=i([s,u],o);for(let m of o)(t||!pf(kd(m)))&&u.push(a(m));return d}}let{message:c}=o;return i([s,{name:l,message:c}],o)};return a},Ok=(t,{json:e,lossy:r}={})=>{let n=[];return $9(!(e||r),!!e,new Map,n)(t),n};var gi=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Nk(Ok(t,e)):structuredClone(t):(t,e)=>Nk(Ok(t,e));var yi=function(t,e,r,n,i){let a=bi(e);if(r!=null&&(typeof r!="number"||r<0||r===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(n!=null&&(!n.type||!n.children))throw new Error("Expected valid `parent`");if(r==null!=(n==null))throw new Error("Expected both `index` and `parent`");return jO(t)?a.call(i,t,r,n):!1},bi=function(t){if(t==null)return F9;if(typeof t=="string")return z9(t);if(typeof t=="object")return L9(t);if(typeof t=="function")return Dk(t);throw new Error("Expected function, string, or array as `test`")};function L9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=bi(t[r]);return Dk(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function z9(t){return Dk(e);function e(r){return r.tagName===t}}function Dk(t){return e;function e(r,n,i){return!!(jO(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function F9(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function jO(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}var B9=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,j9=/^[a-zA-Z]:\\/;function Mk(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return j9.test(t)?!1:B9.test(t)}function UO(t){let e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function GO(t){return t.join(" ").trim()}var Ml=function(t){if(t==null)return H9;if(typeof t=="function")return mf(t);if(typeof t=="object")return Array.isArray(t)?U9(t):G9(t);if(typeof t=="string")return V9(t);throw new Error("Expected function, string, or object as test")};function U9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Ml(t[r]);return mf(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function G9(t){let e=t;return mf(r);function r(n){let i=n,a;for(a in t)if(i[a]!==e[a])return!1;return!0}}function V9(t){return mf(e);function e(r){return r&&r.type===t}}function mf(t){return e;function e(r,n,i){return!!(q9(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function H9(){return!0}function q9(t){return t!==null&&typeof t=="object"&&"type"in t}var VO=[],$k=!0,hf=!1,xd="skip";function Ed(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;let a=Ml(i),o=n?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=VO,h,f,y;if((!e||a(l,c,u[u.length-1]||void 0))&&(p=W9(r(l,u)),p[0]===hf))return p;if("children"in l&&l.children){let g=l;if(g.children&&p[0]!==xd)for(f=(n?g.children.length:-1)+o,y=u.concat(g);f>-1&&f<g.children.length;){let S=g.children[f];if(h=s(S,f,y)(),h[0]===hf)return h;f=typeof h[1]=="number"?h[1]:f+o}}return p}}}function W9(t){return Array.isArray(t)?t:typeof t=="number"?[$k,t]:t==null?VO:[t]}function Td(t,e,r,n){let i,a,o;typeof e=="function"&&typeof r!="function"?(a=void 0,o=e,i=r):(a=e,o=r,i=n),Ed(t,a,s,i);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var Z9=["http","https"],K9=["nofollow"],J9={};function ff(t){let e=t||J9,r=e.protocols||Z9,n=bi(e.test);return function(i){Td(i,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&n(a,o,s)){let l=a.properties.href;if(Mk(l)?r.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Cd(e.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Cd(e.rel,a)||K9,m=typeof d=="string"?UO(d):d,p=Cd(e.target,a),h=Cd(e.properties,a);if(h&&Object.assign(a.properties,gi(h)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let f=Cd(e.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:gi(f),children:gi(u)})}}}})}}function Cd(t,e){return typeof t=="function"?t(e):t}var Bo=bi(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"});var X9={}.hasOwnProperty;function Lk(t,e){let r=t.type==="element"&&X9.call(t.properties,e)&&t.properties[e];return r!=null&&r!==!1}var Y9=new Set(["pingback","prefetch","stylesheet"]);function zk(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;let e=t.properties.rel,r=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++r<e.length;)if(!Y9.has(String(e[r])))return!1;return!0}var Q9=bi(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),eZ=bi("meta");function Fk(t){return!!(t.type==="text"||Q9(t)||Bo(t)||zk(t)||eZ(t)&&Lk(t,"itemProp"))}var tZ=/[ \t\n\f\r]/g;function on(t){return typeof t=="object"?t.type==="text"?HO(t.value):!1:HO(t)}function HO(t){return t.replace(tZ,"")===""}var Bk=["pre","script","style","textarea"];var qO=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var WO=["button","input","select","textarea"];var ZO=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var rZ={},jk=Ml(["doctype","comment"]);function gf(t){let r=cZ((t||rZ).newlines?sZ:lZ);return function(n){JO(n,{collapse:r,whitespace:"normal"})}}function JO(t,e){if("children"in t){let r={...e};return(t.type==="root"||QO(t))&&(r.before=!0,r.after=!0),r.whitespace=uZ(t,e),iZ(t,r)}if(t.type==="text"){if(e.whitespace==="normal")return nZ(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:jk(t),stripAtStart:!1,remove:!1}}function nZ(t,e){let r=e.collapse(t.value),n={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=r.length;return e.before&&KO(r.charAt(0))&&i++,i!==a&&KO(r.charAt(a-1))&&(e.after?a--:n.stripAtStart=!0),i===a?n.remove=!0:t.value=r.slice(i,a),n}function iZ(t,e){let r=e.before,n=e.after,i=t.children,a=i.length,o=-1;for(;++o<a;){let s=JO(i[o],{...e,after:XO(i,o,n),before:r});s.remove?(i.splice(o,1),o--,a--):s.ignore||(r=s.stripAtStart),YO(i[o])&&(r=!1)}return{ignore:!1,stripAtStart:!!(r||n),remove:!1}}function XO(t,e,r){for(;++e<t.length;){let n=t[e],i=aZ(n);if(i===void 0&&"children"in n&&!oZ(n)&&(i=XO(n.children,-1)),typeof i=="boolean")return i}return r}function aZ(t){if(t.type==="element"){if(YO(t))return!1;if(QO(t))return!0}else if(t.type==="text"){if(!on(t))return!1}else if(!jk(t))return!1}function YO(t){return Bo(t)||yi(t,WO)}function QO(t){return yi(t,qO)}function oZ(t){return!!(t.type==="element"&&t.properties.hidden)||jk(t)||yi(t,ZO)}function KO(t){return t===" "||t===`
|
|
3500
|
-
`}function
|
|
3501
|
-
`)&&(p=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(r).repeat(m)))}let h=[],f;for(u=-1;++u<d.length;){let y=d[u];(
|
|
3499
|
+
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),100)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let r=this.child("root");if(!r)return;let n=this.attr.logo||BO;this._lastLogoSrc!=n&&(this._lastLogoSrc=n,r.src=n);let i=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(i){let a=window.visualViewport?.offsetTop||0,o=window.visualViewport?.offsetLeft||0,s=i.getBoundingClientRect();if(!s)return;r.classList.add("focused-mode"),r.style.width="128px",r.style.height="128px",r.style.left=Math.round(s.x+s.width/2-128/2+o)+"px",r.style.top=Math.round(s.y+s.height/2-128/2+a)+"px"}else r.classList.remove("focused-mode"),r.style.width="",r.style.height="",r.style.left="",r.style.top=""}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};wd.observedAttributes=["logo","focusID"];var jO=typeof self=="object"?self:globalThis,D9=(t,e)=>{let r=(i,a)=>(t.set(a,i),i),n=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case-1:return r(o,i);case 1:{let s=r([],i);for(let l of o)s.push(n(l));return s}case 2:{let s=r({},i);for(let[l,c]of o)s[n(l)]=n(c);return s}case 3:return r(new Date(o),i);case 4:{let{source:s,flags:l}=o;return r(new RegExp(s,l),i)}case 5:{let s=r(new Map,i);for(let[l,c]of o)s.set(n(l),n(c));return s}case 6:{let s=r(new Set,i);for(let l of o)s.add(n(l));return s}case 7:{let{name:s,message:l}=o;return r(new jO[s](l),i)}case 8:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i)}return r(new jO[a](o),i)};return n},Uk=t=>D9(new Map,t)(0);var Ml="",{toString:M9}={},{keys:$9}=Object,Td=t=>{let e=typeof t;if(e!=="object"||!t)return[0,e];let r=M9.call(t).slice(8,-1);switch(r){case"Array":return[1,Ml];case"Object":return[2,Ml];case"Date":return[3,Ml];case"RegExp":return[4,Ml];case"Map":return[5,Ml];case"Set":return[6,Ml]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},hf=([t,e])=>t===0&&(e==="function"||e==="symbol"),L9=(t,e,r,n)=>{let i=(o,s)=>{let l=n.push(o)-1;return r.set(s,l),l},a=o=>{if(r.has(o))return r.get(o);let[s,l]=Td(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],o)}return i([s,u],o)}case 1:{if(l)return i([l,[...o]],o);let u=[],d=i([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return a(o.toJSON());let u=[],d=i([s,u],o);for(let m of $9(o))(t||!hf(Td(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return i([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return i([s,{source:u,flags:d}],o)}case 5:{let u=[],d=i([s,u],o);for(let[m,p]of o)(t||!(hf(Td(m))||hf(Td(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=i([s,u],o);for(let m of o)(t||!hf(Td(m)))&&u.push(a(m));return d}}let{message:c}=o;return i([s,{name:l,message:c}],o)};return a},Gk=(t,{json:e,lossy:r}={})=>{let n=[];return L9(!(e||r),!!e,new Map,n)(t),n};var gi=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Uk(Gk(t,e)):structuredClone(t):(t,e)=>Uk(Gk(t,e));var yi=function(t,e,r,n,i){let a=bi(e);if(r!=null&&(typeof r!="number"||r<0||r===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(n!=null&&(!n.type||!n.children))throw new Error("Expected valid `parent`");if(r==null!=(n==null))throw new Error("Expected both `index` and `parent`");return UO(t)?a.call(i,t,r,n):!1},bi=function(t){if(t==null)return B9;if(typeof t=="string")return F9(t);if(typeof t=="object")return z9(t);if(typeof t=="function")return Vk(t);throw new Error("Expected function, string, or array as `test`")};function z9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=bi(t[r]);return Vk(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function F9(t){return Vk(e);function e(r){return r.tagName===t}}function Vk(t){return e;function e(r,n,i){return!!(UO(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function B9(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function UO(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}var j9=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,U9=/^[a-zA-Z]:\\/;function Hk(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return U9.test(t)?!1:j9.test(t)}function GO(t){let e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function VO(t){return t.join(" ").trim()}var $l=function(t){if(t==null)return q9;if(typeof t=="function")return ff(t);if(typeof t=="object")return Array.isArray(t)?G9(t):V9(t);if(typeof t=="string")return H9(t);throw new Error("Expected function, string, or object as test")};function G9(t){let e=[],r=-1;for(;++r<t.length;)e[r]=$l(t[r]);return ff(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function V9(t){let e=t;return ff(r);function r(n){let i=n,a;for(a in t)if(i[a]!==e[a])return!1;return!0}}function H9(t){return ff(e);function e(r){return r&&r.type===t}}function ff(t){return e;function e(r,n,i){return!!(W9(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function q9(){return!0}function W9(t){return t!==null&&typeof t=="object"&&"type"in t}var HO=[],qk=!0,gf=!1,Cd="skip";function Id(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;let a=$l(i),o=n?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=HO,h,f,y;if((!e||a(l,c,u[u.length-1]||void 0))&&(p=Z9(r(l,u)),p[0]===gf))return p;if("children"in l&&l.children){let g=l;if(g.children&&p[0]!==Cd)for(f=(n?g.children.length:-1)+o,y=u.concat(g);f>-1&&f<g.children.length;){let x=g.children[f];if(h=s(x,f,y)(),h[0]===gf)return h;f=typeof h[1]=="number"?h[1]:f+o}}return p}}}function Z9(t){return Array.isArray(t)?t:typeof t=="number"?[qk,t]:t==null?HO:[t]}function Ad(t,e,r,n){let i,a,o;typeof e=="function"&&typeof r!="function"?(a=void 0,o=e,i=r):(a=e,o=r,i=n),Id(t,a,s,i);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var K9=["http","https"],J9=["nofollow"],X9={};function yf(t){let e=t||X9,r=e.protocols||K9,n=bi(e.test);return function(i){Ad(i,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&n(a,o,s)){let l=a.properties.href;if(Hk(l)?r.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Pd(e.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Pd(e.rel,a)||J9,m=typeof d=="string"?GO(d):d,p=Pd(e.target,a),h=Pd(e.properties,a);if(h&&Object.assign(a.properties,gi(h)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let f=Pd(e.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:gi(f),children:gi(u)})}}}})}}function Pd(t,e){return typeof t=="function"?t(e):t}var Bo=bi(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"});var Y9={}.hasOwnProperty;function Wk(t,e){let r=t.type==="element"&&Y9.call(t.properties,e)&&t.properties[e];return r!=null&&r!==!1}var Q9=new Set(["pingback","prefetch","stylesheet"]);function Zk(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;let e=t.properties.rel,r=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++r<e.length;)if(!Q9.has(String(e[r])))return!1;return!0}var eZ=bi(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),tZ=bi("meta");function Kk(t){return!!(t.type==="text"||eZ(t)||Bo(t)||Zk(t)||tZ(t)&&Wk(t,"itemProp"))}var rZ=/[ \t\n\f\r]/g;function on(t){return typeof t=="object"?t.type==="text"?qO(t.value):!1:qO(t)}function qO(t){return t.replace(rZ,"")===""}var Jk=["pre","script","style","textarea"];var WO=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var ZO=["button","input","select","textarea"];var KO=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nZ={},Xk=$l(["doctype","comment"]);function bf(t){let r=uZ((t||nZ).newlines?lZ:cZ);return function(n){XO(n,{collapse:r,whitespace:"normal"})}}function XO(t,e){if("children"in t){let r={...e};return(t.type==="root"||e1(t))&&(r.before=!0,r.after=!0),r.whitespace=dZ(t,e),aZ(t,r)}if(t.type==="text"){if(e.whitespace==="normal")return iZ(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Xk(t),stripAtStart:!1,remove:!1}}function iZ(t,e){let r=e.collapse(t.value),n={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=r.length;return e.before&&JO(r.charAt(0))&&i++,i!==a&&JO(r.charAt(a-1))&&(e.after?a--:n.stripAtStart=!0),i===a?n.remove=!0:t.value=r.slice(i,a),n}function aZ(t,e){let r=e.before,n=e.after,i=t.children,a=i.length,o=-1;for(;++o<a;){let s=XO(i[o],{...e,after:YO(i,o,n),before:r});s.remove?(i.splice(o,1),o--,a--):s.ignore||(r=s.stripAtStart),QO(i[o])&&(r=!1)}return{ignore:!1,stripAtStart:!!(r||n),remove:!1}}function YO(t,e,r){for(;++e<t.length;){let n=t[e],i=oZ(n);if(i===void 0&&"children"in n&&!sZ(n)&&(i=YO(n.children,-1)),typeof i=="boolean")return i}return r}function oZ(t){if(t.type==="element"){if(QO(t))return!1;if(e1(t))return!0}else if(t.type==="text"){if(!on(t))return!1}else if(!Xk(t))return!1}function QO(t){return Bo(t)||yi(t,ZO)}function e1(t){return yi(t,WO)}function sZ(t){return!!(t.type==="element"&&t.properties.hidden)||Xk(t)||yi(t,KO)}function JO(t){return t===" "||t===`
|
|
3500
|
+
`}function lZ(t){let e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function cZ(){return" "}function uZ(t){return e;function e(r){return String(r).replace(/[\t\n\v\f\r ]+/g,t)}}function dZ(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap";default:}return e.whitespace}var pZ={},mZ=bf({newlines:!0});function vf(t){let e=t||pZ,r=e.indent||2,n=e.indentInitial;return typeof r=="number"&&(r=" ".repeat(r)),n==null&&(n=!0),function(o){let s;mZ(o),Id(o,function(l,c){let u=-1;if(!("children"in l))return;if(yi(l,"head")&&(s=!0),s&&yi(l,"body")&&(s=void 0),yi(l,Jk))return Cd;let d=l.children,m=c.length;if(d.length===0||!Yk(l,s))return;n||m--;let p;for(;++u<d.length;){let y=d[u];(y.type==="text"||y.type==="comment")&&(y.value.includes(`
|
|
3501
|
+
`)&&(p=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(r).repeat(m)))}let h=[],f;for(u=-1;++u<d.length;){let y=d[u];(Yk(y,s)||p&&!u)&&(i(h,m,y),p=!0),f=y,h.push(y)}f&&(p||Yk(f,s))&&(on(f)&&(h.pop(),f=h[h.length-1]),i(h,m-1)),l.children=h})};function i(o,s,l){let c=o[o.length-1],u=c&&on(c)?o[o.length-2]:c,d=(a(u)&&a(l)?`
|
|
3502
3502
|
|
|
3503
3503
|
`:`
|
|
3504
|
-
`)+String(r).repeat(Math.max(s,0));c&&c.type==="text"?c.value=on(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function Uk(t,e){return t.type==="root"||(t.type==="element"?e||yi(t,"script")||Bo(t)||!Fk(t):!1)}var e1=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Qi=class{constructor(e,r,n){this.property=e,this.normal=r,n&&(this.space=n)}};Qi.prototype.property={};Qi.prototype.normal={};Qi.prototype.space=null;function Gk(t,e){let r={},n={},i=-1;for(;++i<t.length;)Object.assign(r,t[i].property),Object.assign(n,t[i].normal);return new Qi(r,n,e)}function Id(t){return t.toLowerCase()}var Sr=class{constructor(e,r){this.property=e,this.attribute=r}};Sr.prototype.space=null;Sr.prototype.boolean=!1;Sr.prototype.booleanish=!1;Sr.prototype.overloadedBoolean=!1;Sr.prototype.number=!1;Sr.prototype.commaSeparated=!1;Sr.prototype.spaceSeparated=!1;Sr.prototype.commaOrSpaceSeparated=!1;Sr.prototype.mustUseProperty=!1;Sr.prototype.defined=!1;var Ad={};Xd(Ad,{boolean:()=>ye,booleanish:()=>It,commaOrSpaceSeparated:()=>Zr,commaSeparated:()=>za,number:()=>z,overloadedBoolean:()=>Vk,spaceSeparated:()=>tt});var mZ=0,ye=jo(),It=jo(),Vk=jo(),z=jo(),tt=jo(),za=jo(),Zr=jo();function jo(){return 2**++mZ}var Hk=Object.keys(Ad),Uo=class extends Sr{constructor(e,r,n,i){let a=-1;if(super(e,r),t1(this,"space",i),typeof n=="number")for(;++a<Hk.length;){let o=Hk[a];t1(this,Hk[a],(n&Ad[o])===Ad[o])}}};Uo.prototype.defined=!0;function t1(t,e,r){r&&(t[e]=r)}var hZ={}.hasOwnProperty;function In(t){let e={},r={},n;for(n in t.properties)if(hZ.call(t.properties,n)){let i=t.properties[n],a=new Uo(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),e[n]=a,r[Id(n)]=n,r[Id(a.attribute)]=n}return new Qi(e,r,t.space)}var qk=In({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Wk=In({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function bf(t,e){return e in t?t[e]:e}function vf(t,e){return bf(t,e.toLowerCase())}var Zk=In({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:vf,properties:{xmlns:null,xmlnsXLink:null}});var Kk=In({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:tt,ariaCurrent:null,ariaDescribedBy:tt,ariaDetails:null,ariaDisabled:It,ariaDropEffect:tt,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:tt,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tt,ariaLevel:z,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:tt,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:tt,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:It,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null}});var r1=In({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:vf,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:za,acceptCharset:tt,accessKey:tt,action:null,allow:null,allowFullScreen:ye,allowPaymentRequest:ye,allowUserMedia:ye,alt:null,as:null,async:ye,autoCapitalize:null,autoComplete:tt,autoFocus:ye,autoPlay:ye,blocking:tt,capture:null,charSet:null,checked:ye,cite:null,className:tt,cols:z,colSpan:null,content:null,contentEditable:It,controls:ye,controlsList:tt,coords:z|za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ye,defer:ye,dir:null,dirName:null,disabled:ye,download:Vk,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ye,formTarget:null,headers:tt,height:z,hidden:ye,high:z,href:null,hrefLang:null,htmlFor:tt,httpEquiv:tt,id:null,imageSizes:null,imageSrcSet:null,inert:ye,inputMode:null,integrity:null,is:null,isMap:ye,itemId:null,itemProp:tt,itemRef:tt,itemScope:ye,itemType:tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ye,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:ye,muted:ye,name:null,nonce:null,noModule:ye,noValidate:ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ye,optimum:z,pattern:null,ping:tt,placeholder:null,playsInline:ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ye,referrerPolicy:null,rel:tt,required:ye,reversed:ye,rows:z,rowSpan:z,sandbox:tt,scope:null,scoped:ye,seamless:ye,selected:ye,shadowRootClonable:ye,shadowRootDelegatesFocus:ye,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:ye,useMap:null,value:It,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tt,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ye,declare:ye,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:ye,noHref:ye,noShade:ye,noWrap:ye,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ye,disableRemotePlayback:ye,prefix:null,property:null,results:z,security:null,unselectable:null}});var n1=In({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:bf,properties:{about:Zr,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:za,g2:za,glyphName:za,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:Zr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zr,rev:Zr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zr,requiredFeatures:Zr,requiredFonts:Zr,requiredFormats:Zr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:Zr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zr,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var fZ=/^data[-\w.:]+$/i,i1=/-[a-z]/g,gZ=/[A-Z]/g;function Jk(t,e){let r=Id(e),n=e,i=Sr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&fZ.test(e)){if(e.charAt(4)==="-"){let a=e.slice(5).replace(i1,bZ);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=e.slice(4);if(!i1.test(a)){let o=a.replace(gZ,yZ);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Uo}return new i(n,e)}function yZ(t){return"-"+t.toLowerCase()}function bZ(t){return t.charAt(1).toUpperCase()}var a1=Gk([Wk,qk,Zk,Kk,r1],"html"),_f=Gk([Wk,qk,Zk,Kk,n1],"svg");var o1={}.hasOwnProperty;function s1(t,e){let r=e||{};function n(i,...a){let o=n.invalid,s=n.handlers;if(i&&o1.call(i,t)){let l=String(i[t]);o=o1.call(s,l)?s[l]:n.unknown}if(o)return o.call(this,i,...a)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}var vZ=/["&'<>`]/g,_Z=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,SZ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wZ=/[|\\{}()[\]^$+*?.]/g,l1=new WeakMap;function c1(t,e){if(t=t.replace(e.subset?kZ(e.subset):vZ,n),e.subset||e.escapeOnly)return t;return t.replace(_Z,r).replace(SZ,n);function r(i,a,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),e)}function n(i,a,o){return e.format(i.charCodeAt(0),o.charCodeAt(a+1),e)}}function kZ(t){let e=l1.get(t);return e||(e=xZ(t),l1.set(t,e)),e}function xZ(t){let e=[],r=-1;for(;++r<t.length;)e.push(t[r].replace(wZ,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var EZ=/[\dA-Fa-f]/;function u1(t,e,r){let n="&#x"+t.toString(16).toUpperCase();return r&&e&&!EZ.test(String.fromCharCode(e))?n:n+";"}var TZ=/\d/;function d1(t,e,r){let n="&#"+String(t);return r&&e&&!TZ.test(String.fromCharCode(e))?n:n+";"}var p1=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Sf={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var m1=["cent","copy","divide","gt","lt","not","para","times"];var h1={}.hasOwnProperty,Xk={},wf;for(wf in Sf)h1.call(Sf,wf)&&(Xk[Sf[wf]]=wf);var CZ=/[^\dA-Za-z]/;function f1(t,e,r,n){let i=String.fromCharCode(t);if(h1.call(Xk,i)){let a=Xk[i],o="&"+a;return r&&p1.includes(a)&&!m1.includes(a)&&(!n||e&&e!==61&&CZ.test(String.fromCharCode(e)))?o:o+";"}return""}function g1(t,e,r){let n=u1(t,e,r.omitOptionalSemicolons),i;if((r.useNamedReferences||r.useShortestReferences)&&(i=f1(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!i)&&r.useShortestReferences){let a=d1(t,e,r.omitOptionalSemicolons);a.length<n.length&&(n=a)}return i&&(!r.useShortestReferences||i.length<n.length)?i:n}function ea(t,e){return c1(t,Object.assign({format:g1},e))}var IZ=/^>|^->|<!--|-->|--!>|<!-$/g,AZ=[">"],PZ=["<",">"];function y1(t,e,r,n){return n.settings.bogusComments?"<?"+ea(t.value,Object.assign({},n.settings.characterReferences,{subset:AZ}))+">":"<!--"+t.value.replace(IZ,i)+"-->";function i(a){return ea(a,Object.assign({},n.settings.characterReferences,{subset:PZ}))}}function b1(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function Yk(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function v1(t,e){let r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}var Mt=_1(1),Qk=_1(-1),RZ=[];function _1(t){return e;function e(r,n,i){let a=r?r.children:RZ,o=(n||0)+t,s=a[o];if(!i)for(;s&&on(s);)o+=t,s=a[o];return s}}var NZ={}.hasOwnProperty;function kf(t){return e;function e(r,n,i){return NZ.call(t,r.tagName)&&t[r.tagName](r,n,i)}}var Pd=kf({body:DZ,caption:ex,colgroup:ex,dd:zZ,dt:LZ,head:ex,html:OZ,li:$Z,optgroup:FZ,option:BZ,p:MZ,rp:S1,rt:S1,tbody:UZ,td:w1,tfoot:GZ,th:w1,thead:jZ,tr:VZ});function ex(t,e,r){let n=Mt(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&on(n.value.charAt(0)))}function OZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function DZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function MZ(t,e,r){let n=Mt(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function $Z(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="li"}function LZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function zZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function S1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function FZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function BZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function jZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function UZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function GZ(t,e,r){return!Mt(r,e)}function VZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function w1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var k1=kf({body:WZ,colgroup:ZZ,head:qZ,html:HZ,tbody:KZ});function HZ(t){let e=Mt(t,-1);return!e||e.type!=="comment"}function qZ(t){let e=t.children,r=[],n=-1;for(;++n<e.length;){let i=e[n];if(i.type==="element"&&(i.tagName==="title"||i.tagName==="base")){if(r.includes(i.tagName))return!1;r.push(i.tagName)}}return e.length>0}function WZ(t){let e=Mt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&on(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ZZ(t,e,r){let n=Qk(r,e),i=Mt(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&Pd(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function KZ(t,e,r){let n=Qk(r,e),i=Mt(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Pd(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var xf={name:[[`
|
|
3504
|
+
`)+String(r).repeat(Math.max(s,0));c&&c.type==="text"?c.value=on(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function Yk(t,e){return t.type==="root"||(t.type==="element"?e||yi(t,"script")||Bo(t)||!Kk(t):!1)}var t1=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Qi=class{constructor(e,r,n){this.property=e,this.normal=r,n&&(this.space=n)}};Qi.prototype.property={};Qi.prototype.normal={};Qi.prototype.space=null;function Qk(t,e){let r={},n={},i=-1;for(;++i<t.length;)Object.assign(r,t[i].property),Object.assign(n,t[i].normal);return new Qi(r,n,e)}function Rd(t){return t.toLowerCase()}var Sr=class{constructor(e,r){this.property=e,this.attribute=r}};Sr.prototype.space=null;Sr.prototype.boolean=!1;Sr.prototype.booleanish=!1;Sr.prototype.overloadedBoolean=!1;Sr.prototype.number=!1;Sr.prototype.commaSeparated=!1;Sr.prototype.spaceSeparated=!1;Sr.prototype.commaOrSpaceSeparated=!1;Sr.prototype.mustUseProperty=!1;Sr.prototype.defined=!1;var Nd={};rc(Nd,{boolean:()=>ye,booleanish:()=>It,commaOrSpaceSeparated:()=>Zr,commaSeparated:()=>za,number:()=>z,overloadedBoolean:()=>ex,spaceSeparated:()=>tt});var hZ=0,ye=jo(),It=jo(),ex=jo(),z=jo(),tt=jo(),za=jo(),Zr=jo();function jo(){return 2**++hZ}var tx=Object.keys(Nd),Uo=class extends Sr{constructor(e,r,n,i){let a=-1;if(super(e,r),r1(this,"space",i),typeof n=="number")for(;++a<tx.length;){let o=tx[a];r1(this,tx[a],(n&Nd[o])===Nd[o])}}};Uo.prototype.defined=!0;function r1(t,e,r){r&&(t[e]=r)}var fZ={}.hasOwnProperty;function In(t){let e={},r={},n;for(n in t.properties)if(fZ.call(t.properties,n)){let i=t.properties[n],a=new Uo(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),e[n]=a,r[Rd(n)]=n,r[Rd(a.attribute)]=n}return new Qi(e,r,t.space)}var rx=In({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var nx=In({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function _f(t,e){return e in t?t[e]:e}function Sf(t,e){return _f(t,e.toLowerCase())}var ix=In({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Sf,properties:{xmlns:null,xmlnsXLink:null}});var ax=In({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:tt,ariaCurrent:null,ariaDescribedBy:tt,ariaDetails:null,ariaDisabled:It,ariaDropEffect:tt,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:tt,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tt,ariaLevel:z,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:tt,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:tt,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:It,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null}});var n1=In({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Sf,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:za,acceptCharset:tt,accessKey:tt,action:null,allow:null,allowFullScreen:ye,allowPaymentRequest:ye,allowUserMedia:ye,alt:null,as:null,async:ye,autoCapitalize:null,autoComplete:tt,autoFocus:ye,autoPlay:ye,blocking:tt,capture:null,charSet:null,checked:ye,cite:null,className:tt,cols:z,colSpan:null,content:null,contentEditable:It,controls:ye,controlsList:tt,coords:z|za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ye,defer:ye,dir:null,dirName:null,disabled:ye,download:ex,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ye,formTarget:null,headers:tt,height:z,hidden:ye,high:z,href:null,hrefLang:null,htmlFor:tt,httpEquiv:tt,id:null,imageSizes:null,imageSrcSet:null,inert:ye,inputMode:null,integrity:null,is:null,isMap:ye,itemId:null,itemProp:tt,itemRef:tt,itemScope:ye,itemType:tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ye,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:ye,muted:ye,name:null,nonce:null,noModule:ye,noValidate:ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ye,optimum:z,pattern:null,ping:tt,placeholder:null,playsInline:ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ye,referrerPolicy:null,rel:tt,required:ye,reversed:ye,rows:z,rowSpan:z,sandbox:tt,scope:null,scoped:ye,seamless:ye,selected:ye,shadowRootClonable:ye,shadowRootDelegatesFocus:ye,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:ye,useMap:null,value:It,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tt,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ye,declare:ye,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:ye,noHref:ye,noShade:ye,noWrap:ye,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ye,disableRemotePlayback:ye,prefix:null,property:null,results:z,security:null,unselectable:null}});var i1=In({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:_f,properties:{about:Zr,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:za,g2:za,glyphName:za,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:Zr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zr,rev:Zr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zr,requiredFeatures:Zr,requiredFonts:Zr,requiredFormats:Zr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:Zr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zr,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var gZ=/^data[-\w.:]+$/i,a1=/-[a-z]/g,yZ=/[A-Z]/g;function ox(t,e){let r=Rd(e),n=e,i=Sr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&gZ.test(e)){if(e.charAt(4)==="-"){let a=e.slice(5).replace(a1,vZ);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=e.slice(4);if(!a1.test(a)){let o=a.replace(yZ,bZ);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Uo}return new i(n,e)}function bZ(t){return"-"+t.toLowerCase()}function vZ(t){return t.charAt(1).toUpperCase()}var o1=Qk([nx,rx,ix,ax,n1],"html"),wf=Qk([nx,rx,ix,ax,i1],"svg");var s1={}.hasOwnProperty;function l1(t,e){let r=e||{};function n(i,...a){let o=n.invalid,s=n.handlers;if(i&&s1.call(i,t)){let l=String(i[t]);o=s1.call(s,l)?s[l]:n.unknown}if(o)return o.call(this,i,...a)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}var _Z=/["&'<>`]/g,SZ=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wZ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,kZ=/[|\\{}()[\]^$+*?.]/g,c1=new WeakMap;function u1(t,e){if(t=t.replace(e.subset?xZ(e.subset):_Z,n),e.subset||e.escapeOnly)return t;return t.replace(SZ,r).replace(wZ,n);function r(i,a,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),e)}function n(i,a,o){return e.format(i.charCodeAt(0),o.charCodeAt(a+1),e)}}function xZ(t){let e=c1.get(t);return e||(e=EZ(t),c1.set(t,e)),e}function EZ(t){let e=[],r=-1;for(;++r<t.length;)e.push(t[r].replace(kZ,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var TZ=/[\dA-Fa-f]/;function d1(t,e,r){let n="&#x"+t.toString(16).toUpperCase();return r&&e&&!TZ.test(String.fromCharCode(e))?n:n+";"}var CZ=/\d/;function p1(t,e,r){let n="&#"+String(t);return r&&e&&!CZ.test(String.fromCharCode(e))?n:n+";"}var m1=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var kf={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var h1=["cent","copy","divide","gt","lt","not","para","times"];var f1={}.hasOwnProperty,sx={},xf;for(xf in kf)f1.call(kf,xf)&&(sx[kf[xf]]=xf);var IZ=/[^\dA-Za-z]/;function g1(t,e,r,n){let i=String.fromCharCode(t);if(f1.call(sx,i)){let a=sx[i],o="&"+a;return r&&m1.includes(a)&&!h1.includes(a)&&(!n||e&&e!==61&&IZ.test(String.fromCharCode(e)))?o:o+";"}return""}function y1(t,e,r){let n=d1(t,e,r.omitOptionalSemicolons),i;if((r.useNamedReferences||r.useShortestReferences)&&(i=g1(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!i)&&r.useShortestReferences){let a=p1(t,e,r.omitOptionalSemicolons);a.length<n.length&&(n=a)}return i&&(!r.useShortestReferences||i.length<n.length)?i:n}function ea(t,e){return u1(t,Object.assign({format:y1},e))}var AZ=/^>|^->|<!--|-->|--!>|<!-$/g,PZ=[">"],RZ=["<",">"];function b1(t,e,r,n){return n.settings.bogusComments?"<?"+ea(t.value,Object.assign({},n.settings.characterReferences,{subset:PZ}))+">":"<!--"+t.value.replace(AZ,i)+"-->";function i(a){return ea(a,Object.assign({},n.settings.characterReferences,{subset:RZ}))}}function v1(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function lx(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function _1(t,e){let r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}var Mt=S1(1),cx=S1(-1),NZ=[];function S1(t){return e;function e(r,n,i){let a=r?r.children:NZ,o=(n||0)+t,s=a[o];if(!i)for(;s&&on(s);)o+=t,s=a[o];return s}}var OZ={}.hasOwnProperty;function Ef(t){return e;function e(r,n,i){return OZ.call(t,r.tagName)&&t[r.tagName](r,n,i)}}var Od=Ef({body:MZ,caption:ux,colgroup:ux,dd:FZ,dt:zZ,head:ux,html:DZ,li:LZ,optgroup:BZ,option:jZ,p:$Z,rp:w1,rt:w1,tbody:GZ,td:k1,tfoot:VZ,th:k1,thead:UZ,tr:HZ});function ux(t,e,r){let n=Mt(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&on(n.value.charAt(0)))}function DZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function MZ(t,e,r){let n=Mt(r,e);return!n||n.type!=="comment"}function $Z(t,e,r){let n=Mt(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function LZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="li"}function zZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function FZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function w1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function BZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function jZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function UZ(t,e,r){let n=Mt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function GZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function VZ(t,e,r){return!Mt(r,e)}function HZ(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function k1(t,e,r){let n=Mt(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var x1=Ef({body:ZZ,colgroup:KZ,head:WZ,html:qZ,tbody:JZ});function qZ(t){let e=Mt(t,-1);return!e||e.type!=="comment"}function WZ(t){let e=t.children,r=[],n=-1;for(;++n<e.length;){let i=e[n];if(i.type==="element"&&(i.tagName==="title"||i.tagName==="base")){if(r.includes(i.tagName))return!1;r.push(i.tagName)}}return e.length>0}function ZZ(t){let e=Mt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&on(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function KZ(t,e,r){let n=cx(r,e),i=Mt(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&Od(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function JZ(t,e,r){let n=cx(r,e),i=Mt(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Od(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var Tf={name:[[`
|
|
3505
3505
|
\f\r &/=>`.split(""),`
|
|
3506
3506
|
\f\r "&'/=>\``.split("")],[`\0
|
|
3507
3507
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -3509,19 +3509,19 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3509
3509
|
\f\r &>`.split(""),`\0
|
|
3510
3510
|
\f\r "&'<=>\``.split("")],[`\0
|
|
3511
3511
|
\f\r "&'<=>\``.split(""),`\0
|
|
3512
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function x1(t,e,r,n){let i=n.schema,a=i.space==="svg"?!1:n.settings.omitOptionalTags,o=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(t.tagName.toLowerCase()),s=[],l;i.space==="html"&&t.tagName==="svg"&&(n.schema=_f);let c=JZ(n,t.properties),u=n.all(i.space==="html"&&t.tagName==="template"?t.content:t);return n.schema=i,u&&(o=!1),(c||!a||!k1(t,e,r))&&(s.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||n.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Pd(t,e,r))&&s.push("</"+t.tagName+">"),s.join("")}function JZ(t,e){let r=[],n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let a=XZ(t,i,e[i]);a&&r.push(a)}}for(;++n<r.length;){let a=t.settings.tightAttributes?r[n].charAt(r[n].length-1):void 0;n!==r.length-1&&a!=='"'&&a!=="'"&&(r[n]+=" ")}return r.join("")}function XZ(t,e,r){let n=Jk(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,a=t.settings.allowDangerousCharacters?0:1,o=t.quote,s;if(n.overloadedBoolean&&(r===n.attribute||r==="")?r=!0:(n.boolean||n.overloadedBoolean&&typeof r!="string")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";let l=ea(n.attribute,Object.assign({},t.settings.characterReferences,{subset:xf.name[i][a]}));return r===!0||(r=Array.isArray(r)?(n.commaSeparated?v1:GO)(r,{padLeft:!t.settings.tightCommaSeparatedLists}):String(r),t.settings.collapseEmptyAttributes&&!r)?l:(t.settings.preferUnquoted&&(s=ea(r,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:xf.unquoted[i][a]}))),s!==r&&(t.settings.quoteSmart&&Yk(r,o)>Yk(r,t.alternative)&&(o=t.alternative),s=o+ea(r,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?xf.single:xf.double)[i][a],attribute:!0}))+o),l+(s&&"="+s))}var YZ=["<","&"];function Ef(t,e,r,n){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?t.value:ea(t.value,Object.assign({},n.settings.characterReferences,{subset:YZ}))}function E1(t,e,r,n){return n.settings.allowDangerousHtml?t.value:Ef(t,e,r,n)}function T1(t,e,r,n){return n.all(t)}var C1=s1("type",{invalid:QZ,unknown:eK,handlers:{comment:y1,doctype:b1,element:x1,raw:E1,root:T1,text:Ef}});function QZ(t){throw new Error("Expected node, not `"+t+"`")}function eK(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var tK={},rK={},nK=[];function tx(t,e){let r=e||tK,n=r.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:iK,all:aK,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||e1,characterReferences:r.characterReferences||rK,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?_f:a1,quote:n,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function iK(t,e,r){return C1(t,e,r,this)}function aK(t){let e=[],r=t&&t.children||nK,n=-1;for(;++n<r.length;)e[n]=this.one(r[n],n,t);return e.join("")}function Tf(t){let e=this,r={...e.data("settings"),...t};e.compiler=n;function n(i){return tx(i,r)}}var oK={};function rx(t,e){let r=e||oK,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return A1(t,n,i)}function A1(t,e,r){if(sK(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return I1(t.children,e,r)}return Array.isArray(t)?I1(t,e,r):""}function I1(t,e,r){let n=[],i=-1;for(;++i<t.length;)n[i]=A1(t[i],e,r);return n.join("")}function sK(t){return!!(t&&typeof t=="object")}var P1=document.createElement("i");function $l(t){let e="&"+t+";";P1.innerHTML=e;let r=P1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wr(t,e,r,n){let i=t.length,a=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);a<n.length;)o=n.slice(a,a+1e4),o.unshift(e,0),t.splice(...o),a+=1e4,e+=1e4}function Or(t,e){return t.length>0?(wr(t,t.length,0,e),t):e}var R1={}.hasOwnProperty;function N1(t){let e={},r=-1;for(;++r<t.length;)lK(e,t[r]);return e}function lK(t,e){let r;for(r in e){let i=(R1.call(t,r)?t[r]:void 0)||(t[r]={}),a=e[r],o;if(a)for(o in a){R1.call(i,o)||(i[o]=[]);let s=a[o];cK(i[o],Array.isArray(s)?s:s?[s]:[])}}}function cK(t,e){let r=-1,n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wr(t,0,0,n)}function Cf(t,e){let r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var sn=Fa(/[A-Za-z]/),Kt=Fa(/[\dA-Za-z]/),O1=Fa(/[#-'*+\--9=?A-Z^-~]/);function Rd(t){return t!==null&&(t<32||t===127)}var Nd=Fa(/\d/),D1=Fa(/[\dA-Fa-f]/),M1=Fa(/[!-/:-@[-`{-~]/);function X(t){return t!==null&&t<-2}function $t(t){return t!==null&&(t<0||t===32)}function be(t){return t===-2||t===-1||t===32}var $1=Fa(/\p{P}|\p{S}/u),L1=Fa(/\s/);function Fa(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function An(t){let e=[],r=-1,n=0,i=0;for(;++r<t.length;){let a=t.charCodeAt(r),o="";if(a===37&&Kt(t.charCodeAt(r+1))&&Kt(t.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=t.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function ve(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return be(l)?(t.enter(r),s(l)):e(l)}function s(l){return be(l)&&a++<i?(t.consume(l),s):(t.exit(r),e(l))}}var z1={tokenize:uK};function uK(t){let e=t.attempt(this.parser.constructs.contentInitial,n,i),r;return e;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ve(t,e,"linePrefix")}function i(s){return t.enter("paragraph"),a(s)}function a(s){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(s)}function o(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return X(s)?(t.consume(s),t.exit("chunkText"),a):(t.consume(s),o)}}var B1={tokenize:dK},F1={tokenize:pK};function dK(t){let e=this,r=[],n=0,i,a,o;return s;function s(v){if(n<r.length){let I=r[n];return e.containerState=I[1],t.attempt(I[0].continuation,l,c)(v)}return c(v)}function l(v){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&S();let I=e.events.length,T=I,C;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){C=e.events[T][1].end;break}g(n);let $=I;for(;$<e.events.length;)e.events[$][1].end=Object.assign({},C),$++;return wr(e.events,T+1,0,e.events.slice(I)),e.events.length=$,c(v)}return s(v)}function c(v){if(n===r.length){if(!i)return m(v);if(i.currentConstruct&&i.currentConstruct.concrete)return h(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(F1,u,d)(v)}function u(v){return i&&S(),g(n),m(v)}function d(v){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,h(v)}function m(v){return e.containerState={},t.attempt(F1,p,h)(v)}function p(v){return n++,r.push([e.currentConstruct,e.containerState]),m(v)}function h(v){if(v===null){i&&S(),g(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(v)}function f(v){if(v===null){y(t.exit("chunkFlow"),!0),g(0),t.consume(v);return}return X(v)?(t.consume(v),y(t.exit("chunkFlow")),n=0,e.interrupt=void 0,s):(t.consume(v),f)}function y(v,I){let T=e.sliceStream(v);if(I&&T.push(null),v.previous=a,a&&(a.next=v),a=v,i.defineSkip(v.start),i.write(T),e.parser.lazy[v.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;let $=e.events.length,W=$,M,B;for(;W--;)if(e.events[W][0]==="exit"&&e.events[W][1].type==="chunkFlow"){if(M){B=e.events[W][1].end;break}M=!0}for(g(n),C=$;C<e.events.length;)e.events[C][1].end=Object.assign({},B),C++;wr(e.events,W+1,0,e.events.slice($)),e.events.length=C}}function g(v){let I=r.length;for(;I-- >v;){let T=r[I];e.containerState=T[1],T[0].exit.call(e,t)}r.length=v}function S(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function pK(t,e,r){return ve(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nx(t){if(t===null||$t(t)||L1(t))return 1;if($1(t))return 2}function Ll(t,e,r){let n=[],i=-1;for(;++i<t.length;){let a=t[i].resolveAll;a&&!n.includes(a)&&(e=a(e,r),n.push(a))}return e}var Od={name:"attention",tokenize:hK,resolveAll:mK};function mK(t,e){let r=-1,n,i,a,o,s,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[n][1].end),m=Object.assign({},t[r][1].start);j1(d,-l),j1(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[n][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[r][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},t[n][1].end=Object.assign({},o.start),t[r][1].start=Object.assign({},s.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Or(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Or(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",a,e]]),c=Or(c,Ll(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Or(c,[["exit",a,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Or(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,wr(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function hK(t,e){let r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=nx(n),a;return o;function o(l){return a=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===a)return t.consume(l),s;let c=t.exit("attentionSequence"),u=nx(l),d=!u||u===2&&i||r.includes(l),m=!i||i===2&&u||r.includes(n);return c._open=!!(a===42?d:d&&(i||!m)),c._close=!!(a===42?m:m&&(u||!d)),e(l)}}function j1(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var ix={name:"autolink",tokenize:fK};function fK(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(p){return sn(p)?(t.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Kt(p)?(n=1,s(p)):c(p)}function s(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||Kt(p))&&n++<32?(t.consume(p),s):(n=0,c(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Rd(p)?r(p):(t.consume(p),l)}function c(p){return p===64?(t.consume(p),u):O1(p)?(t.consume(p),c):r(p)}function u(p){return Kt(p)?d(p):r(p)}function d(p){return p===46?(t.consume(p),n=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):m(p)}function m(p){if((p===45||Kt(p))&&n++<63){let h=p===45?m:d;return t.consume(p),h}return r(p)}}var Ba={tokenize:gK,partial:!0};function gK(t,e,r){return n;function n(a){return be(a)?ve(t,i,"linePrefix")(a):i(a)}function i(a){return a===null||X(a)?e(a):r(a)}}var If={name:"blockQuote",tokenize:yK,continuation:{tokenize:bK},exit:vK};function yK(t,e,r){let n=this;return i;function i(o){if(o===62){let s=n.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),a}return r(o)}function a(o){return be(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function bK(t,e,r){let n=this;return i;function i(o){return be(o)?ve(t,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return t.attempt(If,e,r)(o)}}function vK(t){t.exit("blockQuote")}var Af={name:"characterEscape",tokenize:_K};function _K(t,e,r){return n;function n(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),i}function i(a){return M1(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(a)}}var Pf={name:"characterReference",tokenize:SK};function SK(t,e,r){let n=this,i=0,a,o;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),a=31,o=Kt,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,o=D1,u):(t.enter("characterReferenceValue"),a=7,o=Nd,u(d))}function u(d){if(d===59&&i){let m=t.exit("characterReferenceValue");return o===Kt&&!$l(n.sliceSerialize(m))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<a?(t.consume(d),u):r(d)}}var U1={tokenize:kK,partial:!0},Rf={name:"codeFenced",tokenize:wK,concrete:!0};function wK(t,e,r){let n=this,i={tokenize:T,partial:!0},a=0,o=0,s;return l;function l(C){return c(C)}function c(C){let $=n.events[n.events.length-1];return a=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,s=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,t.consume(C),u):o<3?r(C):(t.exit("codeFencedFenceSequence"),be(C)?ve(t,d,"whitespace")(C):d(C))}function d(C){return C===null||X(C)?(t.exit("codeFencedFence"),n.interrupt?e(C):t.check(U1,f,I)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(C)):be(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ve(t,p,"whitespace")(C)):C===96&&C===s?r(C):(t.consume(C),m)}function p(C){return C===null||X(C)?d(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(C))}function h(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(C)):C===96&&C===s?r(C):(t.consume(C),h)}function f(C){return t.attempt(i,I,y)(C)}function y(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),g}function g(C){return a>0&&be(C)?ve(t,S,"linePrefix",a+1)(C):S(C)}function S(C){return C===null||X(C)?t.check(U1,f,I)(C):(t.enter("codeFlowValue"),v(C))}function v(C){return C===null||X(C)?(t.exit("codeFlowValue"),S(C)):(t.consume(C),v)}function I(C){return t.exit("codeFenced"),e(C)}function T(C,$,W){let M=0;return B;function B(ae){return C.enter("lineEnding"),C.consume(ae),C.exit("lineEnding"),Y}function Y(ae){return C.enter("codeFencedFence"),be(ae)?ve(C,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ae):H(ae)}function H(ae){return ae===s?(C.enter("codeFencedFenceSequence"),j(ae)):W(ae)}function j(ae){return ae===s?(M++,C.consume(ae),j):M>=o?(C.exit("codeFencedFenceSequence"),be(ae)?ve(C,Z,"whitespace")(ae):Z(ae)):W(ae)}function Z(ae){return ae===null||X(ae)?(C.exit("codeFencedFence"),$(ae)):W(ae)}}}function kK(t,e,r){let n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}var Dd={name:"codeIndented",tokenize:EK},xK={tokenize:TK,partial:!0};function EK(t,e,r){let n=this;return i;function i(c){return t.enter("codeIndented"),ve(t,a,"linePrefix",5)(c)}function a(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):X(c)?t.attempt(xK,o,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||X(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function TK(t,e,r){let n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):ve(t,a,"linePrefix",5)(o)}function a(o){let s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):X(o)?i(o):r(o)}}var ax={name:"codeText",tokenize:AK,resolve:CK,previous:IK};function CK(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function IK(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function AK(t,e,r){let n=this,i=0,a,o;return s;function s(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),i++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?r(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(o=t.enter("codeTextSequence"),a=0,d(m)):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||X(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),u)}function d(m){return m===96?(t.consume(m),a++,d):a===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var Nf=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){let i=r||0;this.setCursor(Math.trunc(e));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Md(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Md(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Md(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);Md(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Md(this.left,r.reverse())}}};function Md(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Of(t){let e={},r=-1,n,i,a,o,s,l,c,u=new Nf(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,PK(u,r)),r=e[r],c=!0);else if(n[1]._container){for(a=r,i=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);i&&(n[1].end=Object.assign({},u.get(i)[1].start),s=u.slice(i,r),s.unshift(n),u.splice(i,r-i+1,s))}}return wr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function PK(t,e){let r=t.get(e)[1],n=t.get(e)[2],i=e-1,a=[],o=r._tokenizer||n.parser[r.contentType](r.start),s=o.events,l=[],c={},u,d,m=-1,p=r,h=0,f=0,y=[f];for(;p;){for(;t.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=n.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){let g=s.slice(y[m],y[m+1]),S=a.pop();l.push([S,S+g.length-1]),t.splice(S,2,g)}for(l.reverse(),m=-1;++m<l.length;)c[h+l[m][0]]=h+l[m][1],h+=l[m][1]-l[m][0]-1;return c}var ox={tokenize:OK,resolve:NK},RK={tokenize:DK,partial:!0};function NK(t){return Of(t),t}function OK(t,e){let r;return n;function n(s){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?a(s):X(s)?t.check(RK,o,a)(s):(t.consume(s),i)}function a(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function o(s){return t.consume(s),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function DK(t,e,r){let n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),ve(t,a,"linePrefix")}function a(o){if(o===null||X(o))return r(o);let s=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function Df(t,e,r,n,i,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(g){return g===60?(t.enter(n),t.enter(i),t.enter(a),t.consume(g),t.exit(a),m):g===null||g===32||g===41||Rd(g)?r(g):(t.enter(n),t.enter(o),t.enter(s),t.enter("chunkString",{contentType:"string"}),f(g))}function m(g){return g===62?(t.enter(a),t.consume(g),t.exit(a),t.exit(i),t.exit(n),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(s),m(g)):g===null||g===60||X(g)?r(g):(t.consume(g),g===92?h:p)}function h(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function f(g){return!u&&(g===null||g===41||$t(g))?(t.exit("chunkString"),t.exit(s),t.exit(o),t.exit(n),e(g)):u<c&&g===40?(t.consume(g),u++,f):g===41?(t.consume(g),u--,f):g===null||g===32||g===40||Rd(g)?r(g):(t.consume(g),g===92?y:f)}function y(g){return g===40||g===41||g===92?(t.consume(g),f):f(g)}}function Mf(t,e,r,n,i,a){let o=this,s=0,l;return c;function c(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(a),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):X(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||X(p)||s++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!be(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(t.consume(p),s++,d):d(p)}}function $f(t,e,r,n,i,a){let o;return s;function s(m){return m===34||m===39||m===40?(t.enter(n),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):r(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(n),e):(t.enter(a),c(m))}function c(m){return m===o?(t.exit(a),l(o)):m===null?r(m):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),ve(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||X(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(t.consume(m),u):u(m)}}function Go(t,e){let r;return n;function n(i){return X(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):be(i)?ve(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}var sx={name:"definition",tokenize:$K},MK={tokenize:LK,partial:!0};function $K(t,e,r){let n=this,i;return a;function a(p){return t.enter("definition"),o(p)}function o(p){return Mf.call(n,t,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return $t(p)?Go(t,c)(p):c(p)}function c(p){return Df(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(MK,d,d)(p)}function d(p){return be(p)?ve(t,m,"whitespace")(p):m(p)}function m(p){return p===null||X(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function LK(t,e,r){return n;function n(s){return $t(s)?Go(t,i)(s):r(s)}function i(s){return $f(t,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return be(s)?ve(t,o,"whitespace")(s):o(s)}function o(s){return s===null||X(s)?e(s):r(s)}}var lx={name:"hardBreakEscape",tokenize:zK};function zK(t,e,r){return n;function n(a){return t.enter("hardBreakEscape"),t.consume(a),i}function i(a){return X(a)?(t.exit("hardBreakEscape"),e(a)):r(a)}}var cx={name:"headingAtx",tokenize:BK,resolve:FK};function FK(t,e){let r=t.length-2,n=3,i,a;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},a={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},wr(t,n,r-n+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),t}function BK(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),a(u)}function a(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||$t(u)?(t.exit("atxHeadingSequence"),s(u)):r(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(t.exit("atxHeading"),e(u)):be(u)?ve(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||$t(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var G1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ux=["pre","script","style","textarea"];var dx={name:"htmlFlow",tokenize:VK,resolveTo:GK,concrete:!0},jK={tokenize:qK,partial:!0},UK={tokenize:HK,partial:!0};function GK(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function VK(t,e,r){let n=this,i,a,o,s,l;return c;function c(x){return u(x)}function u(x){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(x),d}function d(x){return x===33?(t.consume(x),m):x===47?(t.consume(x),a=!0,f):x===63?(t.consume(x),i=3,n.interrupt?e:w):sn(x)?(t.consume(x),o=String.fromCharCode(x),y):r(x)}function m(x){return x===45?(t.consume(x),i=2,p):x===91?(t.consume(x),i=5,s=0,h):sn(x)?(t.consume(x),i=4,n.interrupt?e:w):r(x)}function p(x){return x===45?(t.consume(x),n.interrupt?e:w):r(x)}function h(x){let Lt="CDATA[";return x===Lt.charCodeAt(s++)?(t.consume(x),s===Lt.length?n.interrupt?e:H:h):r(x)}function f(x){return sn(x)?(t.consume(x),o=String.fromCharCode(x),y):r(x)}function y(x){if(x===null||x===47||x===62||$t(x)){let Lt=x===47,zt=o.toLowerCase();return!Lt&&!a&&ux.includes(zt)?(i=1,n.interrupt?e(x):H(x)):G1.includes(o.toLowerCase())?(i=6,Lt?(t.consume(x),g):n.interrupt?e(x):H(x)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(x):a?S(x):v(x))}return x===45||Kt(x)?(t.consume(x),o+=String.fromCharCode(x),y):r(x)}function g(x){return x===62?(t.consume(x),n.interrupt?e:H):r(x)}function S(x){return be(x)?(t.consume(x),S):B(x)}function v(x){return x===47?(t.consume(x),B):x===58||x===95||sn(x)?(t.consume(x),I):be(x)?(t.consume(x),v):B(x)}function I(x){return x===45||x===46||x===58||x===95||Kt(x)?(t.consume(x),I):T(x)}function T(x){return x===61?(t.consume(x),C):be(x)?(t.consume(x),T):v(x)}function C(x){return x===null||x===60||x===61||x===62||x===96?r(x):x===34||x===39?(t.consume(x),l=x,$):be(x)?(t.consume(x),C):W(x)}function $(x){return x===l?(t.consume(x),l=null,M):x===null||X(x)?r(x):(t.consume(x),$)}function W(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||$t(x)?T(x):(t.consume(x),W)}function M(x){return x===47||x===62||be(x)?v(x):r(x)}function B(x){return x===62?(t.consume(x),Y):r(x)}function Y(x){return x===null||X(x)?H(x):be(x)?(t.consume(x),Y):r(x)}function H(x){return x===45&&i===2?(t.consume(x),$e):x===60&&i===1?(t.consume(x),Xe):x===62&&i===4?(t.consume(x),xr):x===63&&i===3?(t.consume(x),w):x===93&&i===5?(t.consume(x),kt):X(x)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(jK,Pn,j)(x)):x===null||X(x)?(t.exit("htmlFlowData"),j(x)):(t.consume(x),H)}function j(x){return t.check(UK,Z,Pn)(x)}function Z(x){return t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),ae}function ae(x){return x===null||X(x)?j(x):(t.enter("htmlFlowData"),H(x))}function $e(x){return x===45?(t.consume(x),w):H(x)}function Xe(x){return x===47?(t.consume(x),o="",At):H(x)}function At(x){if(x===62){let Lt=o.toLowerCase();return ux.includes(Lt)?(t.consume(x),xr):H(x)}return sn(x)&&o.length<8?(t.consume(x),o+=String.fromCharCode(x),At):H(x)}function kt(x){return x===93?(t.consume(x),w):H(x)}function w(x){return x===62?(t.consume(x),xr):x===45&&i===2?(t.consume(x),w):H(x)}function xr(x){return x===null||X(x)?(t.exit("htmlFlowData"),Pn(x)):(t.consume(x),xr)}function Pn(x){return t.exit("htmlFlow"),e(x)}}function HK(t,e,r){let n=this;return i;function i(o){return X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a):r(o)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function qK(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ba,e,r)}}var px={name:"htmlText",tokenize:WK};function WK(t,e,r){let n=this,i,a,o;return s;function s(w){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(w),l}function l(w){return w===33?(t.consume(w),c):w===47?(t.consume(w),T):w===63?(t.consume(w),v):sn(w)?(t.consume(w),W):r(w)}function c(w){return w===45?(t.consume(w),u):w===91?(t.consume(w),a=0,h):sn(w)?(t.consume(w),S):r(w)}function u(w){return w===45?(t.consume(w),p):r(w)}function d(w){return w===null?r(w):w===45?(t.consume(w),m):X(w)?(o=d,Xe(w)):(t.consume(w),d)}function m(w){return w===45?(t.consume(w),p):d(w)}function p(w){return w===62?$e(w):w===45?m(w):d(w)}function h(w){let xr="CDATA[";return w===xr.charCodeAt(a++)?(t.consume(w),a===xr.length?f:h):r(w)}function f(w){return w===null?r(w):w===93?(t.consume(w),y):X(w)?(o=f,Xe(w)):(t.consume(w),f)}function y(w){return w===93?(t.consume(w),g):f(w)}function g(w){return w===62?$e(w):w===93?(t.consume(w),g):f(w)}function S(w){return w===null||w===62?$e(w):X(w)?(o=S,Xe(w)):(t.consume(w),S)}function v(w){return w===null?r(w):w===63?(t.consume(w),I):X(w)?(o=v,Xe(w)):(t.consume(w),v)}function I(w){return w===62?$e(w):v(w)}function T(w){return sn(w)?(t.consume(w),C):r(w)}function C(w){return w===45||Kt(w)?(t.consume(w),C):$(w)}function $(w){return X(w)?(o=$,Xe(w)):be(w)?(t.consume(w),$):$e(w)}function W(w){return w===45||Kt(w)?(t.consume(w),W):w===47||w===62||$t(w)?M(w):r(w)}function M(w){return w===47?(t.consume(w),$e):w===58||w===95||sn(w)?(t.consume(w),B):X(w)?(o=M,Xe(w)):be(w)?(t.consume(w),M):$e(w)}function B(w){return w===45||w===46||w===58||w===95||Kt(w)?(t.consume(w),B):Y(w)}function Y(w){return w===61?(t.consume(w),H):X(w)?(o=Y,Xe(w)):be(w)?(t.consume(w),Y):M(w)}function H(w){return w===null||w===60||w===61||w===62||w===96?r(w):w===34||w===39?(t.consume(w),i=w,j):X(w)?(o=H,Xe(w)):be(w)?(t.consume(w),H):(t.consume(w),Z)}function j(w){return w===i?(t.consume(w),i=void 0,ae):w===null?r(w):X(w)?(o=j,Xe(w)):(t.consume(w),j)}function Z(w){return w===null||w===34||w===39||w===60||w===61||w===96?r(w):w===47||w===62||$t(w)?M(w):(t.consume(w),Z)}function ae(w){return w===47||w===62||$t(w)?M(w):r(w)}function $e(w){return w===62?(t.consume(w),t.exit("htmlTextData"),t.exit("htmlText"),e):r(w)}function Xe(w){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),At}function At(w){return be(w)?ve(t,kt,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):kt(w)}function kt(w){return t.enter("htmlTextData"),o(w)}}var Vo={name:"labelEnd",tokenize:QK,resolveTo:YK,resolveAll:XK},ZK={tokenize:e8},KK={tokenize:t8},JK={tokenize:r8};function XK(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function YK(t,e){let r=t.length,n=0,i,a,o,s;for(;r--;)if(i=t[r][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);let l={type:t[a][1].type==="labelLink"?"link":"image",start:Object.assign({},t[a][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[a][1].start),end:Object.assign({},t[o][1].end)},u={type:"labelText",start:Object.assign({},t[a+n+2][1].end),end:Object.assign({},t[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=Or(s,t.slice(a+1,a+n+3)),s=Or(s,[["enter",u,e]]),s=Or(s,Ll(e.parser.constructs.insideSpan.null,t.slice(a+n+4,o-3),e)),s=Or(s,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),s=Or(s,t.slice(o+1)),s=Or(s,[["exit",l,e]]),wr(t,a,t.length,s),t}function QK(t,e,r){let n=this,i=n.events.length,a,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){a=n.events[i][1];break}return s;function s(m){return a?a._inactive?d(m):(o=n.parser.defined.includes(ta(n.sliceSerialize({start:a.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):r(m)}function l(m){return m===40?t.attempt(ZK,u,o?u:d)(m):m===91?t.attempt(KK,u,o?c:d)(m):o?u(m):d(m)}function c(m){return t.attempt(JK,u,d)(m)}function u(m){return e(m)}function d(m){return a._balanced=!0,r(m)}}function e8(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return $t(d)?Go(t,a)(d):a(d)}function a(d){return d===41?u(d):Df(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return $t(d)?Go(t,l)(d):u(d)}function s(d){return r(d)}function l(d){return d===34||d===39||d===40?$f(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return $t(d)?Go(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function t8(t,e,r){let n=this;return i;function i(s){return Mf.call(n,t,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return n.parser.defined.includes(ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(s):r(s)}function o(s){return r(s)}}function r8(t,e,r){return n;function n(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),i}function i(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):r(a)}}var mx={name:"labelStartImage",tokenize:n8,resolveAll:Vo.resolveAll};function n8(t,e,r){let n=this;return i;function i(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),a}function a(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),o):r(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(s):e(s)}}var hx={name:"labelStartLink",tokenize:i8,resolveAll:Vo.resolveAll};function i8(t,e,r){let n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}var $d={name:"lineEnding",tokenize:a8};function a8(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),ve(t,e,"linePrefix")}}var Ho={name:"thematicBreak",tokenize:o8};function o8(t,e,r){let n=0,i;return a;function a(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,s(c)}function s(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||X(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),be(c)?ve(t,s,"whitespace")(c):s(c))}}var kr={name:"list",tokenize:c8,continuation:{tokenize:u8},exit:p8},s8={tokenize:m8,partial:!0},l8={tokenize:d8,partial:!0};function c8(t,e,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(p){let h=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Nd(p)){if(n.containerState.type||(n.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Ho,r,c)(p):c(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return Nd(p)&&++o<10?(t.consume(p),l):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):r(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(Ba,n.interrupt?r:u,t.attempt(s8,m,d))}function u(p){return n.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return be(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):r(p)}function m(p){return n.containerState.size=a+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function u8(t,e,r){let n=this;return n.containerState._closeFlow=void 0,t.check(Ba,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ve(t,e,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!be(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(l8,e,o)(s))}function o(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ve(t,t.attempt(kr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function d8(t,e,r){let n=this;return ve(t,i,"listItemIndent",n.containerState.size+1);function i(a){let o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(a):r(a)}}function p8(t){t.exit(this.containerState.type)}function m8(t,e,r){let n=this;return ve(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=n.events[n.events.length-1];return!be(a)&&o&&o[1].type==="listItemPrefixWhitespace"?e(a):r(a)}}var Lf={name:"setextUnderline",tokenize:f8,resolveTo:h8};function h8(t,e){let r=t.length,n,i,a;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!a&&t[r][1].type==="definition"&&(a=r);let o={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",a?(t.splice(i,0,["enter",o,e]),t.splice(a+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[a][1].end)):t[n][1]=o,t.push(["exit",o,e]),t}function f8(t,e,r){let n=this,i;return a;function a(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),be(c)?ve(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var V1={tokenize:g8};function g8(t){let e=this,r=t.attempt(Ba,n,t.attempt(this.parser.constructs.flowInitial,i,ve(t,t.attempt(this.parser.constructs.flow,i,t.attempt(ox,i)),"linePrefix")));return r;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var H1={resolveAll:K1()},q1=Z1("string"),W1=Z1("text");function Z1(t){return{tokenize:e,resolveAll:K1(t==="text"?y8:void 0)};function e(r){let n=this,i=this.parser.constructs[t],a=r.attempt(i,o,s);return o;function o(u){return c(u)?a(u):s(u)}function s(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),a(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=i[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function K1(t){return e;function e(r,n){let i=-1,a;for(;++i<=r.length;)a===void 0?r[i]&&r[i][1].type==="data"&&(a=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==a+2&&(r[a][1].end=r[i-1][1].end,r.splice(a+2,i-a-2),i=a+2),a=void 0);return t?t(r,n):r}}function y8(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let n=t[r-1][1],i=e.sliceStream(n),a=i.length,o=-1,s=0,l;for(;a--;){let c=i[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){a++;break}}if(s){let c={type:r===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-s,offset:n.end.offset-s,_index:n.start._index+a,_bufferIndex:a?o:n.start._bufferIndex+o},end:Object.assign({},n.end)};n.end=Object.assign({},c.start),n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function J1(t,e,r){let n=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},a=[],o=[],s=[],l=!0,c={consume:I,enter:T,exit:C,attempt:M($),check:M(W),interrupt:M(W,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:f,sliceSerialize:h,now:y,defineSkip:g,write:p},d=e.tokenize.call(u,c),m;return e.resolveAll&&a.push(e),u;function p(j){return o=Or(o,j),S(),o[o.length-1]!==null?[]:(B(e,0),u.events=Ll(a,u.events,u),u.events)}function h(j,Z){return v8(f(j),Z)}function f(j){return b8(o,j)}function y(){let{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}=n;return{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}}function g(j){i[j.line]=j.column,H()}function S(){let j;for(;n._index<o.length;){let Z=o[n._index];if(typeof Z=="string")for(j=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===j&&n._bufferIndex<Z.length;)v(Z.charCodeAt(n._bufferIndex));else v(Z)}}function v(j){l=void 0,m=j,d=d(j)}function I(j){X(j)?(n.line++,n.column=1,n.offset+=j===-3?2:1,H()):j!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=j,l=!0}function T(j,Z){let ae=Z||{};return ae.type=j,ae.start=y(),u.events.push(["enter",ae,u]),s.push(ae),ae}function C(j){let Z=s.pop();return Z.end=y(),u.events.push(["exit",Z,u]),Z}function $(j,Z){B(j,Z.from)}function W(j,Z){Z.restore()}function M(j,Z){return ae;function ae($e,Xe,At){let kt,w,xr,Pn;return Array.isArray($e)?Lt($e):"tokenize"in $e?Lt([$e]):x($e);function x(Pt){return _i;function _i($r){let Si=$r!==null&&Pt[$r],ra=$r!==null&&Pt.null,Wl=[...Array.isArray(Si)?Si:Si?[Si]:[],...Array.isArray(ra)?ra:ra?[ra]:[]];return Lt(Wl)($r)}}function Lt(Pt){return kt=Pt,w=0,Pt.length===0?At:zt(Pt[w])}function zt(Pt){return _i;function _i($r){return Pn=Y(),xr=Pt,Pt.partial||(u.currentConstruct=Pt),Pt.name&&u.parser.constructs.disable.null.includes(Pt.name)?Rn($r):Pt.tokenize.call(Z?Object.assign(Object.create(u),Z):u,c,Mr,Rn)($r)}}function Mr(Pt){return l=!0,j(xr,Pn),Xe}function Rn(Pt){return l=!0,Pn.restore(),++w<kt.length?zt(kt[w]):At}}}function B(j,Z){j.resolveAll&&!a.includes(j)&&a.push(j),j.resolve&&wr(u.events,Z,u.events.length-Z,j.resolve(u.events.slice(Z),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function Y(){let j=y(),Z=u.previous,ae=u.currentConstruct,$e=u.events.length,Xe=Array.from(s);return{restore:At,from:$e};function At(){n=j,u.previous=Z,u.currentConstruct=ae,u.events.length=$e,s=Xe,H()}}function H(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function b8(t,e){let r=e.start._index,n=e.start._bufferIndex,i=e.end._index,a=e.end._bufferIndex,o;if(r===i)o=[t[r].slice(n,a)];else{if(o=t.slice(r,i),n>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(n):o.shift()}a>0&&o.push(t[i].slice(0,a))}return o}function v8(t,e){let r=-1,n=[],i;for(;++r<t.length;){let a=t[r],o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
|
|
3512
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function E1(t,e,r,n){let i=n.schema,a=i.space==="svg"?!1:n.settings.omitOptionalTags,o=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(t.tagName.toLowerCase()),s=[],l;i.space==="html"&&t.tagName==="svg"&&(n.schema=wf);let c=XZ(n,t.properties),u=n.all(i.space==="html"&&t.tagName==="template"?t.content:t);return n.schema=i,u&&(o=!1),(c||!a||!x1(t,e,r))&&(s.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||n.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Od(t,e,r))&&s.push("</"+t.tagName+">"),s.join("")}function XZ(t,e){let r=[],n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let a=YZ(t,i,e[i]);a&&r.push(a)}}for(;++n<r.length;){let a=t.settings.tightAttributes?r[n].charAt(r[n].length-1):void 0;n!==r.length-1&&a!=='"'&&a!=="'"&&(r[n]+=" ")}return r.join("")}function YZ(t,e,r){let n=ox(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,a=t.settings.allowDangerousCharacters?0:1,o=t.quote,s;if(n.overloadedBoolean&&(r===n.attribute||r==="")?r=!0:(n.boolean||n.overloadedBoolean&&typeof r!="string")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";let l=ea(n.attribute,Object.assign({},t.settings.characterReferences,{subset:Tf.name[i][a]}));return r===!0||(r=Array.isArray(r)?(n.commaSeparated?_1:VO)(r,{padLeft:!t.settings.tightCommaSeparatedLists}):String(r),t.settings.collapseEmptyAttributes&&!r)?l:(t.settings.preferUnquoted&&(s=ea(r,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Tf.unquoted[i][a]}))),s!==r&&(t.settings.quoteSmart&&lx(r,o)>lx(r,t.alternative)&&(o=t.alternative),s=o+ea(r,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?Tf.single:Tf.double)[i][a],attribute:!0}))+o),l+(s&&"="+s))}var QZ=["<","&"];function Cf(t,e,r,n){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?t.value:ea(t.value,Object.assign({},n.settings.characterReferences,{subset:QZ}))}function T1(t,e,r,n){return n.settings.allowDangerousHtml?t.value:Cf(t,e,r,n)}function C1(t,e,r,n){return n.all(t)}var I1=l1("type",{invalid:eK,unknown:tK,handlers:{comment:b1,doctype:v1,element:E1,raw:T1,root:C1,text:Cf}});function eK(t){throw new Error("Expected node, not `"+t+"`")}function tK(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var rK={},nK={},iK=[];function dx(t,e){let r=e||rK,n=r.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:aK,all:oK,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||t1,characterReferences:r.characterReferences||nK,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?wf:o1,quote:n,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function aK(t,e,r){return I1(t,e,r,this)}function oK(t){let e=[],r=t&&t.children||iK,n=-1;for(;++n<r.length;)e[n]=this.one(r[n],n,t);return e.join("")}function If(t){let e=this,r={...e.data("settings"),...t};e.compiler=n;function n(i){return dx(i,r)}}var sK={};function px(t,e){let r=e||sK,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return P1(t,n,i)}function P1(t,e,r){if(lK(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return A1(t.children,e,r)}return Array.isArray(t)?A1(t,e,r):""}function A1(t,e,r){let n=[],i=-1;for(;++i<t.length;)n[i]=P1(t[i],e,r);return n.join("")}function lK(t){return!!(t&&typeof t=="object")}var R1=document.createElement("i");function Ll(t){let e="&"+t+";";R1.innerHTML=e;let r=R1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wr(t,e,r,n){let i=t.length,a=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);a<n.length;)o=n.slice(a,a+1e4),o.unshift(e,0),t.splice(...o),a+=1e4,e+=1e4}function Or(t,e){return t.length>0?(wr(t,t.length,0,e),t):e}var N1={}.hasOwnProperty;function O1(t){let e={},r=-1;for(;++r<t.length;)cK(e,t[r]);return e}function cK(t,e){let r;for(r in e){let i=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),a=e[r],o;if(a)for(o in a){N1.call(i,o)||(i[o]=[]);let s=a[o];uK(i[o],Array.isArray(s)?s:s?[s]:[])}}}function uK(t,e){let r=-1,n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wr(t,0,0,n)}function Af(t,e){let r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var sn=Fa(/[A-Za-z]/),Kt=Fa(/[\dA-Za-z]/),D1=Fa(/[#-'*+\--9=?A-Z^-~]/);function Dd(t){return t!==null&&(t<32||t===127)}var Md=Fa(/\d/),M1=Fa(/[\dA-Fa-f]/),$1=Fa(/[!-/:-@[-`{-~]/);function X(t){return t!==null&&t<-2}function $t(t){return t!==null&&(t<0||t===32)}function be(t){return t===-2||t===-1||t===32}var L1=Fa(/\p{P}|\p{S}/u),z1=Fa(/\s/);function Fa(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function An(t){let e=[],r=-1,n=0,i=0;for(;++r<t.length;){let a=t.charCodeAt(r),o="";if(a===37&&Kt(t.charCodeAt(r+1))&&Kt(t.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=t.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function ve(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return be(l)?(t.enter(r),s(l)):e(l)}function s(l){return be(l)&&a++<i?(t.consume(l),s):(t.exit(r),e(l))}}var F1={tokenize:dK};function dK(t){let e=t.attempt(this.parser.constructs.contentInitial,n,i),r;return e;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ve(t,e,"linePrefix")}function i(s){return t.enter("paragraph"),a(s)}function a(s){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(s)}function o(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return X(s)?(t.consume(s),t.exit("chunkText"),a):(t.consume(s),o)}}var j1={tokenize:pK},B1={tokenize:mK};function pK(t){let e=this,r=[],n=0,i,a,o;return s;function s(v){if(n<r.length){let I=r[n];return e.containerState=I[1],t.attempt(I[0].continuation,l,c)(v)}return c(v)}function l(v){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&x();let I=e.events.length,T=I,C;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){C=e.events[T][1].end;break}g(n);let M=I;for(;M<e.events.length;)e.events[M][1].end=Object.assign({},C),M++;return wr(e.events,T+1,0,e.events.slice(I)),e.events.length=M,c(v)}return s(v)}function c(v){if(n===r.length){if(!i)return m(v);if(i.currentConstruct&&i.currentConstruct.concrete)return h(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(B1,u,d)(v)}function u(v){return i&&x(),g(n),m(v)}function d(v){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,h(v)}function m(v){return e.containerState={},t.attempt(B1,p,h)(v)}function p(v){return n++,r.push([e.currentConstruct,e.containerState]),m(v)}function h(v){if(v===null){i&&x(),g(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(v)}function f(v){if(v===null){y(t.exit("chunkFlow"),!0),g(0),t.consume(v);return}return X(v)?(t.consume(v),y(t.exit("chunkFlow")),n=0,e.interrupt=void 0,s):(t.consume(v),f)}function y(v,I){let T=e.sliceStream(v);if(I&&T.push(null),v.previous=a,a&&(a.next=v),a=v,i.defineSkip(v.start),i.write(T),e.parser.lazy[v.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;let M=e.events.length,W=M,$,B;for(;W--;)if(e.events[W][0]==="exit"&&e.events[W][1].type==="chunkFlow"){if($){B=e.events[W][1].end;break}$=!0}for(g(n),C=M;C<e.events.length;)e.events[C][1].end=Object.assign({},B),C++;wr(e.events,W+1,0,e.events.slice(M)),e.events.length=C}}function g(v){let I=r.length;for(;I-- >v;){let T=r[I];e.containerState=T[1],T[0].exit.call(e,t)}r.length=v}function x(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function mK(t,e,r){return ve(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function mx(t){if(t===null||$t(t)||z1(t))return 1;if(L1(t))return 2}function zl(t,e,r){let n=[],i=-1;for(;++i<t.length;){let a=t[i].resolveAll;a&&!n.includes(a)&&(e=a(e,r),n.push(a))}return e}var $d={name:"attention",tokenize:fK,resolveAll:hK};function hK(t,e){let r=-1,n,i,a,o,s,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[n][1].end),m=Object.assign({},t[r][1].start);U1(d,-l),U1(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[n][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[r][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},t[n][1].end=Object.assign({},o.start),t[r][1].start=Object.assign({},s.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Or(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Or(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",a,e]]),c=Or(c,zl(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Or(c,[["exit",a,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Or(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,wr(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function fK(t,e){let r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=mx(n),a;return o;function o(l){return a=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===a)return t.consume(l),s;let c=t.exit("attentionSequence"),u=mx(l),d=!u||u===2&&i||r.includes(l),m=!i||i===2&&u||r.includes(n);return c._open=!!(a===42?d:d&&(i||!m)),c._close=!!(a===42?m:m&&(u||!d)),e(l)}}function U1(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var hx={name:"autolink",tokenize:gK};function gK(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(p){return sn(p)?(t.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Kt(p)?(n=1,s(p)):c(p)}function s(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||Kt(p))&&n++<32?(t.consume(p),s):(n=0,c(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Dd(p)?r(p):(t.consume(p),l)}function c(p){return p===64?(t.consume(p),u):D1(p)?(t.consume(p),c):r(p)}function u(p){return Kt(p)?d(p):r(p)}function d(p){return p===46?(t.consume(p),n=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):m(p)}function m(p){if((p===45||Kt(p))&&n++<63){let h=p===45?m:d;return t.consume(p),h}return r(p)}}var Ba={tokenize:yK,partial:!0};function yK(t,e,r){return n;function n(a){return be(a)?ve(t,i,"linePrefix")(a):i(a)}function i(a){return a===null||X(a)?e(a):r(a)}}var Pf={name:"blockQuote",tokenize:bK,continuation:{tokenize:vK},exit:_K};function bK(t,e,r){let n=this;return i;function i(o){if(o===62){let s=n.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),a}return r(o)}function a(o){return be(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function vK(t,e,r){let n=this;return i;function i(o){return be(o)?ve(t,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return t.attempt(Pf,e,r)(o)}}function _K(t){t.exit("blockQuote")}var Rf={name:"characterEscape",tokenize:SK};function SK(t,e,r){return n;function n(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),i}function i(a){return $1(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(a)}}var Nf={name:"characterReference",tokenize:wK};function wK(t,e,r){let n=this,i=0,a,o;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),a=31,o=Kt,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,o=M1,u):(t.enter("characterReferenceValue"),a=7,o=Md,u(d))}function u(d){if(d===59&&i){let m=t.exit("characterReferenceValue");return o===Kt&&!Ll(n.sliceSerialize(m))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<a?(t.consume(d),u):r(d)}}var G1={tokenize:xK,partial:!0},Of={name:"codeFenced",tokenize:kK,concrete:!0};function kK(t,e,r){let n=this,i={tokenize:T,partial:!0},a=0,o=0,s;return l;function l(C){return c(C)}function c(C){let M=n.events[n.events.length-1];return a=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,s=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,t.consume(C),u):o<3?r(C):(t.exit("codeFencedFenceSequence"),be(C)?ve(t,d,"whitespace")(C):d(C))}function d(C){return C===null||X(C)?(t.exit("codeFencedFence"),n.interrupt?e(C):t.check(G1,f,I)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(C)):be(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ve(t,p,"whitespace")(C)):C===96&&C===s?r(C):(t.consume(C),m)}function p(C){return C===null||X(C)?d(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(C))}function h(C){return C===null||X(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(C)):C===96&&C===s?r(C):(t.consume(C),h)}function f(C){return t.attempt(i,I,y)(C)}function y(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),g}function g(C){return a>0&&be(C)?ve(t,x,"linePrefix",a+1)(C):x(C)}function x(C){return C===null||X(C)?t.check(G1,f,I)(C):(t.enter("codeFlowValue"),v(C))}function v(C){return C===null||X(C)?(t.exit("codeFlowValue"),x(C)):(t.consume(C),v)}function I(C){return t.exit("codeFenced"),e(C)}function T(C,M,W){let $=0;return B;function B(ae){return C.enter("lineEnding"),C.consume(ae),C.exit("lineEnding"),Y}function Y(ae){return C.enter("codeFencedFence"),be(ae)?ve(C,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ae):H(ae)}function H(ae){return ae===s?(C.enter("codeFencedFenceSequence"),j(ae)):W(ae)}function j(ae){return ae===s?($++,C.consume(ae),j):$>=o?(C.exit("codeFencedFenceSequence"),be(ae)?ve(C,Z,"whitespace")(ae):Z(ae)):W(ae)}function Z(ae){return ae===null||X(ae)?(C.exit("codeFencedFence"),M(ae)):W(ae)}}}function xK(t,e,r){let n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}var Ld={name:"codeIndented",tokenize:TK},EK={tokenize:CK,partial:!0};function TK(t,e,r){let n=this;return i;function i(c){return t.enter("codeIndented"),ve(t,a,"linePrefix",5)(c)}function a(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):X(c)?t.attempt(EK,o,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||X(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function CK(t,e,r){let n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):ve(t,a,"linePrefix",5)(o)}function a(o){let s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):X(o)?i(o):r(o)}}var fx={name:"codeText",tokenize:PK,resolve:IK,previous:AK};function IK(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function AK(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PK(t,e,r){let n=this,i=0,a,o;return s;function s(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),i++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?r(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(o=t.enter("codeTextSequence"),a=0,d(m)):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||X(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),u)}function d(m){return m===96?(t.consume(m),a++,d):a===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var Df=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){let i=r||0;this.setCursor(Math.trunc(e));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&zd(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),zd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);zd(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);zd(this.left,r.reverse())}}};function zd(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Mf(t){let e={},r=-1,n,i,a,o,s,l,c,u=new Df(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,RK(u,r)),r=e[r],c=!0);else if(n[1]._container){for(a=r,i=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);i&&(n[1].end=Object.assign({},u.get(i)[1].start),s=u.slice(i,r),s.unshift(n),u.splice(i,r-i+1,s))}}return wr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function RK(t,e){let r=t.get(e)[1],n=t.get(e)[2],i=e-1,a=[],o=r._tokenizer||n.parser[r.contentType](r.start),s=o.events,l=[],c={},u,d,m=-1,p=r,h=0,f=0,y=[f];for(;p;){for(;t.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=n.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){let g=s.slice(y[m],y[m+1]),x=a.pop();l.push([x,x+g.length-1]),t.splice(x,2,g)}for(l.reverse(),m=-1;++m<l.length;)c[h+l[m][0]]=h+l[m][1],h+=l[m][1]-l[m][0]-1;return c}var gx={tokenize:DK,resolve:OK},NK={tokenize:MK,partial:!0};function OK(t){return Mf(t),t}function DK(t,e){let r;return n;function n(s){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?a(s):X(s)?t.check(NK,o,a)(s):(t.consume(s),i)}function a(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function o(s){return t.consume(s),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function MK(t,e,r){let n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),ve(t,a,"linePrefix")}function a(o){if(o===null||X(o))return r(o);let s=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function $f(t,e,r,n,i,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(g){return g===60?(t.enter(n),t.enter(i),t.enter(a),t.consume(g),t.exit(a),m):g===null||g===32||g===41||Dd(g)?r(g):(t.enter(n),t.enter(o),t.enter(s),t.enter("chunkString",{contentType:"string"}),f(g))}function m(g){return g===62?(t.enter(a),t.consume(g),t.exit(a),t.exit(i),t.exit(n),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(s),m(g)):g===null||g===60||X(g)?r(g):(t.consume(g),g===92?h:p)}function h(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function f(g){return!u&&(g===null||g===41||$t(g))?(t.exit("chunkString"),t.exit(s),t.exit(o),t.exit(n),e(g)):u<c&&g===40?(t.consume(g),u++,f):g===41?(t.consume(g),u--,f):g===null||g===32||g===40||Dd(g)?r(g):(t.consume(g),g===92?y:f)}function y(g){return g===40||g===41||g===92?(t.consume(g),f):f(g)}}function Lf(t,e,r,n,i,a){let o=this,s=0,l;return c;function c(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(a),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):X(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||X(p)||s++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!be(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(t.consume(p),s++,d):d(p)}}function zf(t,e,r,n,i,a){let o;return s;function s(m){return m===34||m===39||m===40?(t.enter(n),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):r(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(n),e):(t.enter(a),c(m))}function c(m){return m===o?(t.exit(a),l(o)):m===null?r(m):X(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),ve(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||X(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(t.consume(m),u):u(m)}}function Go(t,e){let r;return n;function n(i){return X(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):be(i)?ve(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}var yx={name:"definition",tokenize:LK},$K={tokenize:zK,partial:!0};function LK(t,e,r){let n=this,i;return a;function a(p){return t.enter("definition"),o(p)}function o(p){return Lf.call(n,t,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return $t(p)?Go(t,c)(p):c(p)}function c(p){return $f(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt($K,d,d)(p)}function d(p){return be(p)?ve(t,m,"whitespace")(p):m(p)}function m(p){return p===null||X(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function zK(t,e,r){return n;function n(s){return $t(s)?Go(t,i)(s):r(s)}function i(s){return zf(t,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return be(s)?ve(t,o,"whitespace")(s):o(s)}function o(s){return s===null||X(s)?e(s):r(s)}}var bx={name:"hardBreakEscape",tokenize:FK};function FK(t,e,r){return n;function n(a){return t.enter("hardBreakEscape"),t.consume(a),i}function i(a){return X(a)?(t.exit("hardBreakEscape"),e(a)):r(a)}}var vx={name:"headingAtx",tokenize:jK,resolve:BK};function BK(t,e){let r=t.length-2,n=3,i,a;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},a={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},wr(t,n,r-n+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),t}function jK(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),a(u)}function a(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||$t(u)?(t.exit("atxHeadingSequence"),s(u)):r(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(t.exit("atxHeading"),e(u)):be(u)?ve(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||$t(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var V1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_x=["pre","script","style","textarea"];var Sx={name:"htmlFlow",tokenize:HK,resolveTo:VK,concrete:!0},UK={tokenize:WK,partial:!0},GK={tokenize:qK,partial:!0};function VK(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function HK(t,e,r){let n=this,i,a,o,s,l;return c;function c(k){return u(k)}function u(k){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(k),d}function d(k){return k===33?(t.consume(k),m):k===47?(t.consume(k),a=!0,f):k===63?(t.consume(k),i=3,n.interrupt?e:S):sn(k)?(t.consume(k),o=String.fromCharCode(k),y):r(k)}function m(k){return k===45?(t.consume(k),i=2,p):k===91?(t.consume(k),i=5,s=0,h):sn(k)?(t.consume(k),i=4,n.interrupt?e:S):r(k)}function p(k){return k===45?(t.consume(k),n.interrupt?e:S):r(k)}function h(k){let Lt="CDATA[";return k===Lt.charCodeAt(s++)?(t.consume(k),s===Lt.length?n.interrupt?e:H:h):r(k)}function f(k){return sn(k)?(t.consume(k),o=String.fromCharCode(k),y):r(k)}function y(k){if(k===null||k===47||k===62||$t(k)){let Lt=k===47,zt=o.toLowerCase();return!Lt&&!a&&_x.includes(zt)?(i=1,n.interrupt?e(k):H(k)):V1.includes(o.toLowerCase())?(i=6,Lt?(t.consume(k),g):n.interrupt?e(k):H(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):a?x(k):v(k))}return k===45||Kt(k)?(t.consume(k),o+=String.fromCharCode(k),y):r(k)}function g(k){return k===62?(t.consume(k),n.interrupt?e:H):r(k)}function x(k){return be(k)?(t.consume(k),x):B(k)}function v(k){return k===47?(t.consume(k),B):k===58||k===95||sn(k)?(t.consume(k),I):be(k)?(t.consume(k),v):B(k)}function I(k){return k===45||k===46||k===58||k===95||Kt(k)?(t.consume(k),I):T(k)}function T(k){return k===61?(t.consume(k),C):be(k)?(t.consume(k),T):v(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(t.consume(k),l=k,M):be(k)?(t.consume(k),C):W(k)}function M(k){return k===l?(t.consume(k),l=null,$):k===null||X(k)?r(k):(t.consume(k),M)}function W(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||$t(k)?T(k):(t.consume(k),W)}function $(k){return k===47||k===62||be(k)?v(k):r(k)}function B(k){return k===62?(t.consume(k),Y):r(k)}function Y(k){return k===null||X(k)?H(k):be(k)?(t.consume(k),Y):r(k)}function H(k){return k===45&&i===2?(t.consume(k),$e):k===60&&i===1?(t.consume(k),Xe):k===62&&i===4?(t.consume(k),xr):k===63&&i===3?(t.consume(k),S):k===93&&i===5?(t.consume(k),kt):X(k)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(UK,Pn,j)(k)):k===null||X(k)?(t.exit("htmlFlowData"),j(k)):(t.consume(k),H)}function j(k){return t.check(GK,Z,Pn)(k)}function Z(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),ae}function ae(k){return k===null||X(k)?j(k):(t.enter("htmlFlowData"),H(k))}function $e(k){return k===45?(t.consume(k),S):H(k)}function Xe(k){return k===47?(t.consume(k),o="",At):H(k)}function At(k){if(k===62){let Lt=o.toLowerCase();return _x.includes(Lt)?(t.consume(k),xr):H(k)}return sn(k)&&o.length<8?(t.consume(k),o+=String.fromCharCode(k),At):H(k)}function kt(k){return k===93?(t.consume(k),S):H(k)}function S(k){return k===62?(t.consume(k),xr):k===45&&i===2?(t.consume(k),S):H(k)}function xr(k){return k===null||X(k)?(t.exit("htmlFlowData"),Pn(k)):(t.consume(k),xr)}function Pn(k){return t.exit("htmlFlow"),e(k)}}function qK(t,e,r){let n=this;return i;function i(o){return X(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a):r(o)}function a(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function WK(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ba,e,r)}}var wx={name:"htmlText",tokenize:ZK};function ZK(t,e,r){let n=this,i,a,o;return s;function s(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),T):S===63?(t.consume(S),v):sn(S)?(t.consume(S),W):r(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),a=0,h):sn(S)?(t.consume(S),x):r(S)}function u(S){return S===45?(t.consume(S),p):r(S)}function d(S){return S===null?r(S):S===45?(t.consume(S),m):X(S)?(o=d,Xe(S)):(t.consume(S),d)}function m(S){return S===45?(t.consume(S),p):d(S)}function p(S){return S===62?$e(S):S===45?m(S):d(S)}function h(S){let xr="CDATA[";return S===xr.charCodeAt(a++)?(t.consume(S),a===xr.length?f:h):r(S)}function f(S){return S===null?r(S):S===93?(t.consume(S),y):X(S)?(o=f,Xe(S)):(t.consume(S),f)}function y(S){return S===93?(t.consume(S),g):f(S)}function g(S){return S===62?$e(S):S===93?(t.consume(S),g):f(S)}function x(S){return S===null||S===62?$e(S):X(S)?(o=x,Xe(S)):(t.consume(S),x)}function v(S){return S===null?r(S):S===63?(t.consume(S),I):X(S)?(o=v,Xe(S)):(t.consume(S),v)}function I(S){return S===62?$e(S):v(S)}function T(S){return sn(S)?(t.consume(S),C):r(S)}function C(S){return S===45||Kt(S)?(t.consume(S),C):M(S)}function M(S){return X(S)?(o=M,Xe(S)):be(S)?(t.consume(S),M):$e(S)}function W(S){return S===45||Kt(S)?(t.consume(S),W):S===47||S===62||$t(S)?$(S):r(S)}function $(S){return S===47?(t.consume(S),$e):S===58||S===95||sn(S)?(t.consume(S),B):X(S)?(o=$,Xe(S)):be(S)?(t.consume(S),$):$e(S)}function B(S){return S===45||S===46||S===58||S===95||Kt(S)?(t.consume(S),B):Y(S)}function Y(S){return S===61?(t.consume(S),H):X(S)?(o=Y,Xe(S)):be(S)?(t.consume(S),Y):$(S)}function H(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),i=S,j):X(S)?(o=H,Xe(S)):be(S)?(t.consume(S),H):(t.consume(S),Z)}function j(S){return S===i?(t.consume(S),i=void 0,ae):S===null?r(S):X(S)?(o=j,Xe(S)):(t.consume(S),j)}function Z(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||$t(S)?$(S):(t.consume(S),Z)}function ae(S){return S===47||S===62||$t(S)?$(S):r(S)}function $e(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):r(S)}function Xe(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),At}function At(S){return be(S)?ve(t,kt,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):kt(S)}function kt(S){return t.enter("htmlTextData"),o(S)}}var Vo={name:"labelEnd",tokenize:e8,resolveTo:QK,resolveAll:YK},KK={tokenize:t8},JK={tokenize:r8},XK={tokenize:n8};function YK(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function QK(t,e){let r=t.length,n=0,i,a,o,s;for(;r--;)if(i=t[r][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);let l={type:t[a][1].type==="labelLink"?"link":"image",start:Object.assign({},t[a][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[a][1].start),end:Object.assign({},t[o][1].end)},u={type:"labelText",start:Object.assign({},t[a+n+2][1].end),end:Object.assign({},t[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=Or(s,t.slice(a+1,a+n+3)),s=Or(s,[["enter",u,e]]),s=Or(s,zl(e.parser.constructs.insideSpan.null,t.slice(a+n+4,o-3),e)),s=Or(s,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),s=Or(s,t.slice(o+1)),s=Or(s,[["exit",l,e]]),wr(t,a,t.length,s),t}function e8(t,e,r){let n=this,i=n.events.length,a,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){a=n.events[i][1];break}return s;function s(m){return a?a._inactive?d(m):(o=n.parser.defined.includes(ta(n.sliceSerialize({start:a.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):r(m)}function l(m){return m===40?t.attempt(KK,u,o?u:d)(m):m===91?t.attempt(JK,u,o?c:d)(m):o?u(m):d(m)}function c(m){return t.attempt(XK,u,d)(m)}function u(m){return e(m)}function d(m){return a._balanced=!0,r(m)}}function t8(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return $t(d)?Go(t,a)(d):a(d)}function a(d){return d===41?u(d):$f(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return $t(d)?Go(t,l)(d):u(d)}function s(d){return r(d)}function l(d){return d===34||d===39||d===40?zf(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return $t(d)?Go(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function r8(t,e,r){let n=this;return i;function i(s){return Lf.call(n,t,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return n.parser.defined.includes(ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(s):r(s)}function o(s){return r(s)}}function n8(t,e,r){return n;function n(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),i}function i(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):r(a)}}var kx={name:"labelStartImage",tokenize:i8,resolveAll:Vo.resolveAll};function i8(t,e,r){let n=this;return i;function i(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),a}function a(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),o):r(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(s):e(s)}}var xx={name:"labelStartLink",tokenize:a8,resolveAll:Vo.resolveAll};function a8(t,e,r){let n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}var Fd={name:"lineEnding",tokenize:o8};function o8(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),ve(t,e,"linePrefix")}}var Ho={name:"thematicBreak",tokenize:s8};function s8(t,e,r){let n=0,i;return a;function a(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,s(c)}function s(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||X(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),be(c)?ve(t,s,"whitespace")(c):s(c))}}var kr={name:"list",tokenize:u8,continuation:{tokenize:d8},exit:m8},l8={tokenize:h8,partial:!0},c8={tokenize:p8,partial:!0};function u8(t,e,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(p){let h=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Md(p)){if(n.containerState.type||(n.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Ho,r,c)(p):c(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return Md(p)&&++o<10?(t.consume(p),l):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):r(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(Ba,n.interrupt?r:u,t.attempt(l8,m,d))}function u(p){return n.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return be(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):r(p)}function m(p){return n.containerState.size=a+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function d8(t,e,r){let n=this;return n.containerState._closeFlow=void 0,t.check(Ba,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ve(t,e,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!be(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(c8,e,o)(s))}function o(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ve(t,t.attempt(kr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function p8(t,e,r){let n=this;return ve(t,i,"listItemIndent",n.containerState.size+1);function i(a){let o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(a):r(a)}}function m8(t){t.exit(this.containerState.type)}function h8(t,e,r){let n=this;return ve(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=n.events[n.events.length-1];return!be(a)&&o&&o[1].type==="listItemPrefixWhitespace"?e(a):r(a)}}var Ff={name:"setextUnderline",tokenize:g8,resolveTo:f8};function f8(t,e){let r=t.length,n,i,a;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!a&&t[r][1].type==="definition"&&(a=r);let o={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",a?(t.splice(i,0,["enter",o,e]),t.splice(a+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[a][1].end)):t[n][1]=o,t.push(["exit",o,e]),t}function g8(t,e,r){let n=this,i;return a;function a(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),be(c)?ve(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var H1={tokenize:y8};function y8(t){let e=this,r=t.attempt(Ba,n,t.attempt(this.parser.constructs.flowInitial,i,ve(t,t.attempt(this.parser.constructs.flow,i,t.attempt(gx,i)),"linePrefix")));return r;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var q1={resolveAll:J1()},W1=K1("string"),Z1=K1("text");function K1(t){return{tokenize:e,resolveAll:J1(t==="text"?b8:void 0)};function e(r){let n=this,i=this.parser.constructs[t],a=r.attempt(i,o,s);return o;function o(u){return c(u)?a(u):s(u)}function s(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),a(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=i[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function J1(t){return e;function e(r,n){let i=-1,a;for(;++i<=r.length;)a===void 0?r[i]&&r[i][1].type==="data"&&(a=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==a+2&&(r[a][1].end=r[i-1][1].end,r.splice(a+2,i-a-2),i=a+2),a=void 0);return t?t(r,n):r}}function b8(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let n=t[r-1][1],i=e.sliceStream(n),a=i.length,o=-1,s=0,l;for(;a--;){let c=i[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){a++;break}}if(s){let c={type:r===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-s,offset:n.end.offset-s,_index:n.start._index+a,_bufferIndex:a?o:n.start._bufferIndex+o},end:Object.assign({},n.end)};n.end=Object.assign({},c.start),n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function X1(t,e,r){let n=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},a=[],o=[],s=[],l=!0,c={consume:I,enter:T,exit:C,attempt:$(M),check:$(W),interrupt:$(W,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:f,sliceSerialize:h,now:y,defineSkip:g,write:p},d=e.tokenize.call(u,c),m;return e.resolveAll&&a.push(e),u;function p(j){return o=Or(o,j),x(),o[o.length-1]!==null?[]:(B(e,0),u.events=zl(a,u.events,u),u.events)}function h(j,Z){return _8(f(j),Z)}function f(j){return v8(o,j)}function y(){let{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}=n;return{line:j,column:Z,offset:ae,_index:$e,_bufferIndex:Xe}}function g(j){i[j.line]=j.column,H()}function x(){let j;for(;n._index<o.length;){let Z=o[n._index];if(typeof Z=="string")for(j=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===j&&n._bufferIndex<Z.length;)v(Z.charCodeAt(n._bufferIndex));else v(Z)}}function v(j){l=void 0,m=j,d=d(j)}function I(j){X(j)?(n.line++,n.column=1,n.offset+=j===-3?2:1,H()):j!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=j,l=!0}function T(j,Z){let ae=Z||{};return ae.type=j,ae.start=y(),u.events.push(["enter",ae,u]),s.push(ae),ae}function C(j){let Z=s.pop();return Z.end=y(),u.events.push(["exit",Z,u]),Z}function M(j,Z){B(j,Z.from)}function W(j,Z){Z.restore()}function $(j,Z){return ae;function ae($e,Xe,At){let kt,S,xr,Pn;return Array.isArray($e)?Lt($e):"tokenize"in $e?Lt([$e]):k($e);function k(Pt){return _i;function _i($r){let Si=$r!==null&&Pt[$r],ra=$r!==null&&Pt.null,Zl=[...Array.isArray(Si)?Si:Si?[Si]:[],...Array.isArray(ra)?ra:ra?[ra]:[]];return Lt(Zl)($r)}}function Lt(Pt){return kt=Pt,S=0,Pt.length===0?At:zt(Pt[S])}function zt(Pt){return _i;function _i($r){return Pn=Y(),xr=Pt,Pt.partial||(u.currentConstruct=Pt),Pt.name&&u.parser.constructs.disable.null.includes(Pt.name)?Rn($r):Pt.tokenize.call(Z?Object.assign(Object.create(u),Z):u,c,Mr,Rn)($r)}}function Mr(Pt){return l=!0,j(xr,Pn),Xe}function Rn(Pt){return l=!0,Pn.restore(),++S<kt.length?zt(kt[S]):At}}}function B(j,Z){j.resolveAll&&!a.includes(j)&&a.push(j),j.resolve&&wr(u.events,Z,u.events.length-Z,j.resolve(u.events.slice(Z),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function Y(){let j=y(),Z=u.previous,ae=u.currentConstruct,$e=u.events.length,Xe=Array.from(s);return{restore:At,from:$e};function At(){n=j,u.previous=Z,u.currentConstruct=ae,u.events.length=$e,s=Xe,H()}}function H(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function v8(t,e){let r=e.start._index,n=e.start._bufferIndex,i=e.end._index,a=e.end._bufferIndex,o;if(r===i)o=[t[r].slice(n,a)];else{if(o=t.slice(r,i),n>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(n):o.shift()}a>0&&o.push(t[i].slice(0,a))}return o}function _8(t,e){let r=-1,n=[],i;for(;++r<t.length;){let a=t[r],o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
|
|
3513
3513
|
`;break}case-3:{o=`\r
|
|
3514
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,n.push(o)}return n.join("")}var fx={};Xd(fx,{attentionMarkers:()=>C8,contentInitial:()=>S8,disable:()=>I8,document:()=>_8,flow:()=>k8,flowInitial:()=>w8,insideSpan:()=>T8,string:()=>x8,text:()=>E8});var _8={42:kr,43:kr,45:kr,48:kr,49:kr,50:kr,51:kr,52:kr,53:kr,54:kr,55:kr,56:kr,57:kr,62:If},S8={91:sx},w8={[-2]:Dd,[-1]:Dd,32:Dd},k8={35:cx,42:Ho,45:[Lf,Ho],60:dx,61:Lf,95:Ho,96:Rf,126:Rf},x8={38:Pf,92:Af},E8={[-5]:$d,[-4]:$d,[-3]:$d,33:mx,38:Pf,42:Od,60:[ix,px],91:hx,92:[lx,Af],93:Vo,95:Od,96:ax},T8={null:[Od,H1]},C8={null:[42,95]},I8={null:[]};function gx(t){let r=N1([fx,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(z1),document:i(B1),flow:i(V1),string:i(q1),text:i(W1)};return n;function i(a){return o;function o(s){return J1(n,a,s)}}}function yx(t){for(;!Of(t););return t}var X1=/[\0\t\n\r]/g;function bx(){let t=1,e="",r=!0,n;return i;function i(a,o,s){let l=[],c,u,d,m,p;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,e="",r&&(a.charCodeAt(0)===65279&&d++,r=void 0);d<a.length;){if(X1.lastIndex=d,c=X1.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){e=a.slice(d);break}if(p===10&&d===m&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<m&&(l.push(a.slice(d,m)),t+=m-d),p){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=m+1}return s&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}var A8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y1(t){return t.replace(A8,P8)}function P8(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let i=r.charCodeAt(1),a=i===120||i===88;return Cf(r.slice(a?2:1),a?16:10)}return $l(r)||t}function ja(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Q1(t.position):"start"in t||"end"in t?Q1(t):"line"in t||"column"in t?vx(t):""}function vx(t){return eD(t&&t.line)+":"+eD(t&&t.column)}function Q1(t){return vx(t&&t.start)+"-"+vx(t&&t.end)}function eD(t){return t&&typeof t=="number"?t:1}var rD={}.hasOwnProperty;function _x(t,e,r){return typeof e!="string"&&(r=e,e=void 0),R8(r)(yx(gx(r).document().write(bx()(t,e,!0))))}function R8(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Kl),autolinkProtocol:M,autolinkEmail:M,atxHeading:a(cn),blockQuote:a(_i),characterEscape:M,characterReference:M,codeFenced:a($r),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a($r,o),codeText:a(Si,o),codeTextData:M,data:M,codeFlowValue:M,definition:a(ra),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Wl),hardBreakEscape:a(Vd),hardBreakTrailing:a(Vd),htmlFlow:a(Zl,o),htmlFlowData:M,htmlText:a(Zl,o),htmlTextData:M,image:a(Hd),label:o,link:a(Kl),listItem:a(na),listItemValue:m,listOrdered:a(qd,d),listUnordered:a(qd),paragraph:a(un),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(cn),strong:a(Wd),thematicBreak:a(cg)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Pt,autolinkProtocol:Rn,blockQuote:l(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:zt,characterReferenceMarkerNumeric:zt,characterReferenceValue:Mr,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:B,codeIndented:l(g),codeText:l(ae),codeTextData:B,data:B,definition:l(),definitionDestinationString:I,definitionLabelString:S,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(H),hardBreakTrailing:l(H),htmlFlow:l(j),htmlFlowData:B,htmlText:l(Z),htmlTextData:B,image:l(Xe),label:kt,labelText:At,lineEnding:Y,link:l($e),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Lt,resourceDestinationString:w,resourceTitleString:xr,resource:Pn,setextHeading:l(W),setextHeadingLineSequence:$,setextHeadingText:C,strong:l(),thematicBreak:l()}};nD(e,(t||{}).mdastExtensions||[]);let r={};return n;function n(O){let G={type:"root",children:[]},oe={stack:[G],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:r},Se=[],Je=-1;for(;++Je<O.length;)if(O[Je][1].type==="listOrdered"||O[Je][1].type==="listUnordered")if(O[Je][0]==="enter")Se.push(Je);else{let Lr=Se.pop();Je=i(O,Lr,Je)}for(Je=-1;++Je<O.length;){let Lr=e[O[Je][0]];rD.call(Lr,O[Je][1].type)&&Lr[O[Je][1].type].call(Object.assign({sliceSerialize:O[Je][2].sliceSerialize},oe),O[Je][1])}if(oe.tokenStack.length>0){let Lr=oe.tokenStack[oe.tokenStack.length-1];(Lr[1]||tD).call(oe,void 0,Lr[0])}for(G.position={start:Ua(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Ua(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<e.transforms.length;)G=e.transforms[Je](G)||G;return G}function i(O,G,oe){let Se=G-1,Je=-1,Lr=!1,Kr,dn,Ga,Va;for(;++Se<=oe;){let cr=O[Se];switch(cr[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{cr[0]==="enter"?Je++:Je--,Va=void 0;break}case"lineEndingBlank":{cr[0]==="enter"&&(Kr&&!Va&&!Je&&!Ga&&(Ga=Se),Va=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Va=void 0}if(!Je&&cr[0]==="enter"&&cr[1].type==="listItemPrefix"||Je===-1&&cr[0]==="exit"&&(cr[1].type==="listUnordered"||cr[1].type==="listOrdered")){if(Kr){let Xt=Se;for(dn=void 0;Xt--;){let Nn=O[Xt];if(Nn[1].type==="lineEnding"||Nn[1].type==="lineEndingBlank"){if(Nn[0]==="exit")continue;dn&&(O[dn][1].type="lineEndingBlank",Lr=!0),Nn[1].type="lineEnding",dn=Xt}else if(!(Nn[1].type==="linePrefix"||Nn[1].type==="blockQuotePrefix"||Nn[1].type==="blockQuotePrefixWhitespace"||Nn[1].type==="blockQuoteMarker"||Nn[1].type==="listItemIndent"))break}Ga&&(!dn||Ga<dn)&&(Kr._spread=!0),Kr.end=Object.assign({},dn?O[dn][1].start:cr[1].end),O.splice(dn||Se,0,["exit",Kr,cr[2]]),Se++,oe++}if(cr[1].type==="listItemPrefix"){let Xt={type:"listItem",_spread:!1,start:Object.assign({},cr[1].start),end:void 0};Kr=Xt,O.splice(Se,0,["enter",Xt,cr[2]]),Se++,oe++,Ga=void 0,Va=!0}}}return O[G][1]._spread=Lr,oe}function a(O,G){return oe;function oe(Se){s.call(this,O(Se),Se),G&&G.call(this,Se)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(O,G,oe){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([G,oe]),O.position={start:Ua(G.start),end:void 0}}function l(O){return G;function G(oe){O&&O.call(this,oe),c.call(this,oe)}}function c(O,G){let oe=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==O.type&&(G?G.call(this,O,Se[0]):(Se[1]||tD).call(this,O,Se[0]));else throw new Error("Cannot close `"+O.type+"` ("+ja({start:O.start,end:O.end})+"): it\u2019s not open");oe.position.end=Ua(O.end)}function u(){return rx(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(O){if(this.data.expectingFirstListItemValue){let G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),G=this.stack[this.stack.length-1];G.lang=O}function h(){let O=this.resume(),G=this.stack[this.stack.length-1];G.meta=O}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/(\r?\n|\r)$/g,"")}function S(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase()}function v(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function I(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function T(O){let G=this.stack[this.stack.length-1];if(!G.depth){let oe=this.sliceSerialize(O).length;G.depth=oe}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function $(O){let G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function M(O){let oe=this.stack[this.stack.length-1].children,Se=oe[oe.length-1];(!Se||Se.type!=="text")&&(Se=lg(),Se.position={start:Ua(O.start),end:void 0},oe.push(Se)),this.stack.push(Se)}function B(O){let G=this.stack.pop();G.value+=this.sliceSerialize(O),G.position.end=Ua(O.end)}function Y(O){let G=this.stack[this.stack.length-1];if(this.data.atHardBreak){let oe=G.children[G.children.length-1];oe.position.end=Ua(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(G.type)&&(M.call(this,O),B.call(this,O))}function H(){this.data.atHardBreak=!0}function j(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function Z(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function ae(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function $e(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function Xe(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function At(O){let G=this.sliceSerialize(O),oe=this.stack[this.stack.length-2];oe.label=Y1(G),oe.identifier=ta(G).toLowerCase()}function kt(){let O=this.stack[this.stack.length-1],G=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){let Se=O.children;oe.children=Se}else oe.alt=G}function w(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function xr(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function Pn(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function Lt(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function zt(O){this.data.characterReferenceType=O.type}function Mr(O){let G=this.sliceSerialize(O),oe=this.data.characterReferenceType,Se;oe?(Se=Cf(G,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=$l(G);let Je=this.stack.pop();Je.value+=Se,Je.position.end=Ua(O.end)}function Rn(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(O)}function Pt(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(O)}function _i(){return{type:"blockquote",children:[]}}function $r(){return{type:"code",lang:null,meta:null,value:""}}function Si(){return{type:"inlineCode",value:""}}function ra(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Wl(){return{type:"emphasis",children:[]}}function cn(){return{type:"heading",depth:0,children:[]}}function Vd(){return{type:"break"}}function Zl(){return{type:"html",value:""}}function Hd(){return{type:"image",title:null,url:"",alt:null}}function Kl(){return{type:"link",title:null,url:"",children:[]}}function qd(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function na(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function un(){return{type:"paragraph",children:[]}}function Wd(){return{type:"strong",children:[]}}function lg(){return{type:"text",value:""}}function cg(){return{type:"thematicBreak"}}}function Ua(t){return{line:t.line,column:t.column,offset:t.offset}}function nD(t,e){let r=-1;for(;++r<e.length;){let n=e[r];Array.isArray(n)?nD(t,n):N8(t,n)}}function N8(t,e){let r;for(r in e)if(rD.call(e,r))switch(r){case"canContainEols":{let n=e[r];n&&t[r].push(...n);break}case"transforms":{let n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{let n=e[r];n&&Object.assign(t[r],n);break}}}function tD(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ja({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is still open")}function zf(t){let e=this;e.parser=r;function r(n){return _x(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function iD(t,e){let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function aD(t,e){let r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
3515
|
-
`}]}function
|
|
3516
|
-
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function
|
|
3514
|
+
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,n.push(o)}return n.join("")}var Ex={};rc(Ex,{attentionMarkers:()=>I8,contentInitial:()=>w8,disable:()=>A8,document:()=>S8,flow:()=>x8,flowInitial:()=>k8,insideSpan:()=>C8,string:()=>E8,text:()=>T8});var S8={42:kr,43:kr,45:kr,48:kr,49:kr,50:kr,51:kr,52:kr,53:kr,54:kr,55:kr,56:kr,57:kr,62:Pf},w8={91:yx},k8={[-2]:Ld,[-1]:Ld,32:Ld},x8={35:vx,42:Ho,45:[Ff,Ho],60:Sx,61:Ff,95:Ho,96:Of,126:Of},E8={38:Nf,92:Rf},T8={[-5]:Fd,[-4]:Fd,[-3]:Fd,33:kx,38:Nf,42:$d,60:[hx,wx],91:xx,92:[bx,Rf],93:Vo,95:$d,96:fx},C8={null:[$d,q1]},I8={null:[42,95]},A8={null:[]};function Tx(t){let r=O1([Ex,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(F1),document:i(j1),flow:i(H1),string:i(W1),text:i(Z1)};return n;function i(a){return o;function o(s){return X1(n,a,s)}}}function Cx(t){for(;!Mf(t););return t}var Y1=/[\0\t\n\r]/g;function Ix(){let t=1,e="",r=!0,n;return i;function i(a,o,s){let l=[],c,u,d,m,p;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,e="",r&&(a.charCodeAt(0)===65279&&d++,r=void 0);d<a.length;){if(Y1.lastIndex=d,c=Y1.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){e=a.slice(d);break}if(p===10&&d===m&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<m&&(l.push(a.slice(d,m)),t+=m-d),p){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=m+1}return s&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}var P8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Q1(t){return t.replace(P8,R8)}function R8(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let i=r.charCodeAt(1),a=i===120||i===88;return Af(r.slice(a?2:1),a?16:10)}return Ll(r)||t}function ja(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?eD(t.position):"start"in t||"end"in t?eD(t):"line"in t||"column"in t?Ax(t):""}function Ax(t){return tD(t&&t.line)+":"+tD(t&&t.column)}function eD(t){return Ax(t&&t.start)+"-"+Ax(t&&t.end)}function tD(t){return t&&typeof t=="number"?t:1}var nD={}.hasOwnProperty;function Px(t,e,r){return typeof e!="string"&&(r=e,e=void 0),N8(r)(Cx(Tx(r).document().write(Ix()(t,e,!0))))}function N8(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Jl),autolinkProtocol:$,autolinkEmail:$,atxHeading:a(cn),blockQuote:a(_i),characterEscape:$,characterReference:$,codeFenced:a($r),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a($r,o),codeText:a(Si,o),codeTextData:$,data:$,codeFlowValue:$,definition:a(ra),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Zl),hardBreakEscape:a(Wd),hardBreakTrailing:a(Wd),htmlFlow:a(Kl,o),htmlFlowData:$,htmlText:a(Kl,o),htmlTextData:$,image:a(Zd),label:o,link:a(Jl),listItem:a(na),listItemValue:m,listOrdered:a(Kd,d),listUnordered:a(Kd),paragraph:a(un),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(cn),strong:a(Jd),thematicBreak:a(dg)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Pt,autolinkProtocol:Rn,blockQuote:l(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:zt,characterReferenceMarkerNumeric:zt,characterReferenceValue:Mr,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:B,codeIndented:l(g),codeText:l(ae),codeTextData:B,data:B,definition:l(),definitionDestinationString:I,definitionLabelString:x,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(H),hardBreakTrailing:l(H),htmlFlow:l(j),htmlFlowData:B,htmlText:l(Z),htmlTextData:B,image:l(Xe),label:kt,labelText:At,lineEnding:Y,link:l($e),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Lt,resourceDestinationString:S,resourceTitleString:xr,resource:Pn,setextHeading:l(W),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};iD(e,(t||{}).mdastExtensions||[]);let r={};return n;function n(O){let G={type:"root",children:[]},oe={stack:[G],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:r},Se=[],Je=-1;for(;++Je<O.length;)if(O[Je][1].type==="listOrdered"||O[Je][1].type==="listUnordered")if(O[Je][0]==="enter")Se.push(Je);else{let Lr=Se.pop();Je=i(O,Lr,Je)}for(Je=-1;++Je<O.length;){let Lr=e[O[Je][0]];nD.call(Lr,O[Je][1].type)&&Lr[O[Je][1].type].call(Object.assign({sliceSerialize:O[Je][2].sliceSerialize},oe),O[Je][1])}if(oe.tokenStack.length>0){let Lr=oe.tokenStack[oe.tokenStack.length-1];(Lr[1]||rD).call(oe,void 0,Lr[0])}for(G.position={start:Ua(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Ua(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<e.transforms.length;)G=e.transforms[Je](G)||G;return G}function i(O,G,oe){let Se=G-1,Je=-1,Lr=!1,Kr,dn,Ga,Va;for(;++Se<=oe;){let ur=O[Se];switch(ur[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ur[0]==="enter"?Je++:Je--,Va=void 0;break}case"lineEndingBlank":{ur[0]==="enter"&&(Kr&&!Va&&!Je&&!Ga&&(Ga=Se),Va=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Va=void 0}if(!Je&&ur[0]==="enter"&&ur[1].type==="listItemPrefix"||Je===-1&&ur[0]==="exit"&&(ur[1].type==="listUnordered"||ur[1].type==="listOrdered")){if(Kr){let Xt=Se;for(dn=void 0;Xt--;){let Nn=O[Xt];if(Nn[1].type==="lineEnding"||Nn[1].type==="lineEndingBlank"){if(Nn[0]==="exit")continue;dn&&(O[dn][1].type="lineEndingBlank",Lr=!0),Nn[1].type="lineEnding",dn=Xt}else if(!(Nn[1].type==="linePrefix"||Nn[1].type==="blockQuotePrefix"||Nn[1].type==="blockQuotePrefixWhitespace"||Nn[1].type==="blockQuoteMarker"||Nn[1].type==="listItemIndent"))break}Ga&&(!dn||Ga<dn)&&(Kr._spread=!0),Kr.end=Object.assign({},dn?O[dn][1].start:ur[1].end),O.splice(dn||Se,0,["exit",Kr,ur[2]]),Se++,oe++}if(ur[1].type==="listItemPrefix"){let Xt={type:"listItem",_spread:!1,start:Object.assign({},ur[1].start),end:void 0};Kr=Xt,O.splice(Se,0,["enter",Xt,ur[2]]),Se++,oe++,Ga=void 0,Va=!0}}}return O[G][1]._spread=Lr,oe}function a(O,G){return oe;function oe(Se){s.call(this,O(Se),Se),G&&G.call(this,Se)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(O,G,oe){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([G,oe]),O.position={start:Ua(G.start),end:void 0}}function l(O){return G;function G(oe){O&&O.call(this,oe),c.call(this,oe)}}function c(O,G){let oe=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==O.type&&(G?G.call(this,O,Se[0]):(Se[1]||rD).call(this,O,Se[0]));else throw new Error("Cannot close `"+O.type+"` ("+ja({start:O.start,end:O.end})+"): it\u2019s not open");oe.position.end=Ua(O.end)}function u(){return px(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(O){if(this.data.expectingFirstListItemValue){let G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),G=this.stack[this.stack.length-1];G.lang=O}function h(){let O=this.resume(),G=this.stack[this.stack.length-1];G.meta=O}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O.replace(/(\r?\n|\r)$/g,"")}function x(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase()}function v(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function I(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function T(O){let G=this.stack[this.stack.length-1];if(!G.depth){let oe=this.sliceSerialize(O).length;G.depth=oe}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(O){let G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function $(O){let oe=this.stack[this.stack.length-1].children,Se=oe[oe.length-1];(!Se||Se.type!=="text")&&(Se=ug(),Se.position={start:Ua(O.start),end:void 0},oe.push(Se)),this.stack.push(Se)}function B(O){let G=this.stack.pop();G.value+=this.sliceSerialize(O),G.position.end=Ua(O.end)}function Y(O){let G=this.stack[this.stack.length-1];if(this.data.atHardBreak){let oe=G.children[G.children.length-1];oe.position.end=Ua(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(G.type)&&($.call(this,O),B.call(this,O))}function H(){this.data.atHardBreak=!0}function j(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function Z(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function ae(){let O=this.resume(),G=this.stack[this.stack.length-1];G.value=O}function $e(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function Xe(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let G=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=G,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function At(O){let G=this.sliceSerialize(O),oe=this.stack[this.stack.length-2];oe.label=Q1(G),oe.identifier=ta(G).toLowerCase()}function kt(){let O=this.stack[this.stack.length-1],G=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){let Se=O.children;oe.children=Se}else oe.alt=G}function S(){let O=this.resume(),G=this.stack[this.stack.length-1];G.url=O}function xr(){let O=this.resume(),G=this.stack[this.stack.length-1];G.title=O}function Pn(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function Lt(O){let G=this.resume(),oe=this.stack[this.stack.length-1];oe.label=G,oe.identifier=ta(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function zt(O){this.data.characterReferenceType=O.type}function Mr(O){let G=this.sliceSerialize(O),oe=this.data.characterReferenceType,Se;oe?(Se=Af(G,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=Ll(G);let Je=this.stack.pop();Je.value+=Se,Je.position.end=Ua(O.end)}function Rn(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(O)}function Pt(O){B.call(this,O);let G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(O)}function _i(){return{type:"blockquote",children:[]}}function $r(){return{type:"code",lang:null,meta:null,value:""}}function Si(){return{type:"inlineCode",value:""}}function ra(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Zl(){return{type:"emphasis",children:[]}}function cn(){return{type:"heading",depth:0,children:[]}}function Wd(){return{type:"break"}}function Kl(){return{type:"html",value:""}}function Zd(){return{type:"image",title:null,url:"",alt:null}}function Jl(){return{type:"link",title:null,url:"",children:[]}}function Kd(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function na(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function un(){return{type:"paragraph",children:[]}}function Jd(){return{type:"strong",children:[]}}function ug(){return{type:"text",value:""}}function dg(){return{type:"thematicBreak"}}}function Ua(t){return{line:t.line,column:t.column,offset:t.offset}}function iD(t,e){let r=-1;for(;++r<e.length;){let n=e[r];Array.isArray(n)?iD(t,n):O8(t,n)}}function O8(t,e){let r;for(r in e)if(nD.call(e,r))switch(r){case"canContainEols":{let n=e[r];n&&t[r].push(...n);break}case"transforms":{let n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{let n=e[r];n&&Object.assign(t[r],n);break}}}function rD(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ja({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ja({start:e.start,end:e.end})+") is still open")}function Bf(t){let e=this;e.parser=r;function r(n){return Px(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function aD(t,e){let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function oD(t,e){let r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
3515
|
+
`}]}function sD(t,e){let r=e.value?e.value+`
|
|
3516
|
+
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function lD(t,e){let r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function cD(t,e){let r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function uD(t,e){let r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=An(n.toLowerCase()),a=t.footnoteOrder.indexOf(n),o,s=t.footnoteCounts.get(n);s===void 0?(s=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=a+1,s+=1,t.footnoteCounts.set(n,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function dD(t,e){let r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function pD(t,e){if(t.options.allowDangerousHtml){let r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function jf(t,e){let r=e.referenceType,n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];let i=t.all(e),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function mD(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return jf(t,e);let i={src:An(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);let a={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,a),t.applyData(e,a)}function hD(t,e){let r={src:An(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function fD(t,e){let r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function gD(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return jf(t,e);let i={href:An(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);let a={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function yD(t,e){let r={href:An(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function bD(t,e,r){let n=t.all(e),i=r?D8(r):vD(e),a={},o=[];if(typeof e.checked=="boolean"){let u=n[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let u=n[s];(i||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
3517
3517
|
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}let l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
3518
|
-
`});let c={type:"element",tagName:"li",properties:a,children:o};return t.patch(e,c),t.applyData(e,c)}function
|
|
3518
|
+
`});let c={type:"element",tagName:"li",properties:a,children:o};return t.patch(e,c),t.applyData(e,c)}function D8(t){let e=!1;if(t.type==="list"){e=t.spread||!1;let r=t.children,n=-1;for(;!e&&++n<r.length;)e=vD(r[n])}return e}function vD(t){let e=t.spread;return e??t.children.length>1}function _D(t,e){let r={},n=t.all(e),i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){let o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let a={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,a),t.applyData(e,a)}function SD(t,e){let r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function wD(t,e){let r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function kD(t,e){let r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}var Uf=xD("end"),Gf=xD("start");function xD(t){return e;function e(r){let n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Rx(t){let e=Gf(t),r=Uf(t);if(e&&r)return{start:e,end:r}}function ED(t,e){let r=t.all(e),n=r.shift(),i=[];if(n){let o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){let o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},s=Gf(e.children[1]),l=Uf(e.children[e.children.length-1]);s&&l&&(o.position={start:s,end:l}),i.push(o)}let a={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,a),t.applyData(e,a)}function TD(t,e,r){let n=r?r.children:void 0,a=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,s=o?o.length:e.children.length,l=-1,c=[];for(;++l<s;){let d=e.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let h={type:"element",tagName:a,properties:m,children:[]};d&&(h.children=t.all(d),t.patch(d,h),h=t.applyData(d,h)),c.push(h)}let u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function CD(t,e){let r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function AD(t){let e=String(t),r=/\r?\n|\r/g,n=r.exec(e),i=0,a=[];for(;n;)a.push(ID(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return a.push(ID(e.slice(i),i>0,!1)),a.join("")}function ID(t,e,r){let n=0,i=t.length;if(e){let a=t.codePointAt(n);for(;a===9||a===32;)n++,a=t.codePointAt(n)}if(r){let a=t.codePointAt(i-1);for(;a===9||a===32;)i--,a=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function PD(t,e){let r={type:"text",value:AD(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function RD(t,e){let r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}var ND={blockquote:aD,break:oD,code:sD,delete:lD,emphasis:cD,footnoteReference:uD,heading:dD,html:pD,imageReference:mD,image:hD,inlineCode:fD,linkReference:gD,link:yD,listItem:bD,list:_D,paragraph:SD,root:wD,strong:kD,table:ED,tableCell:CD,tableRow:TD,text:PD,thematicBreak:RD,toml:Vf,yaml:Vf,definition:Vf,footnoteDefinition:Vf};function Vf(){}function M8(t,e){let r=[{type:"text",value:"\u21A9"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function $8(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function OD(t){let e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||M8,n=t.options.footnoteBackLabel||$8,i=t.options.footnoteLabel||"Footnotes",a=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<t.footnoteOrder.length;){let c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;let u=t.all(c),d=String(c.identifier).toUpperCase(),m=An(d.toLowerCase()),p=0,h=[],f=t.footnoteCounts.get(d);for(;f!==void 0&&++p<=f;){h.length>0&&h.push({type:"text",value:" "});let x=typeof r=="string"?r:r(l,p);typeof x=="string"&&(x={type:"text",value:x}),h.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}let y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){let x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...h)}else u.push(...h);let g={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(u,!0)};t.patch(c,g),s.push(g)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...gi(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
3519
3519
|
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:`
|
|
3520
|
-
`}]}}var
|
|
3520
|
+
`}]}}var Nx={}.hasOwnProperty,L8={};function MD(t,e){let r=e||L8,n=new Map,i=new Map,a=new Map,o={...ND,...r.handlers},s={all:c,applyData:F8,definitionById:n,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:r,patch:z8,wrap:j8};return Ad(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let d=u.type==="definition"?n:i,m=String(u.identifier).toUpperCase();d.has(m)||d.set(m,u)}}),s;function l(u,d){let m=u.type,p=s.handlers[m];if(Nx.call(s.handlers,m)&&p)return p(s,u,d);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in u){let{children:f,...y}=u,g=gi(y);return g.children=s.all(u),g}return gi(u)}return(s.options.unknownHandler||B8)(s,u,d)}function c(u){let d=[];if("children"in u){let m=u.children,p=-1;for(;++p<m.length;){let h=s.one(m[p],u);if(h){if(p&&m[p-1].type==="break"&&(!Array.isArray(h)&&h.type==="text"&&(h.value=DD(h.value)),!Array.isArray(h)&&h.type==="element")){let f=h.children[0];f&&f.type==="text"&&(f.value=DD(f.value))}Array.isArray(h)?d.push(...h):d.push(h)}}}return d}}function z8(t,e){t.position&&(e.position=Rx(t))}function F8(t,e){let r=e;if(t&&t.data){let n=t.data.hName,i=t.data.hChildren,a=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{let o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&a&&Object.assign(r.properties,gi(a)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function B8(t,e){let r=e.data||{},n="value"in e&&!(Nx.call(r,"hProperties")||Nx.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function j8(t,e){let r=[],n=-1;for(e&&r.push({type:"text",value:`
|
|
3521
3521
|
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
3522
3522
|
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
3523
|
-
`}),r}function
|
|
3524
|
-
`},i)),a}function Vf(t,e){return t&&"run"in t?async function(r,n){let i=Gf(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Gf(r,{file:n,...e||t})}}function kx(t){if(t)throw t}var Wf=Yd(GD(),1);function Ld(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function xx(){let t=[],e={run:r,use:n};return e;function r(...i){let a=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...c){let u=t[++a],d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?VD(u,s)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function VD(t,e){let r;return n;function n(...o){let s=t.length>o.length,l;s&&o.push(i);try{l=t.apply(this,o)}catch(c){let u=c;if(s&&r)throw u;return i(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){r||(r=!0,e(o,...s))}function a(o){i(null,o)}}var Jt=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof e=="string"?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=ja(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;var Xn={basename:j8,dirname:U8,extname:G8,join:V8,sep:"/"};function j8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');zd(t);let r=0,n=-1,i=t.length,a;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(n=i):(s=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function U8(t){if(zd(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function G8(t){zd(t);let e=t.length,r=-1,n=0,i=-1,a=0,o;for(;e--;){let s=t.codePointAt(e);if(s===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),s===46?i<0?i=e:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function V8(...t){let e=-1,r;for(;++e<t.length;)zd(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":H8(r)}function H8(t){zd(t);let e=t.codePointAt(0)===47,r=q8(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function q8(t,e){let r="",n=0,i=-1,a=0,o=-1,s,l;for(;++o<=t.length;){if(o<t.length)s=t.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length>0){r="",n=0,i=o,a=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return r}function zd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var HD={cwd:W8};function W8(){return"/"}function zl(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function qD(t){if(typeof t=="string")t=new URL(t);else if(!zl(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Z8(t)}function Z8(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){let n=e.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var Ex=["history","path","basename","stem","extname","dirname"],Fd=class{constructor(e){let r;e?zl(e)?r={path:e}:typeof e=="string"||K8(e)?r={value:e}:r=e:r={},this.cwd=HD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Ex.length;){let a=Ex[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)Ex.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(e){Cx(e,"basename"),Tx(e,"basename"),this.path=Xn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(e){WD(this.basename,"dirname"),this.path=Xn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(e){if(Tx(e,"extname"),WD(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){zl(e)&&(e=qD(e)),Cx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(e){Cx(e,"stem"),Tx(e,"stem"),this.path=Xn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){let i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){let i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){let i=new Jt(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Tx(t,e){if(t&&t.includes(Xn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xn.sep+"`")}function Cx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function WD(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function K8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var ZD=function(t){let n=this.constructor.prototype,i=n[t],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,n);let o=Object.getOwnPropertyNames(i);for(let s of o){let l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(a,s,l)}return a};var J8={}.hasOwnProperty,Rx=class t extends ZD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=xx()}copy(){let e=new t,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];e.use(...n)}return e.data((0,Wf.default)(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Px("data",this.frozen),this.namespace[e]=r,this):J8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Px("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let r=qf(e),n=this.parser||this.Parser;return Ix("parse",n),n(String(r),r)}process(e,r){let n=this;return this.freeze(),Ix("process",this.parser||this.Parser),Ax("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(a,o){let s=qf(e),l=n.parse(s);n.run(l,s,function(u,d,m){if(u||!d||!m)return c(u);let p=d,h=n.stringify(p,m);Y8(h)?m.value=h:m.result=h,c(u,m)});function c(u,d){u||!d?o(u):a?a(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),Ix("processSync",this.parser||this.Parser),Ax("processSync",this.compiler||this.Compiler),this.process(e,i),JD("processSync","process",r),n;function i(a,o){r=!0,kx(a),n=o}}run(e,r,n){KD(e),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?a(void 0,n):new Promise(a);function a(o,s){let l=qf(r);i.run(e,l,c);function c(u,d,m){let p=d||e;u?s(u):o?o(p):n(void 0,p,m)}}}runSync(e,r){let n=!1,i;return this.run(e,r,a),JD("runSync","run",n),i;function a(o,s){kx(o),i=s,n=!0}}stringify(e,r){this.freeze();let n=qf(r),i=this.compiler||this.Compiler;return Ax("stringify",i),KD(e),i(e,n)}use(e,...r){let n=this.attachers,i=this.namespace;if(Px("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(i.settings=(0,Wf.default)(!0,i.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];a(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,m=-1;for(;++d<n.length;)if(n[d][0]===c){m=d;break}if(m===-1)n.push([c,...u]);else if(u.length>0){let[p,...h]=u,f=n[m][1];Ld(f)&&Ld(p)&&(p=(0,Wf.default)(!0,f,p)),n[m]=[c,p,...h]}}}},Nx=new Rx().freeze();function Ix(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ax(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Px(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function KD(t){if(!Ld(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function JD(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function qf(t){return X8(t)?t:new Fd(t)}function X8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Y8(t){return typeof t=="string"||Q8(t)}function Q8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Bd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3523
|
+
`}),r}function DD(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Hf(t,e){let r=MD(t,e),n=r.one(t,void 0),i=OD(r),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&("children"in a,a.children.push({type:"text",value:`
|
|
3524
|
+
`},i)),a}function qf(t,e){return t&&"run"in t?async function(r,n){let i=Hf(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Hf(r,{file:n,...e||t})}}function Ox(t){if(t)throw t}var Kf=ep(VD(),1);function Bd(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Dx(){let t=[],e={run:r,use:n};return e;function r(...i){let a=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...c){let u=t[++a],d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?HD(u,s)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function HD(t,e){let r;return n;function n(...o){let s=t.length>o.length,l;s&&o.push(i);try{l=t.apply(this,o)}catch(c){let u=c;if(s&&r)throw u;return i(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){r||(r=!0,e(o,...s))}function a(o){i(null,o)}}var Jt=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof e=="string"?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=ja(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;var Xn={basename:U8,dirname:G8,extname:V8,join:H8,sep:"/"};function U8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');jd(t);let r=0,n=-1,i=t.length,a;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(n=i):(s=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function G8(t){if(jd(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function V8(t){jd(t);let e=t.length,r=-1,n=0,i=-1,a=0,o;for(;e--;){let s=t.codePointAt(e);if(s===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),s===46?i<0?i=e:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function H8(...t){let e=-1,r;for(;++e<t.length;)jd(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":q8(r)}function q8(t){jd(t);let e=t.codePointAt(0)===47,r=W8(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function W8(t,e){let r="",n=0,i=-1,a=0,o=-1,s,l;for(;++o<=t.length;){if(o<t.length)s=t.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length>0){r="",n=0,i=o,a=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return r}function jd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var qD={cwd:Z8};function Z8(){return"/"}function Fl(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function WD(t){if(typeof t=="string")t=new URL(t);else if(!Fl(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return K8(t)}function K8(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){let n=e.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var Mx=["history","path","basename","stem","extname","dirname"],Ud=class{constructor(e){let r;e?Fl(e)?r={path:e}:typeof e=="string"||J8(e)?r={value:e}:r=e:r={},this.cwd=qD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Mx.length;){let a=Mx[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)Mx.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(e){Lx(e,"basename"),$x(e,"basename"),this.path=Xn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(e){ZD(this.basename,"dirname"),this.path=Xn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(e){if($x(e,"extname"),ZD(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Fl(e)&&(e=WD(e)),Lx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(e){Lx(e,"stem"),$x(e,"stem"),this.path=Xn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){let i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){let i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){let i=new Jt(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function $x(t,e){if(t&&t.includes(Xn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xn.sep+"`")}function Lx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function ZD(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function J8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var KD=function(t){let n=this.constructor.prototype,i=n[t],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,n);let o=Object.getOwnPropertyNames(i);for(let s of o){let l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(a,s,l)}return a};var X8={}.hasOwnProperty,jx=class t extends KD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Dx()}copy(){let e=new t,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];e.use(...n)}return e.data((0,Kf.default)(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Bx("data",this.frozen),this.namespace[e]=r,this):X8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bx("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let r=Zf(e),n=this.parser||this.Parser;return zx("parse",n),n(String(r),r)}process(e,r){let n=this;return this.freeze(),zx("process",this.parser||this.Parser),Fx("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(a,o){let s=Zf(e),l=n.parse(s);n.run(l,s,function(u,d,m){if(u||!d||!m)return c(u);let p=d,h=n.stringify(p,m);Q8(h)?m.value=h:m.result=h,c(u,m)});function c(u,d){u||!d?o(u):a?a(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),zx("processSync",this.parser||this.Parser),Fx("processSync",this.compiler||this.Compiler),this.process(e,i),XD("processSync","process",r),n;function i(a,o){r=!0,Ox(a),n=o}}run(e,r,n){JD(e),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?a(void 0,n):new Promise(a);function a(o,s){let l=Zf(r);i.run(e,l,c);function c(u,d,m){let p=d||e;u?s(u):o?o(p):n(void 0,p,m)}}}runSync(e,r){let n=!1,i;return this.run(e,r,a),XD("runSync","run",n),i;function a(o,s){Ox(o),i=s,n=!0}}stringify(e,r){this.freeze();let n=Zf(r),i=this.compiler||this.Compiler;return Fx("stringify",i),JD(e),i(e,n)}use(e,...r){let n=this.attachers,i=this.namespace;if(Bx("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(i.settings=(0,Kf.default)(!0,i.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];a(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,m=-1;for(;++d<n.length;)if(n[d][0]===c){m=d;break}if(m===-1)n.push([c,...u]);else if(u.length>0){let[p,...h]=u,f=n[m][1];Bd(f)&&Bd(p)&&(p=(0,Kf.default)(!0,f,p)),n[m]=[c,p,...h]}}}},Ux=new jx().freeze();function zx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Fx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bx(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function JD(t){if(!Bd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function XD(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Zf(t){return Y8(t)?t:new Ud(t)}function Y8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Q8(t){return typeof t=="string"||e7(t)}function e7(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Gd=class extends an{constructor(){super(...arguments);this.html=()=>`
|
|
3525
3525
|
|
|
3526
3526
|
<!-- Styling -->
|
|
3527
3527
|
<style>
|
|
@@ -3608,7 +3608,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3608
3608
|
<div class='llm-selector-item-icon' style="background-image: url('${n.icon}'); "></div>
|
|
3609
3609
|
<div class='llm-selector-item-name'>${n.name}</div>
|
|
3610
3610
|
<div class='llm-selector-item-provider'>${n.provider}</div>
|
|
3611
|
-
`,i.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:n.id}))}),r.appendChild(i)}}};Bd.observedAttributes=["open"];var Fl=new Re("ONNXModel"),Yn=class t{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,Fl.debug(`Model input parameters: ${e.inputNames.join(", ")}`),Fl.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!t.lib}static async load(e){if(!t.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(Fl.debug("Loading ONNX runtime"),this.onnx=await t.lib()),Fl.debug(`Loading model: ${e}`);let r=await this.onnx.InferenceSession.create(e);return new t(r)}makeTensor(e,r,n=0){let i=1;for(let o of r)i*=o;let a;if(e=="float32")a=new t.onnx.Tensor(new Float32Array(i),r);else if(e=="int8")a=new t.onnx.Tensor(new Int8Array(i),r);else if(e=="int16")a=new t.onnx.Tensor(new Int16Array(i),r);else if(e=="int32")a=new t.onnx.Tensor(new Int32Array(i),r);else if(e=="int64")a=new t.onnx.Tensor(new BigInt64Array(i),r);else if(e=="uint8")a=new t.onnx.Tensor(new Uint8Array(i),r);else if(e=="uint16")a=new t.onnx.Tensor(new Uint16Array(i),r);else if(e=="uint32")a=new t.onnx.Tensor(new Uint32Array(i),r);else if(e=="uint64")a=new t.onnx.Tensor(new BigUint64Array(i),r);else throw new Error(`Invalid type: ${e}`);return n!==0&&(e=="int64"||e=="uint64")?a.data.fill(BigInt(n)):n!==0&&a.data.fill(n),a}registerConstant(e,r){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=r,r}makeConstant(e,r,n,i=0){return this.registerConstant(e,this.makeTensor(r,n,i))}registerState(e,r,n){if(r||(r=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(r))throw new Error(`Model does not have an output named: ${r}`);return this.stateTensors[e]={outputName:r,tensor:n},n}makeState(e,r,n,i,a=0){return this.registerState(e,r,this.makeTensor(n,i,a))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return Fl.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let r in this.stateTensors)e[r]=this.stateTensors[r].tensor;for(let r in this.constantTensors)e[r]=this.constantTensors[r];try{let r=await this.session.run(e);for(let n in this.stateTensors){let i=r[this.stateTensors[n].outputName];this.stateTensors[n].tensor=i}return r}finally{this._runActive=!1}}resetState(){Fl.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var XD="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var t7=new Re("PCMPlayerNode"),Bl=class extends AudioWorkletNode{constructor(r,n,i){super(r,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!i||i!="int16"&&i!="float32")throw new Error(`Invalid format: ${i}`);this.sampleRate=n,this.format=i,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:n,outputSampleRate:r.sampleRate,format:i})}static async registerModule(r){await r.audioWorklet.addModule(XD)}feed(r){this.port.postMessage({action:"data",buffer:r.buffer},[r.buffer])}async play(r){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(n=>this._playPromiseResolve=n),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:r}}));try{let n=r.getReader();for(;!this.isCancelled;){let{done:i,value:a}=await n.read();if(i||!a)break;this.feed(a)}}catch(n){t7.warn("Stream error:",n),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:r,error:n}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(r){r.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var Zf=new Re("SpeechOutput"),YD=.5,r7=.8,Kf=class extends EventTarget{constructor(r){super();this.maxVolumeHeard=0;this.ai=r,this.ai.addEventListener("output",n=>this.onTextOutputFromAI(n)),this.ai.audio?.speechRecognition.addEventListener("speechstart",n=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(r){r.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(r.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}async speak(r){if(!this.ai?.config?.voice?.providerID)return Zf.warn("No voice provider configured");let n=`speech-${n7++}`;await this.ai.audio.beginAccess(n);try{await this._speakWithLock(r)}finally{this.ai.audio.endAccess(n)}}async _speakWithLock(r){let n=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:r}});if(this.dispatchEvent(n),r=n.detail.message,n.defaultPrevented||!r)return;this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=r7);let i=this.ai?._voiceTracker||Zf.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${r}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let a=new Bl(this.ai.audio.context,24e3,"int16");this.currentPlayer=a,a.connect(this.analyserNode),a.addEventListener("end",s=>{let l=s;i(`PCM stream ${l.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==a&&!l.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let o;if(this.ai.config.voice.providerID=="openai")o=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:r,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")o=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:r})});else{Zf.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(i(`Received response ${o.status} ${o.statusText}`),!o.ok){Zf.warn(`Failed to generate voice sample: ${o.status} ${o.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:r}})),i("Playing PCM stream"),await a.play(o.body),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let r=this.currentPlayerVolume,n=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=YD);let i=400;r.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(a=>setTimeout(a,i+250)),r.disconnect(),n?.stop(),n?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=YD)}},n7=1;function Jf(t,e){let r=e.reduce((l,c)=>l+c.byteLength,0),n=new DataView(new ArrayBuffer(44));n.setUint8(0,82),n.setUint8(1,73),n.setUint8(2,70),n.setUint8(3,70),n.setUint32(4,44+r,!0),n.setUint8(8,87),n.setUint8(9,65),n.setUint8(10,86),n.setUint8(11,69);let i=1,a=32,o=i*a/8,s=t*o;return n.setUint8(12,102),n.setUint8(13,109),n.setUint8(14,116),n.setUint8(15,32),n.setUint32(16,16,!0),n.setUint16(20,3,!0),n.setUint16(22,i,!0),n.setUint32(24,t,!0),n.setUint32(28,s,!0),n.setUint16(32,o,!0),n.setUint16(34,a,!0),n.setUint8(36,100),n.setUint8(37,97),n.setUint8(38,116),n.setUint8(39,97),n.setUint32(40,r,!0),new File([n,...e],"audio.wav",{type:"audio/wav"})}var QD="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var jl=class extends AudioWorkletNode{constructor(r,n,i,a){super(r,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=i;let o=["int16","int64","float32"];if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!o.includes(i))throw new Error(`Invalid format ${i}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:r.sampleRate,outputSampleRate:n,format:i,bufferSize:a})}static async registerModule(r){await r.audioWorklet.addModule(QD)}onWorkletMessage(r){if(r.data.action=="data"){let n=null;if(this.format=="int16"&&(n=new Int16Array(r.data.buffer)),this.format=="int64"&&(n=new BigInt64Array(r.data.buffer)),this.format=="float32"&&(n=new Float32Array(r.data.buffer)),!n)throw new Error(`Invalid format: ${this.format}`);this.onData(n),this.dispatchEvent(new CustomEvent("data",{detail:{data:n}}))}}onData(r){}};var Ox=16e3,Xf=256,Ul=8,jd=new Re("VoiceDetectionNode"),Ud=class Ud extends jl{constructor(r){super(r,Ox,"float32",Xf*Ul);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Ud.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return Ox}get numberOfSamples(){return Xf}get numberOfSampleChunks(){return Ul}get outputBufferSize(){return Xf*Ul}get isModelLoaded(){return!!this.vad}async loadModel(){jd.debug("Loading VAD model"),this.vad=await Yn.load(Ud.vadModelURL),this.vad.ignoreIfBusy=!0,jd.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],Ox),this.vad.makeState("h","hn","float32",[2,Ul,64]),this.vad.makeState("c","cn","float32",[2,Ul,64])}async onData(r){if(this.vad)try{let n=await this.vad.run({input:new Yn.onnx.Tensor(r,[Ul,Xf])});if(!n)return;this.currentProbability=0;for(let o=0;o<n.output.data.length;o++)n.output.data[o]>this.currentProbability&&(this.currentProbability=n.output.data[o]);let i=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>i;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),jd.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),jd.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(n){jd.error("VAD failed:",n)}}onSpeechStart(){}onSpeechEnd(){}};Ud.vadModelURL="";var Gl=Ud;var eM=new Re("VoiceChunkOutputNode"),Vl=class extends Gl{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((r,n)=>r+n.length,0)/8e3}async onData(r){if(await super.onData(r),this.isVoiceActive&&!this._voiceRecording){eM.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let n of this.buffers)this.recordedBuffers.push(n),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:n,isFinal:!1}})),this.onVoiceChunk(n);this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!0}})),this.onVoiceChunk(r),this._voiceRecording=!1;let n=this.recordedBuffers.reduce((i,a)=>i+a.length,0);eM.debug(`Voice complete, recorded ${(n/8e3).toFixed(2)} seconds of audio, ${n*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(r);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(r){}onVoiceEnd(r){}};var Yf=new Re("OpenAITranscriptionNode"),Qf=class extends Vl{constructor(r,n){super(r);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=n}async onVoiceEnd(r){let n=Yf.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...r);let i=Jf(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",i),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);n("Response received"),a=await s.text(),n("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){Yf.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return Yf.debug("Transcription complete, but no text was found");Yf.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(r){}};var eg=class extends WebSocket{constructor(r){super(r);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(r){this.readyState==WebSocket.OPEN?super.send(r):this.pendingData.push(r)}_onOpen(){for(let r of this.pendingData)super.send(r);this.pendingData=[]}};var vi=new Re("IntelliWeaveTranscriptionNode"),a7="wss://speech.intelliweave.ai/api/v1/transcribe",rg=class rg extends Vl{constructor(r,n){super(r);this.apiAddress=a7;this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0,this.ws?this.ws.send(r):(vi.debug("Opening WebSocket connection"),this.ws=new eg(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(r.buffer),this.ws.onopen=()=>{vi.debug("WebSocket connection opened")},this.ws.addEventListener("message",i=>{let a=JSON.parse(i.data);if(a.error)return vi.warn("Error: "+a.error);if(a.type!="transcription")return vi.warn("Invalid response type",a);if(a.streaming&&!a.final)return vi.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return vi.warn(`Empty transcription (${a.processingTime}ms)`);vi.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",i=>vi.warn("WebSocket error")));let n=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{vi.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},n)}async onVoiceEnd(r){if(this.ws?.send(JSON.stringify({type:"end"})),rg.debugExportWav){let n=Jf(this.sampleRate,r),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download="recording.wav",i.click()}}onVoiceTranscription(r){}onSocketClose(){vi.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};rg.debugExportWav=!1;var tg=rg;var Dx=new Re("SpeechRecognition"),ng=class extends EventTarget{constructor(r){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=r,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async n=>{n.enable?await this.start():this.stop()}}])}get isSupported(){if(!Yn.lib||!this.ai?.vadModel||!ia().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let r=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,r.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),Gl.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new Qf(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):(this.voiceDetection=new tg(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,r.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",n=>{this.ai._voiceTracker=Dx.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Nr(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("speechend",n=>{this.ai._voiceTracker?.("Speech ended");let i=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Nr(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:i}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("transcription",n=>{this.ai._voiceTracker?.(`Transcription: ${n.detail.text}`),Nr(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:n.detail.confidence||void 0}}),this.onTranscription(n)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(r){Dx.error("Failed to start speech recognition:",r),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(r=>r.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(r){let n=r.detail.text;Dx.debug("Heard:",n),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:n,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(r){throw this._skipEvents=!1,r}}}};var ig=new Re("AudioSystem"),Hl=class t{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new ng(this.ai),this.speechOutput=new Kf(this.ai)}static get isSupported(){return!(!Yn.lib||!ia().AudioWorkletNode)}static async registerModules(e){await Promise.all([Bl.registerModule(e),jl.registerModule(e)])}async beginAccess(e){ig.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(ig.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await t.registerModules(this.context))}endAccess(e){ig.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(r=>r!=e),!this.locks.length&&(ig.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var ake=new Re("Stream");var qo=Yd(hM(),1);var hke=new Re("React");var fke=(0,qo.createContext)(void 0);var ln=new Re("Embed"),Wo=class extends an{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3611
|
+
`,i.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:n.id}))}),r.appendChild(i)}}};Gd.observedAttributes=["open"];var Bl=new Re("ONNXModel"),Yn=class t{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,Bl.debug(`Model input parameters: ${e.inputNames.join(", ")}`),Bl.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!t.lib}static async load(e){if(!t.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(Bl.debug("Loading ONNX runtime"),this.onnx=await t.lib()),Bl.debug(`Loading model: ${e}`);let r=await this.onnx.InferenceSession.create(e);return new t(r)}makeTensor(e,r,n=0){let i=1;for(let o of r)i*=o;let a;if(e=="float32")a=new t.onnx.Tensor(new Float32Array(i),r);else if(e=="int8")a=new t.onnx.Tensor(new Int8Array(i),r);else if(e=="int16")a=new t.onnx.Tensor(new Int16Array(i),r);else if(e=="int32")a=new t.onnx.Tensor(new Int32Array(i),r);else if(e=="int64")a=new t.onnx.Tensor(new BigInt64Array(i),r);else if(e=="uint8")a=new t.onnx.Tensor(new Uint8Array(i),r);else if(e=="uint16")a=new t.onnx.Tensor(new Uint16Array(i),r);else if(e=="uint32")a=new t.onnx.Tensor(new Uint32Array(i),r);else if(e=="uint64")a=new t.onnx.Tensor(new BigUint64Array(i),r);else throw new Error(`Invalid type: ${e}`);return n!==0&&(e=="int64"||e=="uint64")?a.data.fill(BigInt(n)):n!==0&&a.data.fill(n),a}registerConstant(e,r){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=r,r}makeConstant(e,r,n,i=0){return this.registerConstant(e,this.makeTensor(r,n,i))}registerState(e,r,n){if(r||(r=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(r))throw new Error(`Model does not have an output named: ${r}`);return this.stateTensors[e]={outputName:r,tensor:n},n}makeState(e,r,n,i,a=0){return this.registerState(e,r,this.makeTensor(n,i,a))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return Bl.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let r in this.stateTensors)e[r]=this.stateTensors[r].tensor;for(let r in this.constantTensors)e[r]=this.constantTensors[r];try{let r=await this.session.run(e);for(let n in this.stateTensors){let i=r[this.stateTensors[n].outputName];this.stateTensors[n].tensor=i}return r}finally{this._runActive=!1}}resetState(){Bl.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var YD="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var r7=new Re("PCMPlayerNode"),jl=class extends AudioWorkletNode{constructor(r,n,i){super(r,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!i||i!="int16"&&i!="float32")throw new Error(`Invalid format: ${i}`);this.sampleRate=n,this.format=i,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:n,outputSampleRate:r.sampleRate,format:i})}static async registerModule(r){await r.audioWorklet.addModule(YD)}feed(r){this.port.postMessage({action:"data",buffer:r.buffer},[r.buffer])}async play(r){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(n=>this._playPromiseResolve=n),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:r}}));try{let n=r.getReader();for(;!this.isCancelled;){let{done:i,value:a}=await n.read();if(i||!a)break;this.feed(a)}}catch(n){r7.warn("Stream error:",n),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:r,error:n}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(r){r.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var Jf=new Re("SpeechOutput"),QD=.5,n7=.8,Xf=class extends EventTarget{constructor(r){super();this.maxVolumeHeard=0;this.ai=r,this.ai.addEventListener("output",n=>this.onTextOutputFromAI(n)),this.ai.audio?.speechRecognition.addEventListener("speechstart",n=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(r){r.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(r.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}async speak(r){if(!this.ai?.config?.voice?.providerID)return Jf.warn("No voice provider configured");let n=`speech-${i7++}`;await this.ai.audio.beginAccess(n);try{await this._speakWithLock(r)}finally{this.ai.audio.endAccess(n)}}async _speakWithLock(r){let n=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:r}});if(this.dispatchEvent(n),r=n.detail.message,n.defaultPrevented||!r)return;this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=n7);let i=this.ai?._voiceTracker||Jf.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${r}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let a=new jl(this.ai.audio.context,24e3,"int16");this.currentPlayer=a,a.connect(this.analyserNode),a.addEventListener("end",s=>{let l=s;i(`PCM stream ${l.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==a&&!l.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let o;if(this.ai.config.voice.providerID=="openai")o=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:r,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")o=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:r})});else{Jf.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(i(`Received response ${o.status} ${o.statusText}`),!o.ok){Jf.warn(`Failed to generate voice sample: ${o.status} ${o.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:r}})),i("Playing PCM stream"),await a.play(o.body),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let r=this.currentPlayerVolume,n=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=QD);let i=400;r.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(a=>setTimeout(a,i+250)),r.disconnect(),n?.stop(),n?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=QD)}},i7=1;function Yf(t,e){let r=e.reduce((l,c)=>l+c.byteLength,0),n=new DataView(new ArrayBuffer(44));n.setUint8(0,82),n.setUint8(1,73),n.setUint8(2,70),n.setUint8(3,70),n.setUint32(4,44+r,!0),n.setUint8(8,87),n.setUint8(9,65),n.setUint8(10,86),n.setUint8(11,69);let i=1,a=32,o=i*a/8,s=t*o;return n.setUint8(12,102),n.setUint8(13,109),n.setUint8(14,116),n.setUint8(15,32),n.setUint32(16,16,!0),n.setUint16(20,3,!0),n.setUint16(22,i,!0),n.setUint32(24,t,!0),n.setUint32(28,s,!0),n.setUint16(32,o,!0),n.setUint16(34,a,!0),n.setUint8(36,100),n.setUint8(37,97),n.setUint8(38,116),n.setUint8(39,97),n.setUint32(40,r,!0),new File([n,...e],"audio.wav",{type:"audio/wav"})}var eM="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var Ul=class extends AudioWorkletNode{constructor(r,n,i,a){super(r,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=i;let o=["int16","int64","float32"];if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!o.includes(i))throw new Error(`Invalid format ${i}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:r.sampleRate,outputSampleRate:n,format:i,bufferSize:a})}static async registerModule(r){await r.audioWorklet.addModule(eM)}onWorkletMessage(r){if(r.data.action=="data"){let n=null;if(this.format=="int16"&&(n=new Int16Array(r.data.buffer)),this.format=="int64"&&(n=new BigInt64Array(r.data.buffer)),this.format=="float32"&&(n=new Float32Array(r.data.buffer)),!n)throw new Error(`Invalid format: ${this.format}`);this.onData(n),this.dispatchEvent(new CustomEvent("data",{detail:{data:n}}))}}onData(r){}};var Gx=16e3,Qf=256,Gl=8,Vd=new Re("VoiceDetectionNode"),Hd=class Hd extends Ul{constructor(r){super(r,Gx,"float32",Qf*Gl);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Hd.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return Gx}get numberOfSamples(){return Qf}get numberOfSampleChunks(){return Gl}get outputBufferSize(){return Qf*Gl}get isModelLoaded(){return!!this.vad}async loadModel(){Vd.debug("Loading VAD model"),this.vad=await Yn.load(Hd.vadModelURL),this.vad.ignoreIfBusy=!0,Vd.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],Gx),this.vad.makeState("h","hn","float32",[2,Gl,64]),this.vad.makeState("c","cn","float32",[2,Gl,64])}async onData(r){if(this.vad)try{let n=await this.vad.run({input:new Yn.onnx.Tensor(r,[Gl,Qf])});if(!n)return;this.currentProbability=0;for(let o=0;o<n.output.data.length;o++)n.output.data[o]>this.currentProbability&&(this.currentProbability=n.output.data[o]);let i=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>i;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),Vd.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),Vd.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(n){Vd.error("VAD failed:",n)}}onSpeechStart(){}onSpeechEnd(){}};Hd.vadModelURL="";var Vl=Hd;var tM=new Re("VoiceChunkOutputNode"),Hl=class extends Vl{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((r,n)=>r+n.length,0)/8e3}async onData(r){if(await super.onData(r),this.isVoiceActive&&!this._voiceRecording){tM.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let n of this.buffers)this.recordedBuffers.push(n),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:n,isFinal:!1}})),this.onVoiceChunk(n);this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!0}})),this.onVoiceChunk(r),this._voiceRecording=!1;let n=this.recordedBuffers.reduce((i,a)=>i+a.length,0);tM.debug(`Voice complete, recorded ${(n/8e3).toFixed(2)} seconds of audio, ${n*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(r);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(r){}onVoiceEnd(r){}};var eg=new Re("OpenAITranscriptionNode"),tg=class extends Hl{constructor(r,n){super(r);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=n}async onVoiceEnd(r){let n=eg.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...r);let i=Yf(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",i),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);n("Response received"),a=await s.text(),n("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){eg.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return eg.debug("Transcription complete, but no text was found");eg.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(r){}};var rg=class extends WebSocket{constructor(r){super(r);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(r){this.readyState==WebSocket.OPEN?super.send(r):this.pendingData.push(r)}_onOpen(){for(let r of this.pendingData)super.send(r);this.pendingData=[]}};var vi=new Re("IntelliWeaveTranscriptionNode"),o7="wss://speech.intelliweave.ai/api/v1/transcribe",ig=class ig extends Hl{constructor(r,n){super(r);this.apiAddress=o7;this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0,this.ws?this.ws.send(r):(vi.debug("Opening WebSocket connection"),this.ws=new rg(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(r.buffer),this.ws.onopen=()=>{vi.debug("WebSocket connection opened")},this.ws.addEventListener("message",i=>{let a=JSON.parse(i.data);if(a.error)return vi.warn("Error: "+a.error);if(a.type!="transcription")return vi.warn("Invalid response type",a);if(a.streaming&&!a.final)return vi.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return vi.warn(`Empty transcription (${a.processingTime}ms)`);vi.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",i=>vi.warn("WebSocket error")));let n=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{vi.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},n)}async onVoiceEnd(r){if(this.ws?.send(JSON.stringify({type:"end"})),ig.debugExportWav){let n=Yf(this.sampleRate,r),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download="recording.wav",i.click()}}onVoiceTranscription(r){}onSocketClose(){vi.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};ig.debugExportWav=!1;var ng=ig;var Vx=new Re("SpeechRecognition"),ag=class extends EventTarget{constructor(r){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=r,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async n=>{n.enable?await this.start():this.stop()}}])}get isSupported(){if(!Yn.lib||!this.ai?.vadModel||!ia().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let r=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,r.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),Vl.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new tg(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):(this.voiceDetection=new ng(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,r.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",n=>{this.ai._voiceTracker=Vx.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Nr(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("speechend",n=>{this.ai._voiceTracker?.("Speech ended");let i=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Nr(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:i}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("transcription",n=>{this.ai._voiceTracker?.(`Transcription: ${n.detail.text}`),Nr(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:n.detail.confidence||void 0}}),this.onTranscription(n)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(r){Vx.error("Failed to start speech recognition:",r),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(r=>r.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(r){let n=r.detail.text;Vx.debug("Heard:",n),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:n,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(r){throw this._skipEvents=!1,r}}}};var og=new Re("AudioSystem"),ql=class t{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new ag(this.ai),this.speechOutput=new Xf(this.ai)}static get isSupported(){return!(!Yn.lib||!ia().AudioWorkletNode)}static async registerModules(e){await Promise.all([jl.registerModule(e),Ul.registerModule(e)])}async beginAccess(e){og.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(og.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await t.registerModules(this.context))}endAccess(e){og.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(r=>r!=e),!this.locks.length&&(og.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var oke=new Re("Stream");var qo=ep(fM(),1);var fke=new Re("React");var gke=(0,qo.createContext)(void 0);var ln=new Re("Embed"),Wo=class extends an{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3612
3612
|
|
|
3613
3613
|
<!-- Styling -->
|
|
3614
3614
|
<style>
|
|
@@ -3781,7 +3781,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3781
3781
|
<div id='root' class='hidden'>
|
|
3782
3782
|
|
|
3783
3783
|
<!-- Logo -->
|
|
3784
|
-
${
|
|
3784
|
+
${wd.add({id:"web-weaver-logo",logo:this.attr.logo})}
|
|
3785
3785
|
<div id='pulseanim' class="circle pulse"></div>
|
|
3786
3786
|
|
|
3787
3787
|
<!-- Inner container contains all the UI when the panel is open -->
|
|
@@ -3789,10 +3789,10 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3789
3789
|
</div>
|
|
3790
3790
|
|
|
3791
3791
|
<!-- LLM selector panel -->
|
|
3792
|
-
${
|
|
3792
|
+
${Gd.add({id:"llm-selector-panel"})}
|
|
3793
3793
|
|
|
3794
3794
|
<!-- Interaction panel -->
|
|
3795
|
-
${
|
|
3795
|
+
${Sd.add({id:"interaction-bar"})}
|
|
3796
3796
|
|
|
3797
3797
|
|
|
3798
3798
|
<!-- Powered by IW banner -->
|
|
@@ -3802,7 +3802,7 @@ ${o}`})}else if(a.type=="action"){let o={name:a._functionID,description:fg(typeo
|
|
|
3802
3802
|
|
|
3803
3803
|
</div>
|
|
3804
3804
|
|
|
3805
|
-
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._lastDisplayMode="";this._lastPositioningMode="";this._lastPositionX="";this._lastPositionY="";this._isProcessing=!1;this.ai=new Ol,Hl.isSupported&&(this.ai.audio=new Hl(this.ai))}onCreate(){ht().embed&&ln.warn("Only one <web-weaver-embed> element should be on the page."),ht().embed=this;let r=ht();ln.debug("[WebWeaverEmbed] Client config:",r),r.displayMode&&!this.attr.displayMode&&(ln.debug("[WebWeaverEmbed] Setting displayMode from client config:",r.displayMode),this.attr.displayMode=r.displayMode),r.positioningMode&&!this.attr.positioningMode&&(ln.debug("[WebWeaverEmbed] Setting positioningMode from client config:",r.positioningMode),this.attr.positioningMode=r.positioningMode),r.positionX&&!this.attr.positionX&&(ln.debug("[WebWeaverEmbed] Setting positionX from client config:",r.positionX),this.attr.positionX=r.positionX),r.positionY&&!this.attr.positionY&&(ln.debug("[WebWeaverEmbed] Setting positionY from client config:",r.positionY),this.attr.positionY=r.positionY),r.offsetX!==void 0&&!this.attr.offsetX&&(ln.debug("[WebWeaverEmbed] Setting offsetX from client config:",r.offsetX),this.attr.offsetX=String(r.offsetX)),r.offsetY!==void 0&&!this.attr.offsetY&&(ln.debug("[WebWeaverEmbed] Setting offsetY from client config:",r.offsetY),this.attr.offsetY=String(r.offsetY)),ln.debug("[WebWeaverEmbed] Attributes after setting:",{displayMode:this.attr.displayMode,positionX:this.attr.positionX,positionY:this.attr.positionY,offsetX:this.attr.offsetX,offsetY:this.attr.offsetY}),this.applyConfigStylesAndAttributes(),this.child("root").addEventListener("click",a=>this.onContainerClick(a)),this.child("web-weaver-logo").addEventListener("click",a=>this.onLogoClick(a)),this.child("interaction-bar").addEventListener("input-message",a=>this.processInput(a.detail)),this.child("interaction-bar").addEventListener("llm-button-click",a=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",a=>this.onLLMModelSelect(a)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:a=>(this.suggestions.push(a.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:a.text}),"Suggestion button added")});let i=this.attr.apiKey||ht().apiKey;if(!i)return ln.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(i).then(a=>{this.config=a,ht().introductionMessage=this.config.introductionMessage,ht().analytics=this.config.analytics!==void 0?!!this.config.analytics:ht().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(a=>{ln.error("Failed to load AI configuration:",a),this.state.loading=!1;let o=this.child("web-weaver-embed-inner");o&&(o.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let r=this.config,n=this.child("root");if(!n)return;let i=!1,o=this.attr.logo||r.logo;if(o&&o!==this._lastLogo){this._lastLogo=o,i=!0;let W=this.child("web-weaver-logo");W&&W.setAttribute("logo",o)}let l=this.attr.background||r.background;l!==this._lastBackground&&(this._lastBackground=l,i=!0,l?n.style.background=l:n.style.background="");let u=this.attr.textColor||r.textColor,d=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,i=!0,u?(n.style.color=u,d&&d.setAttribute("textColor",u)):(n.style.color="",d&&d.removeAttribute("textColor")));let p=this.attr.displayMode||r.displayMode||"closed";p!==this._lastDisplayMode&&(this._lastDisplayMode=p,i=!0,p==="open"&&!this.attr.open&&(this.attr.open=!0));let f=this.attr.positioningMode||r.positioningMode||"fixed";f!==this._lastPositioningMode&&(this._lastPositioningMode=f,i=!0);let g=this.attr.positionX||r.positionX||"right";g!==this._lastPositionX&&(this._lastPositionX=g,i=!0);let v=this.attr.positionY||r.positionY||"bottom";v!==this._lastPositionY&&(this._lastPositionY=v,i=!0);let I=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,T=I!==void 0?I:r.offsetX!==void 0?r.offsetX:20;T!==this._lastOffsetX&&(this._lastOffsetX=T,i=!0);let C=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,$=C!==void 0?C:r.offsetY!==void 0?r.offsetY:20;$!==this._lastOffsetY&&(this._lastOffsetY=$,i=!0),i&&ln.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:n.style.background,finalTextColor:n.style.color,finalDisplayMode:p,finalPositioningMode:f,finalPositionX:g,finalPositionY:v,finalOffsetX:T,finalOffsetY:$})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Nr(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let l=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Nr(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:l}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open");let r=this.child("root"),n=this._lastPositioningMode||"fixed",i=this._lastPositionX||"right",a=this._lastPositionY||"bottom",o=this._lastOffsetX!==void 0?this._lastOffsetX:20,s=this._lastOffsetY!==void 0?this._lastOffsetY:20;n==="container"?(r.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):r.classList.remove("container-mode"),n!=="container"&&(r.style.left="",r.style.right="",r.style.top="",r.style.bottom="",i==="left"?r.style.left=o+"px":r.style.right=o+"px",a==="top"?r.style.top=s+"px":r.style.bottom=s+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((l,c)=>(c.priority||0)-(l.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){ht().embed==this&&(ht().embed=void 0)}onContainerClick(r){(this._lastDisplayMode||"closed")!=="open"&&(this.attr.open||(r.preventDefault(),this.attr.open=!0))}onLogoClick(r){if(r.preventDefault(),r.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{if((this._lastDisplayMode||"closed")==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let r=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;r.children.length>0;)r.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let n=document.createElement("div");n.className="introduction-message",n.innerHTML=ht().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,r.appendChild(n),this.ai.insertAssistantMessage(n.innerText);for(let i of ht().introductionSuggestions||[]){let a=document.createElement("div");a.className="suggestion-button",a.innerText=i,a.addEventListener("click",o=>this.onSuggestionClick(o,i)),r.appendChild(a)}}async processInput(r){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let n=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(n.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let i=document.createElement("div");i.className="input",i.innerText=r,n.appendChild(i),this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output",this.currentOutputElement.style.display="none",this.currentOutputElement.innerHTML="",n.appendChild(this.currentOutputElement),n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(r);for(let a of this.suggestions){let o=document.createElement("div");o.className="suggestion-button",o.innerText=a,o.addEventListener("click",s=>this.onSuggestionClick(s,a)),n.appendChild(o)}n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(i){ln.error("Failed to process input:",i);let a=document.createElement("div");a.className="output",a.innerText="Sorry, there was a problem getting a response. "+i.message,n.appendChild(a);let o=document.createElement("div");o.className="suggestion-button",o.innerText="Reset conversation",o.addEventListener("click",s=>this.resetConversation()),n.appendChild(o)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(r){let n=await Nx().use(zf).use(Vf).use(ff,{target:"_blank",rel:["noopener","noreferrer"]}).use(yf).use(Tf).processSync(r);this.currentOutputElement&&(this.currentOutputElement.style.display="",this.currentOutputElement.innerHTML=n.toString("utf-8"));let i=this.child("web-weaver-embed-inner");for(let a of Array.from(i.querySelectorAll(".tool")))a.remove();i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(r,n){let i=`Running: ${r}`;r=="search"&&(i=`Searching: ${n?.query}`),r=="ui.focusElement"&&(i=`Focusing: #${n?.elementID}`),r=="ui.suggestResponse"&&(i=`Suggested response: ${n?.text}`);let a=this.child("web-weaver-embed-inner"),o=document.createElement("div");o.className="tool",o.innerText=i,a.appendChild(o),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(r,n){this.processInput(n)}onLLMModelSelect(r){r.preventDefault(),this.ai.setModel(r.detail),this.state.llmPanelOpen=!1}};Wo.tagName="intelliweave-embed",Wo.observedAttributes=["logo","focusID","open","background","textColor","displayMode","positioningMode","positionX","positionY","offsetX","offsetY"];Yn.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(Wo.create());
|
|
3805
|
+
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._lastDisplayMode="";this._lastPositioningMode="";this._lastPositionX="";this._lastPositionY="";this._isProcessing=!1;this.ai=new Dl,ql.isSupported&&(this.ai.audio=new ql(this.ai))}onCreate(){ht().embed&&ln.warn("Only one <web-weaver-embed> element should be on the page."),ht().embed=this;let r=ht();ln.debug("[WebWeaverEmbed] Client config:",r),r.displayMode&&!this.attr.displayMode&&(ln.debug("[WebWeaverEmbed] Setting displayMode from client config:",r.displayMode),this.attr.displayMode=r.displayMode),r.positioningMode&&!this.attr.positioningMode&&(ln.debug("[WebWeaverEmbed] Setting positioningMode from client config:",r.positioningMode),this.attr.positioningMode=r.positioningMode),r.positionX&&!this.attr.positionX&&(ln.debug("[WebWeaverEmbed] Setting positionX from client config:",r.positionX),this.attr.positionX=r.positionX),r.positionY&&!this.attr.positionY&&(ln.debug("[WebWeaverEmbed] Setting positionY from client config:",r.positionY),this.attr.positionY=r.positionY),r.offsetX!==void 0&&!this.attr.offsetX&&(ln.debug("[WebWeaverEmbed] Setting offsetX from client config:",r.offsetX),this.attr.offsetX=String(r.offsetX)),r.offsetY!==void 0&&!this.attr.offsetY&&(ln.debug("[WebWeaverEmbed] Setting offsetY from client config:",r.offsetY),this.attr.offsetY=String(r.offsetY)),ln.debug("[WebWeaverEmbed] Attributes after setting:",{displayMode:this.attr.displayMode,positionX:this.attr.positionX,positionY:this.attr.positionY,offsetX:this.attr.offsetX,offsetY:this.attr.offsetY}),this.applyConfigStylesAndAttributes(),this.child("root").addEventListener("click",a=>this.onContainerClick(a)),this.child("web-weaver-logo").addEventListener("click",a=>this.onLogoClick(a)),this.child("interaction-bar").addEventListener("input-message",a=>this.processInput(a.detail)),this.child("interaction-bar").addEventListener("llm-button-click",a=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",a=>this.onLLMModelSelect(a)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:a=>(this.suggestions.push(a.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:a.text}),"Suggestion button added")});let i=this.attr.apiKey||ht().apiKey;if(!i)return ln.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(i).then(a=>{this.config=a,ht().introductionMessage=this.config.introductionMessage,ht().analytics=this.config.analytics!==void 0?!!this.config.analytics:ht().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(a=>{ln.error("Failed to load AI configuration:",a),this.state.loading=!1;let o=this.child("web-weaver-embed-inner");o&&(o.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let r=this.config,n=this.child("root");if(!n)return;let i=!1,o=this.attr.logo||r.logo;if(o&&o!==this._lastLogo){this._lastLogo=o,i=!0;let W=this.child("web-weaver-logo");W&&W.setAttribute("logo",o)}let l=this.attr.background||r.background;l!==this._lastBackground&&(this._lastBackground=l,i=!0,l?n.style.background=l:n.style.background="");let u=this.attr.textColor||r.textColor,d=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,i=!0,u?(n.style.color=u,d&&d.setAttribute("textColor",u)):(n.style.color="",d&&d.removeAttribute("textColor")));let p=this.attr.displayMode||r.displayMode||"closed";p!==this._lastDisplayMode&&(this._lastDisplayMode=p,i=!0,p==="open"&&!this.attr.open&&(this.attr.open=!0));let f=this.attr.positioningMode||r.positioningMode||"fixed";f!==this._lastPositioningMode&&(this._lastPositioningMode=f,i=!0);let g=this.attr.positionX||r.positionX||"right";g!==this._lastPositionX&&(this._lastPositionX=g,i=!0);let v=this.attr.positionY||r.positionY||"bottom";v!==this._lastPositionY&&(this._lastPositionY=v,i=!0);let I=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,T=I!==void 0?I:r.offsetX!==void 0?r.offsetX:20;T!==this._lastOffsetX&&(this._lastOffsetX=T,i=!0);let C=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,M=C!==void 0?C:r.offsetY!==void 0?r.offsetY:20;M!==this._lastOffsetY&&(this._lastOffsetY=M,i=!0),i&&ln.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:n.style.background,finalTextColor:n.style.color,finalDisplayMode:p,finalPositioningMode:f,finalPositionX:g,finalPositionY:v,finalOffsetX:T,finalOffsetY:M})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Nr(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let l=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Nr(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:l}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open");let r=this.child("root"),n=this._lastPositioningMode||"fixed",i=this._lastPositionX||"right",a=this._lastPositionY||"bottom",o=this._lastOffsetX!==void 0?this._lastOffsetX:20,s=this._lastOffsetY!==void 0?this._lastOffsetY:20;n==="container"?(r.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):r.classList.remove("container-mode"),n!=="container"&&(r.style.left="",r.style.right="",r.style.top="",r.style.bottom="",i==="left"?r.style.left=o+"px":r.style.right=o+"px",a==="top"?r.style.top=s+"px":r.style.bottom=s+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((l,c)=>(c.priority||0)-(l.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){ht().embed==this&&(ht().embed=void 0)}onContainerClick(r){(this._lastDisplayMode||"closed")!=="open"&&(this.attr.open||(r.preventDefault(),this.attr.open=!0))}onLogoClick(r){if(r.preventDefault(),r.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{if((this._lastDisplayMode||"closed")==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let r=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;r.children.length>0;)r.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let n=document.createElement("div");n.className="introduction-message",n.innerHTML=ht().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,r.appendChild(n),this.ai.insertAssistantMessage(n.innerText);for(let i of ht().introductionSuggestions||[]){let a=document.createElement("div");a.className="suggestion-button",a.innerText=i,a.addEventListener("click",o=>this.onSuggestionClick(o,i)),r.appendChild(a)}}async processInput(r){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let n=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(n.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let i=document.createElement("div");i.className="input",i.innerText=r,n.appendChild(i),this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output",this.currentOutputElement.style.display="none",this.currentOutputElement.innerHTML="",n.appendChild(this.currentOutputElement),n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(r);for(let a of this.suggestions){let o=document.createElement("div");o.className="suggestion-button",o.innerText=a,o.addEventListener("click",s=>this.onSuggestionClick(s,a)),n.appendChild(o)}n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(i){ln.error("Failed to process input:",i);let a=document.createElement("div");a.className="output",a.innerText="Sorry, there was a problem getting a response. "+i.message,n.appendChild(a);let o=document.createElement("div");o.className="suggestion-button",o.innerText="Reset conversation",o.addEventListener("click",s=>this.resetConversation()),n.appendChild(o)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(r){let n=await Ux().use(Bf).use(qf).use(yf,{target:"_blank",rel:["noopener","noreferrer"]}).use(vf).use(If).processSync(r);this.currentOutputElement&&(this.currentOutputElement.style.display="",this.currentOutputElement.innerHTML=n.toString("utf-8"));let i=this.child("web-weaver-embed-inner");for(let a of Array.from(i.querySelectorAll(".tool")))a.remove();i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(r,n){let i=`Running: ${r}`;r=="search"&&(i=`Searching: ${n?.query}`),r=="ui.focusElement"&&(i=`Focusing: #${n?.elementID}`),r=="ui.suggestResponse"&&(i=`Suggested response: ${n?.text}`);let a=this.child("web-weaver-embed-inner"),o=document.createElement("div");o.className="tool",o.innerText=i,a.appendChild(o),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(r,n){this.processInput(n)}onLLMModelSelect(r){r.preventDefault(),this.ai.setModel(r.detail),this.state.llmPanelOpen=!1}};Wo.tagName="intelliweave-embed",Wo.observedAttributes=["logo","focusID","open","background","textColor","displayMode","positioningMode","positionX","positionY","offsetX","offsetY"];Yn.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(Wo.create());
|
|
3806
3806
|
/*! Bundled license information:
|
|
3807
3807
|
|
|
3808
3808
|
uri-js/dist/es5/uri.all.js:
|