conformtools 0.6.27 → 0.6.29

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.
Files changed (57) hide show
  1. package/dist/{account-RSL4PTDB.js → account-F4ODJBD2.js} +1 -1
  2. package/dist/{agent-hook-setup-IACTYSVL.js → agent-hook-setup-KBCGZNEE.js} +1 -1
  3. package/dist/{analysis-engine-BBOSGAB2.js → analysis-engine-LGB4OXG7.js} +1 -1
  4. package/dist/{bridge-42OMO43V.js → bridge-GLW34YZF.js} +1 -1
  5. package/dist/browser/timeline_core_bg.wasm +0 -0
  6. package/dist/{chunk-2DMNGWC2.js → chunk-7DH6DFYL.js} +1 -1
  7. package/dist/{chunk-XLRQNFJU.js → chunk-BZE7IP6U.js} +91 -91
  8. package/dist/{chunk-TGLH2JDW.js → chunk-FHCRWOI7.js} +1 -1
  9. package/dist/{chunk-NRURUPLU.js → chunk-GDPYFRSV.js} +1 -1
  10. package/dist/chunk-H3FD5KA2.js +7 -0
  11. package/dist/{chunk-BIX5ETBY.js → chunk-HHOFGYZ7.js} +1 -1
  12. package/dist/{chunk-YMRK5D3X.js → chunk-HZBGG7HI.js} +1 -1
  13. package/dist/{chunk-AR5BTVBM.js → chunk-KD7UGCLT.js} +1 -1
  14. package/dist/{chunk-2X2SFPWD.js → chunk-NTPDZOPF.js} +1 -1
  15. package/dist/chunk-QDL3XYOE.js +545 -0
  16. package/dist/chunk-QQBDHVUU.js +3 -0
  17. package/dist/chunk-RKJML7MH.js +10 -0
  18. package/dist/{chunk-T4B4Y5WQ.js → chunk-RVKNGIE3.js} +2 -2
  19. package/dist/{chunk-3KS3547B.js → chunk-SSFG7FNI.js} +1 -1
  20. package/dist/{chunk-UXEL636C.js → chunk-UXVABU6B.js} +1 -1
  21. package/dist/{chunk-6BL5HE4S.js → chunk-WJS6NM7T.js} +1 -1
  22. package/dist/{chunk-RL5XRG6O.js → chunk-WWE2FXAQ.js} +1 -1
  23. package/dist/{chunk-HNEKQMQG.js → chunk-YJREJ2MH.js} +1 -1
  24. package/dist/{chunk-JZCADV5C.js → chunk-ZE7BP4AE.js} +1 -1
  25. package/dist/{claude-setup-6RMV3QZM.js → claude-setup-FYWGYBTH.js} +1 -1
  26. package/dist/cli.js +2 -2
  27. package/dist/demo-engine-5HWLXPDJ.js +3 -0
  28. package/dist/{engine-I2NXY2OK.js → engine-LFB243Q6.js} +2 -2
  29. package/dist/{framing-PHFTZ4GL.js → framing-KHUFARKE.js} +1 -1
  30. package/dist/gfx-worker.js +1 -1
  31. package/dist/h264-QGSP23K2.js +3 -0
  32. package/dist/{h264-mxf-PKSTGNGH.js → h264-mxf-I4YANT5F.js} +1 -1
  33. package/dist/{host-relink-FHOEDE76.js → host-relink-L7I75SUH.js} +1 -1
  34. package/dist/{hosted-26GUD7IU.js → hosted-5Y5VX6X6.js} +1 -1
  35. package/dist/hosts-QMGBN2E6.js +3 -0
  36. package/dist/http.js +2 -2
  37. package/dist/{inspect-RT36GEVU.js → inspect-GP6B6UPD.js} +2 -2
  38. package/dist/{isobmff-65LRNCQH.js → isobmff-LAXAYC7P.js} +1 -1
  39. package/dist/{mc-video-2PCAX65A.js → mc-video-KQ7TP4DG.js} +1 -1
  40. package/dist/mcp.js +7 -7
  41. package/dist/{media-OXHZ3PGZ.js → media-SUPBJX64.js} +1 -1
  42. package/dist/{mxf-WFJNAX7D.js → mxf-2TQO552L.js} +1 -1
  43. package/dist/{ops-SH3IUU2Z.js → ops-CVKPID5Z.js} +1 -1
  44. package/dist/{probe-VB6JH6ZJ.js → probe-HUPB4H4G.js} +1 -1
  45. package/dist/{r3d-X2O5LUAB.js → r3d-EPSGIBPT.js} +1 -1
  46. package/dist/resolve-bridge.py +4 -1
  47. package/dist/{sequence-patch-OHYBBKKZ.js → sequence-patch-GXM3QSJC.js} +1 -1
  48. package/dist/{store-F2CTSR6E.js → store-K4W2LVRN.js} +1 -1
  49. package/dist/{timeline-AK6DUMWB.js → timeline-HTG23FEH.js} +1 -1
  50. package/package.json +5 -5
  51. package/dist/chunk-E4KQR4M3.js +0 -10
  52. package/dist/chunk-IDADYIY6.js +0 -7
  53. package/dist/chunk-M6SVZJAX.js +0 -537
  54. package/dist/chunk-ZPIY5DOU.js +0 -3
  55. package/dist/demo-engine-ITZ7VG6Q.js +0 -3
  56. package/dist/h264-TVMYQ7EB.js +0 -3
  57. package/dist/hosts-DXH4SQPZ.js +0 -3
package/dist/mcp.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as ha}from"./chunk-JZCADV5C.js";import{e as la,f as ua,j as da,k as fa,l as rn,n as pa,o as ma,p as on}from"./chunk-M6SVZJAX.js";import"./chunk-UXEL636C.js";import"./chunk-2X2SFPWD.js";import"./chunk-T4B4Y5WQ.js";import"./chunk-2DMNGWC2.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as ra,B as Hi,C as K,D as Ui,E as en,F as Vi,G as dt,Gc as oa,H as Ki,Hc as tn,Qc as na,Uc as sa,Vc as ia,Wc as aa,Zc as ca,a as ji,b as Go,c as Oi,d as Ai,e as Di,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Zi,l as Li,m as Xo,n as f,o as D,p as W,q as Fi,r as G,s as q,t as v,u as se,v as V,vc as Qi,w as Qo,wc as Dt,x as Yo,xc as Yi,y as F,yc as ea,z as pe,zc as ta}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import{a as zr,b as Mi,d as qi,e as Ni}from"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import{a as Ji,e as Wi,k as Xi}from"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-BIX5ETBY.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{e as Gi,f as Bi}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ci}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.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}}};A.Name=Ye;var _e=class extends Wt{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,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)zn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var kn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(kn),zn(r,e[o]),r.push(kn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function zn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=zn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===kn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||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 Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var Rn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Pn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.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}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Tn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Pn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Tn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=Rn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Rn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},In=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Cn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Mn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Nn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jn=class extends Ne{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=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},On=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{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 o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var An=class extends tt{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=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Dn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Zn=class extends je{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 o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Ln=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
- `:""},this._extScope=e,this._scope=new be.Scope({parent:e}),this._nodes=[new On]}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 o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}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,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new In(e,s,o)),s}const(e,r,o){return this._def(be.varKinds.const,e,r,o)}let(e,r,o){return this._def(be.varKinds.let,e,r,o)}var(e,r,o){return this._def(be.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Cn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new jn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new An(e),r)}forRange(e,r,o,n,s=this.opts.es5?be.varKinds.var:be.varKinds.let){let i=this._scope.toName(e);return this._for(new Dn(s,i,r,o),()=>n(i))}forOf(e,r,o,n=be.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?be.varKinds.var:be.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new Mn(e))}break(e){return this._leafNode(new qn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Zn;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new Nn(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 o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}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 o=this._currNode;if(o instanceof e||r&&o 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 et))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}};I.CodeGen=Ln;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Vf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Za(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Fn(t)}`}I.not=Za;var Kf=La(I.operators.AND);function Gf(...t){return t.reduce(Kf)}I.and=Gf;var Bf=La(I.operators.OR);function Jf(...t){return t.reduce(Bf)}I.or=Jf;function La(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Fn(e)} ${t} ${Fn(r)}`}function Fn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Wf=Qt();function Xf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Xf;function Qf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ua(t,e),!Va(e,t.self.RULES.all))}C.alwaysValidSchema=Qf;function Ua(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Ba(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ua;function Va(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Va;function Yf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Yf;function ep({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=ep;function tp(t){return Ka(decodeURIComponent(t))}C.unescapeFragment=tp;function rp(t){return encodeURIComponent(Un(t))}C.escapeFragment=rp;function Un(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Un;function Ka(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Ka;function op(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=op;function Fa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Vn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ga}),items:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ga(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Vn(t,r,e),r}C.evaluatedPropsToName=Ga;function Vn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Vn;var Ha={};function np(t,e){return t.scopeValue("func",{ref:e,code:Ha[e.code]||(Ha[e.code]=new Wf._Code(e.code))})}C.useFunc=np;var Hn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Hn||(C.Type=Hn={}));function sp(t,e,r){if(t instanceof L.Name){let o=e===Hn.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Un(t)}C.getErrorPath=sp;function Ba(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Ba});var Oe=$(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});var te=R(),ip={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Kn.default=ip});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=Oe();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function ap(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Xa(t,e,r);o??(i||a)?Ja(s,c):Wa(n,(0,j._)`[${c}]`)}re.reportError=ap;function cp(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Xa(t,e,r);Ja(n,a),s||i||Wa(o,ie.default.vErrors)}re.reportExtraError=cp;function lp(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=lp;function up({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=up;function Ja(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Wa(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Xa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:dp(t,e,r)}function dp(t,e,r={}){let{gen:o,it:n}=t,s=[fp(n,r),pp(t,r)];return mp(t,e,s),o.object(...s)}function fp({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function pp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function mp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Ya=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var hp=nr(),gp=R(),yp=Oe(),_p={message:"boolean schema is false"};function $p(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Qa(t,!1):typeof r=="object"&&r.$async===!0?e.return(yp.default.data):(e.assign((0,gp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=$p;function vp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Qa(t)):r.var(e,!0)}wt.boolOrEmptySchema=vp;function Qa(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,hp.reportError)(n,_p,void 0,e)}});var Gn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var wp=["string","number","integer","boolean","null","object","array"],bp=new Set(wp);function Sp(t){return typeof t=="string"&&bp.has(t)}bt.isJSONType=Sp;function xp(){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:{}}}bt.getRules=xp});var Bn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Ep({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&ec(t,o)}Ue.schemaHasRulesForType=Ep;function ec(t,e){return e.rules.some(r=>tc(t,r))}Ue.shouldUseGroup=ec;function tc(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=tc});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var kp=Gn(),zp=Bn(),Pp=nr(),T=R(),rc=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function Tp(t){let e=oc(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}oe.getSchemaTypes=Tp;function oc(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(kp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=oc;function Rp(t,e){let{gen:r,data:o,opts:n}=t,s=Ip(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,zp.schemaHasRulesForType)(t,e[0]));if(i){let a=Wn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Cp(t,e,s):Xn(t)})}return i}oe.coerceAndCheckDataType=Rp;var nc=new Set(["string","number","integer","boolean","null"]);function Ip(t,e){return e?t.filter(r=>nc.has(r)||e==="array"&&r==="array"):[]}function Cp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Wn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(nc.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Xn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),Mp(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
3
+ import{b as ha}from"./chunk-ZE7BP4AE.js";import{e as la,f as ua,j as da,k as fa,l as on,n as pa,o as ma,p as nn}from"./chunk-QDL3XYOE.js";import"./chunk-UXVABU6B.js";import"./chunk-NTPDZOPF.js";import"./chunk-RVKNGIE3.js";import"./chunk-7DH6DFYL.js";import"./chunk-SSFG7FNI.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as oa,B as Ui,C as K,D as Vi,E as en,F as Ki,G as dt,Gc as na,H as Gi,Hc as tn,Qc as sa,Uc as ia,Vc as aa,Wc as ca,Zc as rn,a as Oi,b as Go,c as Ai,d as Di,e as Zi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Li,l as Fi,m as Xo,n as f,o as D,p as W,q as Hi,r as G,s as q,t as v,u as se,v as V,vc as Yi,w as Qo,wc as Dt,x as Yo,xc as ea,y as F,yc as ta,z as pe,zc as ra}from"./chunk-BZE7IP6U.js";import"./chunk-IN6XVTUS.js";import"./chunk-RKJML7MH.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-HZBGG7HI.js";import{a as zr,b as qi,d as Ni,e as ji}from"./chunk-WJS6NM7T.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-GDPYFRSV.js";import"./chunk-FHCRWOI7.js";import"./chunk-WWE2FXAQ.js";import{a as Wi,e as Xi,k as Qi}from"./chunk-H3FD5KA2.js";import"./chunk-LMRPCWHV.js";import"./chunk-HHOFGYZ7.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-KD7UGCLT.js";import"./chunk-VZ3XYHK4.js";import"./chunk-YJREJ2MH.js";import{e as Bi,f as Ji}from"./chunk-E75BCWXY.js";import"./chunk-QQBDHVUU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Mi}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.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}}};A.Name=Ye;var _e=class extends Wt{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,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)Pn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var zn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(zn),Pn(r,e[o]),r.push(zn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function Pn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=Pn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===zn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||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 Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var In=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Tn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.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}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Rn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Tn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Rn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=In(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=In();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Cn=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Mn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Nn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},jn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},On=class extends Ne{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=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},An=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{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 o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var Dn=class extends tt{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=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Zn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Ln=class extends je{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 o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Fn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
+ `:""},this._extScope=e,this._scope=new be.Scope({parent:e}),this._nodes=[new An]}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 o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}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,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Cn(e,s,o)),s}const(e,r,o){return this._def(be.varKinds.const,e,r,o)}let(e,r,o){return this._def(be.varKinds.let,e,r,o)}var(e,r,o){return this._def(be.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Mn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new On(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Dn(e),r)}forRange(e,r,o,n,s=this.opts.es5?be.varKinds.var:be.varKinds.let){let i=this._scope.toName(e);return this._for(new Zn(s,i,r,o),()=>n(i))}forOf(e,r,o,n=be.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?be.varKinds.var:be.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new qn(e))}break(e){return this._leafNode(new Nn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Ln;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new jn(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 o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}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 o=this._currNode;if(o instanceof e||r&&o 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 et))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}};I.CodeGen=Fn;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Vf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Za(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Hn(t)}`}I.not=Za;var Kf=La(I.operators.AND);function Gf(...t){return t.reduce(Kf)}I.and=Gf;var Bf=La(I.operators.OR);function Jf(...t){return t.reduce(Bf)}I.or=Jf;function La(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Hn(e)} ${t} ${Hn(r)}`}function Hn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Wf=Qt();function Xf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Xf;function Qf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ua(t,e),!Va(e,t.self.RULES.all))}C.alwaysValidSchema=Qf;function Ua(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Ba(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ua;function Va(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Va;function Yf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Yf;function ep({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=ep;function tp(t){return Ka(decodeURIComponent(t))}C.unescapeFragment=tp;function rp(t){return encodeURIComponent(Vn(t))}C.escapeFragment=rp;function Vn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Vn;function Ka(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Ka;function op(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=op;function Fa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Kn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ga}),items:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ga(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Kn(t,r,e),r}C.evaluatedPropsToName=Ga;function Kn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Kn;var Ha={};function np(t,e){return t.scopeValue("func",{ref:e,code:Ha[e.code]||(Ha[e.code]=new Wf._Code(e.code))})}C.useFunc=np;var Un;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Un||(C.Type=Un={}));function sp(t,e,r){if(t instanceof L.Name){let o=e===Un.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Vn(t)}C.getErrorPath=sp;function Ba(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Ba});var Oe=$(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});var te=R(),ip={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Gn.default=ip});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=Oe();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function ap(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Xa(t,e,r);o??(i||a)?Ja(s,c):Wa(n,(0,j._)`[${c}]`)}re.reportError=ap;function cp(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Xa(t,e,r);Ja(n,a),s||i||Wa(o,ie.default.vErrors)}re.reportExtraError=cp;function lp(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=lp;function up({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=up;function Ja(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Wa(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Xa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:dp(t,e,r)}function dp(t,e,r={}){let{gen:o,it:n}=t,s=[fp(n,r),pp(t,r)];return mp(t,e,s),o.object(...s)}function fp({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function pp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function mp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Ya=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var hp=nr(),gp=R(),yp=Oe(),_p={message:"boolean schema is false"};function $p(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Qa(t,!1):typeof r=="object"&&r.$async===!0?e.return(yp.default.data):(e.assign((0,gp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=$p;function vp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Qa(t)):r.var(e,!0)}wt.boolOrEmptySchema=vp;function Qa(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,hp.reportError)(n,_p,void 0,e)}});var Bn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var wp=["string","number","integer","boolean","null","object","array"],bp=new Set(wp);function Sp(t){return typeof t=="string"&&bp.has(t)}bt.isJSONType=Sp;function xp(){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:{}}}bt.getRules=xp});var Jn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Ep({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&ec(t,o)}Ue.schemaHasRulesForType=Ep;function ec(t,e){return e.rules.some(r=>tc(t,r))}Ue.shouldUseGroup=ec;function tc(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=tc});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var kp=Bn(),zp=Jn(),Pp=nr(),T=R(),rc=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function Tp(t){let e=oc(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}oe.getSchemaTypes=Tp;function oc(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(kp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=oc;function Rp(t,e){let{gen:r,data:o,opts:n}=t,s=Ip(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,zp.schemaHasRulesForType)(t,e[0]));if(i){let a=Xn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Cp(t,e,s):Qn(t)})}return i}oe.coerceAndCheckDataType=Rp;var nc=new Set(["string","number","integer","boolean","null"]);function Ip(t,e){return e?t.filter(r=>nc.has(r)||e==="array"&&r==="array"):[]}function Cp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Xn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(nc.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Qn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),Mp(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
5
5
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
6
6
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
7
- || ${i} === "boolean" || ${n} === null`).assign(a,(0,T._)`[${n}]`)}}}function Mp({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,T._)`${e} !== undefined`,()=>t.assign((0,T._)`${e}[${r}]`,o))}function Jn(t,e,r,o=St.Correct){let n=o===St.Correct?T.operators.EQ:T.operators.NEQ,s;switch(t){case"null":return(0,T._)`${e} ${n} null`;case"array":s=(0,T._)`Array.isArray(${e})`;break;case"object":s=(0,T._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,T._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,T._)`typeof ${e} ${n} ${t}`}return o===St.Correct?s:(0,T.not)(s);function i(a=T.nil){return(0,T.and)((0,T._)`typeof ${e} == "number"`,a,r?(0,T._)`isFinite(${e})`:T.nil)}}oe.checkDataType=Jn;function Wn(t,e,r,o){if(t.length===1)return Jn(t[0],e,r,o);let n,s=(0,rc.toHash)(t);if(s.array&&s.object){let i=(0,T._)`typeof ${e} != "object"`;n=s.null?i:(0,T._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=T.nil;s.number&&delete s.integer;for(let i in s)n=(0,T.and)(n,Jn(i,e,r,o));return n}oe.checkDataTypes=Wn;var qp={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,T._)`{type: ${t}}`:(0,T._)`{type: ${e}}`};function Xn(t){let e=Np(t);(0,Pp.reportError)(e,qp)}oe.reportTypeError=Xn;function Np(t){let{gen:e,data:r,schema:o}=t,n=(0,rc.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var ic=$(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.assignDefaults=void 0;var xt=R(),jp=N();function Op(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)sc(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>sc(t,s,n.default))}io.assignDefaults=Op;function sc(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,xt._)`${s}${(0,xt.getProperty)(e)}`;if(n){(0,jp.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,xt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,xt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,xt._)`${a} = ${(0,xt.stringify)(r)}`)}});var $e=$(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.validateUnion=Z.validateArray=Z.usePattern=Z.callValidateCode=Z.schemaProperties=Z.allSchemaProperties=Z.noPropertyInData=Z.propertyInData=Z.isOwnProperty=Z.hasPropFunc=Z.reportMissingProp=Z.checkMissingProp=Z.checkReportMissingProp=void 0;var H=R(),Qn=N(),Ve=Oe(),Ap=N();function Dp(t,e){let{gen:r,data:o,it:n}=t;r.if(es(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,H._)`${e}`},!0),t.error()})}Z.checkReportMissingProp=Dp;function Zp({gen:t,data:e,it:{opts:r}},o,n){return(0,H.or)(...o.map(s=>(0,H.and)(es(t,e,s,r.ownProperties),(0,H._)`${n} = ${s}`)))}Z.checkMissingProp=Zp;function Lp(t,e){t.setParams({missingProperty:e},!0),t.error()}Z.reportMissingProp=Lp;function ac(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,H._)`Object.prototype.hasOwnProperty`})}Z.hasPropFunc=ac;function Yn(t,e,r){return(0,H._)`${ac(t)}.call(${e}, ${r})`}Z.isOwnProperty=Yn;function Fp(t,e,r,o){let n=(0,H._)`${e}${(0,H.getProperty)(r)} !== undefined`;return o?(0,H._)`${n} && ${Yn(t,e,r)}`:n}Z.propertyInData=Fp;function es(t,e,r,o){let n=(0,H._)`${e}${(0,H.getProperty)(r)} === undefined`;return o?(0,H.or)(n,(0,H.not)(Yn(t,e,r))):n}Z.noPropertyInData=es;function cc(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Z.allSchemaProperties=cc;function Hp(t,e){return cc(e).filter(r=>!(0,Qn.alwaysValidSchema)(t,e[r]))}Z.schemaProperties=Hp;function Up({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,H._)`${t}, ${e}, ${o}${n}`:e,d=[[Ve.default.instancePath,(0,H.strConcat)(Ve.default.instancePath,s)],[Ve.default.parentData,i.parentData],[Ve.default.parentDataProperty,i.parentDataProperty],[Ve.default.rootData,Ve.default.rootData]];i.opts.dynamicRef&&d.push([Ve.default.dynamicAnchors,Ve.default.dynamicAnchors]);let p=(0,H._)`${l}, ${r.object(...d)}`;return c!==H.nil?(0,H._)`${a}.call(${c}, ${p})`:(0,H._)`${a}(${p})`}Z.callValidateCode=Up;var Vp=(0,H._)`new RegExp`;function Kp({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,H._)`${n.code==="new RegExp"?Vp:(0,Ap.useFunc)(t,n)}(${r}, ${o})`})}Z.usePattern=Kp;function Gp(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,H._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Qn.Type.Num},s),e.if((0,H.not)(s),a)})}}Z.validateArray=Gp;function Bp(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Qn.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,H._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,H.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}Z.validateUnion=Bp});var dc=$(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.validateKeywordUsage=Te.validSchemaType=Te.funcKeywordCode=Te.macroKeywordCode=void 0;var ae=R(),nt=Oe(),Jp=$e(),Wp=nr();function Xp(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=uc(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ae.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Te.macroKeywordCode=Xp;function Qp(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;em(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=uc(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&lc(t),y(()=>t.error());else{let _=e.async?m():h();e.modifying&&lc(t),y(()=>Yp(t,_))}}function m(){let _=o.let("ruleErrs",null);return o.try(()=>g((0,ae._)`await `),w=>o.assign(d,!1).if((0,ae._)`${w} instanceof ${c.ValidationError}`,()=>o.assign(_,(0,ae._)`${w}.errors`),()=>o.throw(w))),_}function h(){let _=(0,ae._)`${l}.errors`;return o.assign(_,null),g(ae.nil),_}function g(_=e.async?(0,ae._)`await `:ae.nil){let w=c.opts.passContext?nt.default.this:nt.default.self,E=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ae._)`${_}${(0,Jp.callValidateCode)(t,l,w,E)}`,e.modifying)}function y(_){var w;o.if((0,ae.not)((w=e.valid)!==null&&w!==void 0?w:d),_)}}Te.funcKeywordCode=Qp;function lc(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ae._)`${o.parentData}[${o.parentDataProperty}]`))}function Yp(t,e){let{gen:r}=t;r.if((0,ae._)`Array.isArray(${e})`,()=>{r.assign(nt.default.vErrors,(0,ae._)`${nt.default.vErrors} === null ? ${e} : ${nt.default.vErrors}.concat(${e})`).assign(nt.default.errors,(0,ae._)`${nt.default.vErrors}.length`),(0,Wp.extendErrors)(t)},()=>t.error())}function em({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function uc(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,ae.stringify)(r)})}function tm(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Te.validSchemaType=tm;function rm({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Te.validateKeywordUsage=rm});var pc=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.extendSubschemaMode=Ke.extendSubschemaData=Ke.getSubschema=void 0;var Re=R(),fc=N();function om(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}${(0,Re.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,fc.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ke.getSubschema=om;function nm(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Re._)`${e.data}${(0,Re.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Re.str)`${u}${(0,fc.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Re._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Re.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ke.extendSubschemaData=nm;function sm(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Ke.extendSubschemaMode=sm});var ts=$((Mw,mc)=>{"use strict";mc.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 o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var gc=$((qw,hc)=>{"use strict";var Ge=hc.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};ao(e,o,n,t,"",t)};Ge.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ge.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ge.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ge.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 ao(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Ge.arrayKeywords)for(var p=0;p<d.length;p++)ao(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in Ge.propsKeywords){if(d&&typeof d=="object")for(var m in d)ao(t,e,r,d[m],n+"/"+l+"/"+im(m),s,n,l,o,m)}else(l in Ge.keywords||t.allKeys&&!(l in Ge.skipKeywords))&&ao(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function im(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var ir=$(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getSchemaRefs=ue.resolveUrl=ue.normalizeId=ue._getFullPath=ue.getFullPath=ue.inlineRef=void 0;var am=N(),cm=ts(),lm=gc(),um=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function dm(t,e=!0){return typeof t=="boolean"?!0:e===!0?!rs(t):e?yc(t)<=e:!1}ue.inlineRef=dm;var fm=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function rs(t){for(let e in t){if(fm.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(rs)||typeof r=="object"&&rs(r))return!0}return!1}function yc(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!um.has(r)&&(typeof t[r]=="object"&&(0,am.eachItem)(t[r],o=>e+=yc(o)),e===1/0))return 1/0}return e}function _c(t,e="",r){r!==!1&&(e=Et(e));let o=t.parse(e);return $c(t,o)}ue.getFullPath=_c;function $c(t,e){return t.serialize(e).split("#")[0]+"#"}ue._getFullPath=$c;var pm=/#\/?$/;function Et(t){return t?t.replace(pm,""):""}ue.normalizeId=Et;function mm(t,e,r){return r=Et(r),t.resolve(e,r)}ue.resolveUrl=mm;var hm=/^[a-z_][-a-z0-9._]*$/i;function gm(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Et(t[r]||e),s={"":n},i=_c(o,n,!1),a={},c=new Set;return lm(t,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;let g=i+p,y=s[h];typeof d[r]=="string"&&(y=_.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function _(E){let O=this.opts.uriResolver.resolve;if(E=Et(y?O(y,E):E),c.has(E))throw l(E);c.add(E);let P=this.refs[E];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,E):E!==Et(g)&&(E[0]==="#"?(u(d,a[E],E),a[E]=d):this.refs[E]=g),E}function w(E){if(typeof E=="string"){if(!hm.test(E))throw new Error(`invalid anchor "${E}"`);_.call(this,`#${E}`)}}}),a;function u(d,p,m){if(p!==void 0&&!cm(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ue.getSchemaRefs=gm});var lr=$(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.getData=Be.KeywordCxt=Be.validateFunctionCode=void 0;var xc=Ya(),vc=sr(),ns=Bn(),co=sr(),ym=ic(),cr=dc(),os=pc(),x=R(),z=Oe(),_m=ir(),Ae=N(),ar=nr();function $m(t){if(zc(t)&&(Pc(t),kc(t))){bm(t);return}Ec(t,()=>(0,xc.topBoolOrEmptySchema)(t))}Be.validateFunctionCode=$m;function Ec({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${z.default.data}, ${z.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${wc(r,n)}`),wm(t,n),t.code(s)}):t.func(e,(0,x._)`${z.default.data}, ${vm(n)}`,o.$async,()=>t.code(wc(r,n)).code(s))}function vm(t){return(0,x._)`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${t.dynamicRef?(0,x._)`, ${z.default.dynamicAnchors}={}`:x.nil}}={}`}function wm(t,e){t.if(z.default.valCxt,()=>{t.var(z.default.instancePath,(0,x._)`${z.default.valCxt}.${z.default.instancePath}`),t.var(z.default.parentData,(0,x._)`${z.default.valCxt}.${z.default.parentData}`),t.var(z.default.parentDataProperty,(0,x._)`${z.default.valCxt}.${z.default.parentDataProperty}`),t.var(z.default.rootData,(0,x._)`${z.default.valCxt}.${z.default.rootData}`),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{t.var(z.default.instancePath,(0,x._)`""`),t.var(z.default.parentData,(0,x._)`undefined`),t.var(z.default.parentDataProperty,(0,x._)`undefined`),t.var(z.default.rootData,z.default.data),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`{}`)})}function bm(t){let{schema:e,opts:r,gen:o}=t;Ec(t,()=>{r.$comment&&e.$comment&&Rc(t),zm(t),o.let(z.default.vErrors,null),o.let(z.default.errors,0),r.unevaluated&&Sm(t),Tc(t),Rm(t)})}function Sm(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function wc(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function xm(t,e){if(zc(t)&&(Pc(t),kc(t))){Em(t,e);return}(0,xc.boolOrEmptySchema)(t,e)}function kc({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 zc(t){return typeof t.schema!="boolean"}function Em(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Rc(t),Pm(t),Tm(t);let s=o.const("_errs",z.default.errors);Tc(t,s),o.var(e,(0,x._)`${s} === ${z.default.errors}`)}function Pc(t){(0,Ae.checkUnknownRules)(t),km(t)}function Tc(t,e){if(t.opts.jtd)return bc(t,[],!1,e);let r=(0,vc.getSchemaTypes)(t.schema),o=(0,vc.coerceAndCheckDataType)(t,r);bc(t,r,!o,e)}function km(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Ae.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function zm(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ae.checkStrictMode)(t,"default is ignored in the schema root")}function Pm(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,_m.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Tm(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Rc({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${z.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Rm(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${z.default.errors} === 0`,()=>e.return(z.default.data),()=>e.throw((0,x._)`new ${n}(${z.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,z.default.vErrors),s.unevaluated&&Im(t),e.return((0,x._)`${z.default.errors} === 0`))}function Im({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function bc(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Ae.schemaHasRulesButRef)(s,l))){n.block(()=>Cc(t,"$ref",l.all.$ref.definition));return}c.jtd||Cm(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,ns.shouldUseGroup)(s,p)&&(p.type?(n.if((0,co.checkDataType)(p.type,i,c.strictNumbers)),Sc(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,co.reportTypeError)(t)),n.endIf()):Sc(t,p),a||n.if((0,x._)`${z.default.errors} === ${o||0}`))}}function Sc(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,ym.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,ns.shouldUseRule)(o,s)&&Cc(t,s.keyword,s.definition,e.type)})}function Cm(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Mm(t,e),t.opts.allowUnionTypes||qm(t,e),Nm(t,t.dataTypes))}function Mm(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Ic(t.dataTypes,r)||ss(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Om(t,e)}}function qm(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&ss(t,"use allowUnionTypes to allow union type keyword")}function Nm(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,ns.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>jm(e,i))&&ss(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function jm(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Ic(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Om(t,e){let r=[];for(let o of t.dataTypes)Ic(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function ss(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ae.checkStrictMode)(t,e,t.opts.strictTypes)}var lo=class{constructor(e,r,o){if((0,cr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ae.schemaRefOrVal)(e,this.schema,o,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",Mc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,cr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",z.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():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,x.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,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?ar.reportExtraError:ar.reportError)(this,this.def.error,r)}$dataError(){(0,ar.reportError)(this,this.def.$dataError||ar.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ar.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,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,co.checkDataTypes)(c,r,s.opts.strictNumbers,co.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,os.getSubschema)(this.it,e);(0,os.extendSubschemaData)(o,this.it,e),(0,os.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return xm(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Ae.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Ae.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};Be.KeywordCxt=lo;function Cc(t,e,r,o){let n=new lo(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,cr.funcKeywordCode)(n,r):"macro"in r?(0,cr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,cr.funcKeywordCode)(n,r)}var Am=/^\/(?:[^~]|~0|~1)*$/,Dm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Mc(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return z.default.rootData;if(t[0]==="/"){if(!Am.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=z.default.rootData}else{let u=Dm.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,Ae.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Be.getData=Mc});var uo=$(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});var is=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};as.default=is});var ur=$(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});var cs=ir(),ls=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,cs.resolveUrl)(e,r,o),this.missingSchema=(0,cs.normalizeId)((0,cs.getFullPath)(e,this.missingRef))}};us.default=ls});var po=$(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.resolveSchema=ve.getCompilingSchema=ve.resolveRef=ve.compileSchema=ve.SchemaEnv=void 0;var Se=R(),Zm=uo(),st=Oe(),xe=ir(),qc=N(),Lm=lr(),kt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=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,xe.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};ve.SchemaEnv=kt;function fs(t){let e=Nc.call(this,t);if(e)return e;let r=(0,xe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Se.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Zm.default,code:(0,Se._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:st.default.data,parentData:st.default.parentData,parentDataProperty:st.default.parentDataProperty,dataNames:[st.default.data],dataPathArr:[Se.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Se.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Se.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Se._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Lm.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(st.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${st.default.self}`,`${st.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:g}=u;m.evaluated={props:h instanceof Se.Name?void 0:h,items:g instanceof Se.Name?void 0:g,dynamicProps:h instanceof Se.Name,dynamicItems:g instanceof Se.Name},m.source&&(m.source.evaluated=(0,Se.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}ve.compileSchema=fs;function Fm(t,e,r){var o;r=(0,xe.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=Vm.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new kt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Hm.call(this,s)}ve.resolveRef=Fm;function Hm(t){return(0,xe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:fs.call(this,t)}function Nc(t){for(let e of this._compilations)if(Um(e,t))return e}ve.getCompilingSchema=Nc;function Um(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Vm(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fo.call(this,t,e)}function fo(t,e){let r=this.opts.uriResolver.parse(e),o=(0,xe._getFullPath)(this.opts.uriResolver,r),n=(0,xe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return ds.call(this,r,t);let s=(0,xe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=fo.call(this,t,i);return typeof a?.schema!="object"?void 0:ds.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||fs.call(this,i),s===(0,xe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,xe.resolveUrl)(this.opts.uriResolver,n,u)),new kt({schema:a,schemaId:c,root:t,baseId:n})}return ds.call(this,r,i)}}ve.resolveSchema=fo;var Km=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ds(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,qc.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Km.has(a)&&u&&(e=(0,xe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,qc.schemaHasRulesButRef)(r,this.RULES)){let a=(0,xe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=fo.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new kt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var jc=$((Zw,Gm)=>{Gm.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 _s=$((Lw,Hc)=>{"use strict";var Bm=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ms=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),Jm=RegExp.prototype.test.bind(/^\d*$/u),it=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),hs=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ac=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),gs=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Wm=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),de=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)de[e]="%"+t[e>>4]+t[e&15]}function ne(t){return t<2048?de[192|t>>6]+de[128|t&63]:t<65536?de[224|t>>12]+de[128|t>>6&63]+de[128|t&63]:de[240|t>>18]+de[128|t>>12&63]+de[128|t>>6&63]+de[128|t&63]}function Xm(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Qm=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Ym=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),eh=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),th=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rh(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!eh(t[e])){if(t[e]==="%"&&e+2<t.length&&it(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function Oc(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),i=t.slice(e+r).join(":");return s+"::"+i}function oh(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!ms(c))return;s+=2;continue}if(!Qm(c))return;n[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:Oc(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return Oc(i)}function ps(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&Ym(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(nh(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!rh(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=oh(o);return i===void 0?{host:t,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function nh(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function sh(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var ih={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ah=/[@/?#:]/g,ch=/[@/?#]/g;function Dc(t,e){let r=e?ch:ah;return r.lastIndex=0,t.replace(r,o=>ih[o])}function Zc(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&hs(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function lh(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&hs(i)?e+=i:e+="%"+s,r+=2;continue}}if(Ac(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Fc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function uh(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let s=t[n];if(s==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(it(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),Ac(s)&&(s!==":"||!o))r+=s;else{let i=t.charCodeAt(n);if(i<128)r+=de[i];else if(i<55296||i>57343)r+=ne(i);else if(i<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ne(65536+(i-55296<<10)+(a-56320)),n++):r+=ne(65533)}else r+=ne(65533)}}return r}function ys(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let s=t.slice(o+1,o+3);if(it(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let s=t.charCodeAt(o);if(s<128)r+=de[s];else if(s<55296||s>57343)r+=ne(s);else if(s<=56319&&o+1<t.length){let i=t.charCodeAt(o+1);i>=56320&&i<=57343?(r+=ne(65536+(s-55296<<10)+(i-56320)),o++):r+=ne(65533)}else r+=ne(65533)}}return r}function Lc(t){return ys(t,Wm)}function dh(t){return ys(t,gs)}function fh(t){return ys(t,gs)}function Fc(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function ph(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));hs(i)?e+=i:e+="%"+s,r+=2;continue}}if(gs(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Fc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function mh(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(it(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function hh(t){let e=[];if(t.userinfo!==void 0&&(e.push(Lc(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!ms(r)){let o=ps(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Zc(r,!0),o=ps(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=Dc(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!Jm(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}Hc.exports={nonSimpleDomain:th,recomposeAuthority:hh,reescapeHostDelimiters:Dc,normalizePercentEncoding:Zc,normalizePathEncoding:lh,serializePathEncoding:uh,normalizeQueryFragmentEncoding:ph,encodeUserinfo:Lc,encodeQuery:dh,encodeFragment:fh,escapePreservingEscapes:mh,removeDotSegments:sh,isIPv4:ms,isUUID:Bm,normalizeIPv6:ps,stringArrayToHexStripped:Xm}});var Bc=$((Fw,Gc)=>{"use strict";var{isUUID:gh}=_s(),yh=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,_h=["http","https","ws","wss","urn","urn:uuid"];function $h(t){return _h.indexOf(t)!==-1}function $s(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 Uc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Vc(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 vh(t){return t.secure=$s(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function wh(t){if((t.port===($s(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=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function bh(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(yh);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=vs(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Sh(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=vs(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function xh(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!gh(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Eh(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Kc={scheme:"http",domainHost:!0,parse:Uc,serialize:Vc},kh={scheme:"https",domainHost:Kc.domainHost,parse:Uc,serialize:Vc},mo={scheme:"ws",domainHost:!0,parse:vh,serialize:wh},zh={scheme:"wss",domainHost:mo.domainHost,parse:mo.parse,serialize:mo.serialize},Ph={scheme:"urn",parse:bh,serialize:Sh,skipNormalize:!0},Th={scheme:"urn:uuid",parse:xh,serialize:Eh,skipNormalize:!0},ho={http:Kc,https:kh,ws:mo,wss:zh,urn:Ph,"urn:uuid":Th};Object.setPrototypeOf(ho,null);function vs(t){return t&&(ho[t]||ho[t.toLowerCase()])||void 0}Gc.exports={wsIsSecure:$s,SCHEMES:ho,isValidSchemeName:$h,getSchemeHandler:vs}});var al=$((Hw,_o)=>{"use strict";var{normalizeIPv6:Yc,removeDotSegments:fr,recomposeAuthority:Rh,normalizePercentEncoding:ws,normalizePathEncoding:Ih,serializePathEncoding:Jc,normalizeQueryFragmentEncoding:Wc,encodeQuery:Ch,encodeFragment:Mh,reescapeHostDelimiters:qh,isIPv4:el,nonSimpleDomain:Nh}=_s(),{SCHEMES:tl,getSchemeHandler:bs}=Bc(),rl=/^[A-Za-z][A-Za-z0-9+.-]*$/u,ol="URI scheme is malformed.";function Xc(t){let e=unescape(String(t));if(!rl.test(e))throw new TypeError(ol);return e}function jh(t,e){return typeof t=="string"?t=Uh(t,e):typeof t=="object"&&(t=yo(at(t,e),e)),t}function Oh(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=go(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=go(e,o);if(s||d||i||p||a||m||c||h||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=nl(n,l,o,!0),_=bs(r&&r.scheme||y.scheme),w=y.host,E=w!==void 0&&w!==""&&(el(w)||Yc(w).isIPV6);sl(y,r||{},_,E);let O=w&&w.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(w);if(y.error&&!O)throw new Error(y.error);return o.skipEscape=!0,at(y,o)}function nl(t,e,r,o){let n={};return o||(t=yo(at(t,r),r),e=yo(at(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=fr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=fr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=fr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=fr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Ah(t,e,r){let o=Qc(t,r),n=Qc(e,r);return o!==void 0&&n!==void 0&&o===n}function at(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:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=Xc(r.scheme));let s=bs(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(o.skipEscape?r.path=ws(r.path):r.path=Jc(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Xc(r.scheme),n.push(r.scheme,":"));let c=Rh(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(u=fr(u)),a&&(u=Jc(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",Ch(r.query)),r.fragment!==void 0&&n.push("#",Mh(r.fragment)),n.join("")}var Dh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Zh=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Lh=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Fh(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function dr(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function Ss(t){return t[0]==="["&&t[t.length-1]==="]"}function Hh(t){let e=t[4];return dr(t[3])||e!==void 0&&!Ss(e)&&dr(e)||dr(t[6])||dr(t[7])||dr(t[8])}function sl(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!Ss(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&Nh(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function go(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(Zh);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let p=t.match(Lh);if(p!==null){let h=p[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):h.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let m=t.match(Dh);if(m){if(o.scheme=m[1],o.userinfo=m[3],o.host=m[4],o.port=parseInt(m[5],10),o.path=m[6]||"",o.query=m[7],o.fragment=m[8],o.scheme!==void 0){let y=unescape(o.scheme);rl.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||ol,u=!0)}s=Hh(m),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=m[5]);let h=Fh(o,m);if(h!==void 0&&(o.error=o.error||h,n=!0),o.host)if(el(o.host)===!1){let _=Ss(o.host),w=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,E=Yc(o.host);l=E.isIPV6||E.isIPVFuture===!0,c=w&&(!_||E.error===!0),o.host=l?E.host:E.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=bs(r.scheme||o.scheme);if(c||(a=sl(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:ws(o.host,!0);l||(y=ws(y.toLowerCase())),o.host=qh(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=Ih(o.path)),o.query&&(o.query=Wc(o.query)),o.fragment&&(o.fragment=Wc(o.fragment))),g&&g.parse&&(g.parse(o,r),g===tl.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function yo(t,e){return go(t,e).parsed}function Uh(t,e){return il(t,e).normalized}function il(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=go(t,e);return{normalized:o||n||s||i||a?t:at(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Qc(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:at(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=il(r,e);return n||s||i||a||c?void 0:o}var xs={SCHEMES:tl,normalize:jh,resolve:Oh,resolveComponent:nl,equal:Ah,serialize:at,parse:yo};_o.exports=xs;_o.exports.default=xs;_o.exports.fastUri=xs});var ll=$(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});var cl=al();cl.code='require("ajv/dist/runtime/uri").default';Es.default=cl});var yl=$(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=void 0;var Vh=lr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return Vh.KeywordCxt}});var zt=R();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return zt._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return zt.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return zt.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return zt.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return zt.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return zt.CodeGen}});var Kh=uo(),ml=ur(),Gh=Gn(),pr=po(),Bh=R(),mr=ir(),$o=sr(),zs=N(),ul=jc(),Jh=ll(),hl=(t,e)=>new RegExp(t,e);hl.code="new RegExp";var Wh=["removeAdditional","useDefaults","coerceTypes"],Xh=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Qh={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."},Yh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dl=200;function eg(t){var e,r,o,n,s,i,a,c,u,l,d,p,m,h,g,y,_,w,E,O,P,ze,qe,Uo,Vo;let jt=t.strict,Ko=(e=t.code)===null||e===void 0?void 0:e.optimize,Ri=Ko===!0||Ko===void 0?1:Ko||0,Ii=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:hl,Yu=(n=t.uriResolver)!==null&&n!==void 0?n:Jh.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:jt)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:jt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:jt)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:jt)!==null&&p!==void 0?p:"log",strictRequired:(h=(m=t.strictRequired)!==null&&m!==void 0?m:jt)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:Ri,regExp:Ii}:{optimize:Ri,regExp:Ii},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:dl,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:dl,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(E=t.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(ze=t.validateSchema)!==null&&ze!==void 0?ze:!0,validateFormats:(qe=t.validateFormats)!==null&&qe!==void 0?qe:!0,unicodeRegExp:(Uo=t.unicodeRegExp)!==null&&Uo!==void 0?Uo:!0,int32range:(Vo=t.int32range)!==null&&Vo!==void 0?Vo:!0,uriResolver:Yu}}var hr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...eg(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Bh.ValueScope({scope:{},prefixes:Xh,es5:r,lines:o}),this.logger=ig(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Gh.getRules)(),fl.call(this,Qh,e,"NOT SUPPORTED"),fl.call(this,Yh,e,"DEPRECATED","warn"),this._metaOpts=ng.call(this),e.formats&&rg.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&og.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),tg.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=ul;o==="id"&&(n={...ul},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!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 o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ml.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,mr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=pl.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new pr.SchemaEnv({schema:{},schemaId:o});if(r=pr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=pl.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 o=e[this.opts.schemaId];return o&&(o=(0,mr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),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 o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(cg.call(this,o,r),!r)return(0,zs.eachItem)(o,s=>ks.call(this,s)),this;ug.call(this,r);let n={...r,type:(0,$o.getJSONTypes)(r.type),schemaType:(0,$o.getJSONTypes)(r.schemaType)};return(0,zs.eachItem)(o,n.type.length===0?s=>ks.call(this,s,n):s=>n.type.forEach(i=>ks.call(this,s,n,i))),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 o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=gl(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,mr.normalizeId)(i||o);let u=mr.getSchemaRefs.call(this,e,o);return c=new pr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):pr.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{pr.compileSchema.call(this,e)}finally{this.opts=r}}};hr.ValidationError=Kh.default;hr.MissingRefError=ml.default;Y.default=hr;function fl(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function pl(t){return t=(0,mr.normalizeId)(t),this.schemas[t]||this.refs[t]}function tg(){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 rg(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function og(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 ng(){let t={...this.opts};for(let e of Wh)delete t[e];return t}var sg={log(){},warn(){},error(){}};function ig(t){if(t===!1)return sg;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 ag=/^[a-z_$][a-z0-9_$:-]*$/i;function cg(t,e){let{RULES:r}=this;if((0,zs.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!ag.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function ks(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,$o.getJSONTypes)(e.type),schemaType:(0,$o.getJSONTypes)(e.schemaType)}};e.before?lg.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function lg(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function ug(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gl(e)),t.validateSchema=this.compile(e,!0))}var dg={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gl(t){return{anyOf:[t,dg]}}});var _l=$(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});var fg={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ps.default=fg});var bl=$(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.callRef=ct.getValidate=void 0;var pg=ur(),$l=$e(),fe=R(),Pt=Oe(),vl=po(),vo=N(),mg={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=vl.resolveRef.call(c,u,n,r);if(l===void 0)throw new pg.default(o.opts.uriResolver,n,r);if(l instanceof vl.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return wo(t,i,s,s.$async);let h=e.scopeValue("root",{ref:u});return wo(t,(0,fe._)`${h}.validate`,u,u.$async)}function p(h){let g=wl(t,h);wo(t,g,h,h.$async)}function m(h){let g=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,fe.stringify)(h)}:{ref:h}),y=e.name("valid"),_=t.subschema({schema:h,dataTypes:[],schemaPath:fe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function wl(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}ct.getValidate=wl;function wo(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Pt.default.this:fe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,fe._)`await ${(0,$l.callValidateCode)(t,e,u)}`),m(e),i||n.assign(h,!0)},g=>{n.if((0,fe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),p(g),i||n.assign(h,!1)}),t.ok(h)}function d(){t.result((0,$l.callValidateCode)(t,e,u),()=>m(e),()=>p(e))}function p(h){let g=(0,fe._)`${h}.errors`;n.assign(Pt.default.vErrors,(0,fe._)`${Pt.default.vErrors} === null ? ${g} : ${Pt.default.vErrors}.concat(${g})`),n.assign(Pt.default.errors,(0,fe._)`${Pt.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=vo.mergeEvaluated.props(n,y.props,s.props));else{let _=n.var("props",(0,fe._)`${h}.evaluated.props`);s.props=vo.mergeEvaluated.props(n,_,s.props,fe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=vo.mergeEvaluated.items(n,y.items,s.items));else{let _=n.var("items",(0,fe._)`${h}.evaluated.items`);s.items=vo.mergeEvaluated.items(n,_,s.items,fe.Name)}}}ct.callRef=wo;ct.default=mg});var Sl=$(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var hg=_l(),gg=bl(),yg=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",hg.default,gg.default];Ts.default=yg});var xl=$(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var bo=R(),Je=bo.operators,So={maximum:{okStr:"<=",ok:Je.LTE,fail:Je.GT},minimum:{okStr:">=",ok:Je.GTE,fail:Je.LT},exclusiveMaximum:{okStr:"<",ok:Je.LT,fail:Je.GTE},exclusiveMinimum:{okStr:">",ok:Je.GT,fail:Je.LTE}},_g={message:({keyword:t,schemaCode:e})=>(0,bo.str)`must be ${So[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,bo._)`{comparison: ${So[t].okStr}, limit: ${e}}`},$g={keyword:Object.keys(So),type:"number",schemaType:"number",$data:!0,error:_g,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,bo._)`${r} ${So[e].fail} ${o} || isNaN(${r})`)}};Rs.default=$g});var El=$(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});var gr=R(),vg={message:({schemaCode:t})=>(0,gr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,gr._)`{multipleOf: ${t}}`},wg={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:vg,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,gr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,gr._)`${i} !== parseInt(${i})`;t.fail$data((0,gr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Is.default=wg});var zl=$(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});function kl(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}Cs.default=kl;kl.code='require("ajv/dist/runtime/ucs2length").default'});var Pl=$(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var lt=R(),bg=N(),Sg=zl(),xg={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,lt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,lt._)`{limit: ${t}}`},Eg={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xg,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?lt.operators.GT:lt.operators.LT,i=n.opts.unicode===!1?(0,lt._)`${r}.length`:(0,lt._)`${(0,bg.useFunc)(t.gen,Sg.default)}(${r})`;t.fail$data((0,lt._)`${i} ${s} ${o}`)}};Ms.default=Eg});var Tl=$(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});var kg=$e(),zg=N(),Tt=R(),Pg={message:({schemaCode:t})=>(0,Tt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Tt._)`{pattern: ${t}}`},Tg={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Pg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Tt._)`new RegExp`:(0,zg.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Tt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Tt._)`!${l}`)}else{let c=(0,kg.usePattern)(t,n);t.fail$data((0,Tt._)`!${c}.test(${r})`)}}};qs.default=Tg});var Rl=$(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});var yr=R(),Rg={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,yr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,yr._)`{limit: ${t}}`},Ig={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Rg,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?yr.operators.GT:yr.operators.LT;t.fail$data((0,yr._)`Object.keys(${r}).length ${n} ${o}`)}};Ns.default=Ig});var Il=$(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});var _r=$e(),$r=R(),Cg=N(),Mg={message:({params:{missingProperty:t}})=>(0,$r.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,$r._)`{missingProperty: ${t}}`},qg={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Mg,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(m?.[g]===void 0&&!h.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,Cg.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)t.block$data($r.nil,d);else for(let m of r)(0,_r.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let h=e.let("valid",!0);t.block$data(h,()=>p(m,h)),t.ok(h)}else e.if((0,_r.checkMissingProp)(t,r,m)),(0,_r.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,_r.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function p(m,h){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(h,(0,_r.propertyInData)(e,n,m,a.ownProperties)),e.if((0,$r.not)(h),()=>{t.error(),e.break()})},$r.nil)}}};js.default=qg});var Cl=$(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});var vr=R(),Ng={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,vr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,vr._)`{limit: ${t}}`},jg={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Ng,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?vr.operators.GT:vr.operators.LT;t.fail$data((0,vr._)`${r}.length ${n} ${o}`)}};Os.default=jg});var xo=$(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});var Ml=ts();Ml.code='require("ajv/dist/runtime/equal").default';As.default=Ml});var ql=$(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});var Ds=sr(),ee=R(),Og=N(),Ag=xo(),Dg={message:({params:{i:t,j:e}})=>(0,ee.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ee._)`{i: ${t}, j: ${e}}`},Zg={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Dg,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,Ds.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ee._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,ee._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,ee._)`${h} > 1`,()=>(d()?p:m)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let y=e.name("item"),_=(0,Ds.checkDataTypes)(u,y,a.opts.strictNumbers,Ds.DataType.Wrong),w=e.const("indices",(0,ee._)`{}`);e.for((0,ee._)`;${h}--;`,()=>{e.let(y,(0,ee._)`${r}[${h}]`),e.if(_,(0,ee._)`continue`),u.length>1&&e.if((0,ee._)`typeof ${y} == "string"`,(0,ee._)`${y} += "_"`),e.if((0,ee._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(g,(0,ee._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,ee._)`${w}[${y}] = ${h}`)})}function m(h,g){let y=(0,Og.useFunc)(e,Ag.default),_=e.name("outer");e.label(_).for((0,ee._)`;${h}--;`,()=>e.for((0,ee._)`${g} = ${h}; ${g}--;`,()=>e.if((0,ee._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};Zs.default=Zg});var Nl=$(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});var Ls=R(),Lg=N(),Fg=xo(),Hg={message:"must be equal to constant",params:({schemaCode:t})=>(0,Ls._)`{allowedValue: ${t}}`},Ug={keyword:"const",$data:!0,error:Hg,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,Ls._)`!${(0,Lg.useFunc)(e,Fg.default)}(${r}, ${n})`):t.fail((0,Ls._)`${s} !== ${r}`)}};Fs.default=Ug});var jl=$(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});var wr=R(),Vg=N(),Kg=xo(),Gg={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,wr._)`{allowedValues: ${t}}`},Bg={keyword:"enum",schemaType:"array",$data:!0,error:Gg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Vg.useFunc)(e,Kg.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,wr.or)(...n.map((h,g)=>p(m,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,wr._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function p(m,h){let g=n[h];return typeof g=="object"&&g!==null?(0,wr._)`${u()}(${r}, ${m}[${h}])`:(0,wr._)`${r} === ${g}`}}};Hs.default=Bg});var Ol=$(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});var Jg=xl(),Wg=El(),Xg=Pl(),Qg=Tl(),Yg=Rl(),ey=Il(),ty=Cl(),ry=ql(),oy=Nl(),ny=jl(),sy=[Jg.default,Wg.default,Xg.default,Qg.default,Yg.default,ey.default,ty.default,ry.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oy.default,ny.default];Us.default=sy});var Ks=$(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.validateAdditionalItems=void 0;var ut=R(),Vs=N(),iy={message:({params:{len:t}})=>(0,ut.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ut._)`{limit: ${t}}`},ay={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:iy,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,Vs.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Al(t,o)}};function Al(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,ut._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,ut._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,Vs.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,ut._)`${a} <= ${e.length}`);r.if((0,ut.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Vs.Type.Num},u),i.allErrors||r.if((0,ut.not)(u),()=>r.break())})}}br.validateAdditionalItems=Al;br.default=ay});var Gs=$(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.validateTuple=void 0;var Dl=R(),Eo=N(),cy=$e(),ly={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Zl(t,"additionalItems",e);r.items=!0,!(0,Eo.alwaysValidSchema)(r,e)&&t.ok((0,cy.validateArray)(t))}};function Zl(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Eo.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Dl._)`${s}.length`);r.forEach((d,p)=>{(0,Eo.alwaysValidSchema)(a,d)||(o.if((0,Dl._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Eo.checkStrictMode)(a,y,p.strictTuples)}}}Sr.validateTuple=Zl;Sr.default=ly});var Ll=$(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});var uy=Gs(),dy={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,uy.validateTuple)(t,"items")};Bs.default=dy});var Hl=$(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});var Fl=R(),fy=N(),py=$e(),my=Ks(),hy={message:({params:{len:t}})=>(0,Fl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fl._)`{limit: ${t}}`},gy={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hy,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,fy.alwaysValidSchema)(o,e)&&(n?(0,my.validateAdditionalItems)(t,n):t.ok((0,py.validateArray)(t)))}};Js.default=gy});var Ul=$(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});var we=R(),ko=N(),yy={message:({params:{min:t,max:e}})=>e===void 0?(0,we.str)`must contain at least ${t} valid item(s)`:(0,we.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,we._)`{minContains: ${t}}`:(0,we._)`{minContains: ${t}, maxContains: ${e}}`},_y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yy,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,we._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,ko.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ko.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ko.alwaysValidSchema)(s,r)){let g=(0,we._)`${l} >= ${i}`;a!==void 0&&(g=(0,we._)`${g} && ${l} <= ${a}`),t.pass(g);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,we._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>h(y)))}function m(g,y){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:ko.Type.Num,compositeRule:!0},g),y()})}function h(g){e.code((0,we._)`${g}++`),a===void 0?e.if((0,we._)`${g} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,we._)`${g} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,we._)`${g} >= ${i}`,()=>e.assign(d,!0)))}}};Ws.default=_y});var Gl=$(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.validateSchemaDeps=Ie.validatePropertyDeps=Ie.error=void 0;var Xs=R(),$y=N(),xr=$e();Ie.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Xs.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Xs._)`{property: ${t},
7
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,T._)`[${n}]`)}}}function Mp({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,T._)`${e} !== undefined`,()=>t.assign((0,T._)`${e}[${r}]`,o))}function Wn(t,e,r,o=St.Correct){let n=o===St.Correct?T.operators.EQ:T.operators.NEQ,s;switch(t){case"null":return(0,T._)`${e} ${n} null`;case"array":s=(0,T._)`Array.isArray(${e})`;break;case"object":s=(0,T._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,T._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,T._)`typeof ${e} ${n} ${t}`}return o===St.Correct?s:(0,T.not)(s);function i(a=T.nil){return(0,T.and)((0,T._)`typeof ${e} == "number"`,a,r?(0,T._)`isFinite(${e})`:T.nil)}}oe.checkDataType=Wn;function Xn(t,e,r,o){if(t.length===1)return Wn(t[0],e,r,o);let n,s=(0,rc.toHash)(t);if(s.array&&s.object){let i=(0,T._)`typeof ${e} != "object"`;n=s.null?i:(0,T._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=T.nil;s.number&&delete s.integer;for(let i in s)n=(0,T.and)(n,Wn(i,e,r,o));return n}oe.checkDataTypes=Xn;var qp={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,T._)`{type: ${t}}`:(0,T._)`{type: ${e}}`};function Qn(t){let e=Np(t);(0,Pp.reportError)(e,qp)}oe.reportTypeError=Qn;function Np(t){let{gen:e,data:r,schema:o}=t,n=(0,rc.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var ic=$(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.assignDefaults=void 0;var xt=R(),jp=N();function Op(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)sc(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>sc(t,s,n.default))}io.assignDefaults=Op;function sc(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,xt._)`${s}${(0,xt.getProperty)(e)}`;if(n){(0,jp.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,xt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,xt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,xt._)`${a} = ${(0,xt.stringify)(r)}`)}});var $e=$(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.validateUnion=Z.validateArray=Z.usePattern=Z.callValidateCode=Z.schemaProperties=Z.allSchemaProperties=Z.noPropertyInData=Z.propertyInData=Z.isOwnProperty=Z.hasPropFunc=Z.reportMissingProp=Z.checkMissingProp=Z.checkReportMissingProp=void 0;var H=R(),Yn=N(),Ve=Oe(),Ap=N();function Dp(t,e){let{gen:r,data:o,it:n}=t;r.if(ts(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,H._)`${e}`},!0),t.error()})}Z.checkReportMissingProp=Dp;function Zp({gen:t,data:e,it:{opts:r}},o,n){return(0,H.or)(...o.map(s=>(0,H.and)(ts(t,e,s,r.ownProperties),(0,H._)`${n} = ${s}`)))}Z.checkMissingProp=Zp;function Lp(t,e){t.setParams({missingProperty:e},!0),t.error()}Z.reportMissingProp=Lp;function ac(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,H._)`Object.prototype.hasOwnProperty`})}Z.hasPropFunc=ac;function es(t,e,r){return(0,H._)`${ac(t)}.call(${e}, ${r})`}Z.isOwnProperty=es;function Fp(t,e,r,o){let n=(0,H._)`${e}${(0,H.getProperty)(r)} !== undefined`;return o?(0,H._)`${n} && ${es(t,e,r)}`:n}Z.propertyInData=Fp;function ts(t,e,r,o){let n=(0,H._)`${e}${(0,H.getProperty)(r)} === undefined`;return o?(0,H.or)(n,(0,H.not)(es(t,e,r))):n}Z.noPropertyInData=ts;function cc(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Z.allSchemaProperties=cc;function Hp(t,e){return cc(e).filter(r=>!(0,Yn.alwaysValidSchema)(t,e[r]))}Z.schemaProperties=Hp;function Up({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,H._)`${t}, ${e}, ${o}${n}`:e,d=[[Ve.default.instancePath,(0,H.strConcat)(Ve.default.instancePath,s)],[Ve.default.parentData,i.parentData],[Ve.default.parentDataProperty,i.parentDataProperty],[Ve.default.rootData,Ve.default.rootData]];i.opts.dynamicRef&&d.push([Ve.default.dynamicAnchors,Ve.default.dynamicAnchors]);let p=(0,H._)`${l}, ${r.object(...d)}`;return c!==H.nil?(0,H._)`${a}.call(${c}, ${p})`:(0,H._)`${a}(${p})`}Z.callValidateCode=Up;var Vp=(0,H._)`new RegExp`;function Kp({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,H._)`${n.code==="new RegExp"?Vp:(0,Ap.useFunc)(t,n)}(${r}, ${o})`})}Z.usePattern=Kp;function Gp(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,H._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Yn.Type.Num},s),e.if((0,H.not)(s),a)})}}Z.validateArray=Gp;function Bp(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Yn.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,H._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,H.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}Z.validateUnion=Bp});var dc=$(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.validateKeywordUsage=Te.validSchemaType=Te.funcKeywordCode=Te.macroKeywordCode=void 0;var ae=R(),nt=Oe(),Jp=$e(),Wp=nr();function Xp(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=uc(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ae.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Te.macroKeywordCode=Xp;function Qp(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;em(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=uc(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&lc(t),y(()=>t.error());else{let _=e.async?m():h();e.modifying&&lc(t),y(()=>Yp(t,_))}}function m(){let _=o.let("ruleErrs",null);return o.try(()=>g((0,ae._)`await `),w=>o.assign(d,!1).if((0,ae._)`${w} instanceof ${c.ValidationError}`,()=>o.assign(_,(0,ae._)`${w}.errors`),()=>o.throw(w))),_}function h(){let _=(0,ae._)`${l}.errors`;return o.assign(_,null),g(ae.nil),_}function g(_=e.async?(0,ae._)`await `:ae.nil){let w=c.opts.passContext?nt.default.this:nt.default.self,E=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ae._)`${_}${(0,Jp.callValidateCode)(t,l,w,E)}`,e.modifying)}function y(_){var w;o.if((0,ae.not)((w=e.valid)!==null&&w!==void 0?w:d),_)}}Te.funcKeywordCode=Qp;function lc(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ae._)`${o.parentData}[${o.parentDataProperty}]`))}function Yp(t,e){let{gen:r}=t;r.if((0,ae._)`Array.isArray(${e})`,()=>{r.assign(nt.default.vErrors,(0,ae._)`${nt.default.vErrors} === null ? ${e} : ${nt.default.vErrors}.concat(${e})`).assign(nt.default.errors,(0,ae._)`${nt.default.vErrors}.length`),(0,Wp.extendErrors)(t)},()=>t.error())}function em({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function uc(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,ae.stringify)(r)})}function tm(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Te.validSchemaType=tm;function rm({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Te.validateKeywordUsage=rm});var pc=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.extendSubschemaMode=Ke.extendSubschemaData=Ke.getSubschema=void 0;var Re=R(),fc=N();function om(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Re._)`${t.schemaPath}${(0,Re.getProperty)(e)}${(0,Re.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,fc.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ke.getSubschema=om;function nm(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Re._)`${e.data}${(0,Re.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Re.str)`${u}${(0,fc.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Re._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Re.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ke.extendSubschemaData=nm;function sm(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Ke.extendSubschemaMode=sm});var rs=$((Mw,mc)=>{"use strict";mc.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 o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var gc=$((qw,hc)=>{"use strict";var Ge=hc.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};ao(e,o,n,t,"",t)};Ge.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ge.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ge.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ge.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 ao(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Ge.arrayKeywords)for(var p=0;p<d.length;p++)ao(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in Ge.propsKeywords){if(d&&typeof d=="object")for(var m in d)ao(t,e,r,d[m],n+"/"+l+"/"+im(m),s,n,l,o,m)}else(l in Ge.keywords||t.allKeys&&!(l in Ge.skipKeywords))&&ao(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function im(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var ir=$(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getSchemaRefs=ue.resolveUrl=ue.normalizeId=ue._getFullPath=ue.getFullPath=ue.inlineRef=void 0;var am=N(),cm=rs(),lm=gc(),um=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function dm(t,e=!0){return typeof t=="boolean"?!0:e===!0?!os(t):e?yc(t)<=e:!1}ue.inlineRef=dm;var fm=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function os(t){for(let e in t){if(fm.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(os)||typeof r=="object"&&os(r))return!0}return!1}function yc(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!um.has(r)&&(typeof t[r]=="object"&&(0,am.eachItem)(t[r],o=>e+=yc(o)),e===1/0))return 1/0}return e}function _c(t,e="",r){r!==!1&&(e=Et(e));let o=t.parse(e);return $c(t,o)}ue.getFullPath=_c;function $c(t,e){return t.serialize(e).split("#")[0]+"#"}ue._getFullPath=$c;var pm=/#\/?$/;function Et(t){return t?t.replace(pm,""):""}ue.normalizeId=Et;function mm(t,e,r){return r=Et(r),t.resolve(e,r)}ue.resolveUrl=mm;var hm=/^[a-z_][-a-z0-9._]*$/i;function gm(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Et(t[r]||e),s={"":n},i=_c(o,n,!1),a={},c=new Set;return lm(t,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;let g=i+p,y=s[h];typeof d[r]=="string"&&(y=_.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function _(E){let O=this.opts.uriResolver.resolve;if(E=Et(y?O(y,E):E),c.has(E))throw l(E);c.add(E);let P=this.refs[E];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,E):E!==Et(g)&&(E[0]==="#"?(u(d,a[E],E),a[E]=d):this.refs[E]=g),E}function w(E){if(typeof E=="string"){if(!hm.test(E))throw new Error(`invalid anchor "${E}"`);_.call(this,`#${E}`)}}}),a;function u(d,p,m){if(p!==void 0&&!cm(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ue.getSchemaRefs=gm});var lr=$(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.getData=Be.KeywordCxt=Be.validateFunctionCode=void 0;var xc=Ya(),vc=sr(),ss=Jn(),co=sr(),ym=ic(),cr=dc(),ns=pc(),x=R(),z=Oe(),_m=ir(),Ae=N(),ar=nr();function $m(t){if(zc(t)&&(Pc(t),kc(t))){bm(t);return}Ec(t,()=>(0,xc.topBoolOrEmptySchema)(t))}Be.validateFunctionCode=$m;function Ec({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${z.default.data}, ${z.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${wc(r,n)}`),wm(t,n),t.code(s)}):t.func(e,(0,x._)`${z.default.data}, ${vm(n)}`,o.$async,()=>t.code(wc(r,n)).code(s))}function vm(t){return(0,x._)`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${t.dynamicRef?(0,x._)`, ${z.default.dynamicAnchors}={}`:x.nil}}={}`}function wm(t,e){t.if(z.default.valCxt,()=>{t.var(z.default.instancePath,(0,x._)`${z.default.valCxt}.${z.default.instancePath}`),t.var(z.default.parentData,(0,x._)`${z.default.valCxt}.${z.default.parentData}`),t.var(z.default.parentDataProperty,(0,x._)`${z.default.valCxt}.${z.default.parentDataProperty}`),t.var(z.default.rootData,(0,x._)`${z.default.valCxt}.${z.default.rootData}`),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{t.var(z.default.instancePath,(0,x._)`""`),t.var(z.default.parentData,(0,x._)`undefined`),t.var(z.default.parentDataProperty,(0,x._)`undefined`),t.var(z.default.rootData,z.default.data),e.dynamicRef&&t.var(z.default.dynamicAnchors,(0,x._)`{}`)})}function bm(t){let{schema:e,opts:r,gen:o}=t;Ec(t,()=>{r.$comment&&e.$comment&&Rc(t),zm(t),o.let(z.default.vErrors,null),o.let(z.default.errors,0),r.unevaluated&&Sm(t),Tc(t),Rm(t)})}function Sm(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function wc(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function xm(t,e){if(zc(t)&&(Pc(t),kc(t))){Em(t,e);return}(0,xc.boolOrEmptySchema)(t,e)}function kc({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 zc(t){return typeof t.schema!="boolean"}function Em(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Rc(t),Pm(t),Tm(t);let s=o.const("_errs",z.default.errors);Tc(t,s),o.var(e,(0,x._)`${s} === ${z.default.errors}`)}function Pc(t){(0,Ae.checkUnknownRules)(t),km(t)}function Tc(t,e){if(t.opts.jtd)return bc(t,[],!1,e);let r=(0,vc.getSchemaTypes)(t.schema),o=(0,vc.coerceAndCheckDataType)(t,r);bc(t,r,!o,e)}function km(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Ae.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function zm(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ae.checkStrictMode)(t,"default is ignored in the schema root")}function Pm(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,_m.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Tm(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Rc({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${z.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Rm(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${z.default.errors} === 0`,()=>e.return(z.default.data),()=>e.throw((0,x._)`new ${n}(${z.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,z.default.vErrors),s.unevaluated&&Im(t),e.return((0,x._)`${z.default.errors} === 0`))}function Im({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function bc(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Ae.schemaHasRulesButRef)(s,l))){n.block(()=>Cc(t,"$ref",l.all.$ref.definition));return}c.jtd||Cm(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,ss.shouldUseGroup)(s,p)&&(p.type?(n.if((0,co.checkDataType)(p.type,i,c.strictNumbers)),Sc(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,co.reportTypeError)(t)),n.endIf()):Sc(t,p),a||n.if((0,x._)`${z.default.errors} === ${o||0}`))}}function Sc(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,ym.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,ss.shouldUseRule)(o,s)&&Cc(t,s.keyword,s.definition,e.type)})}function Cm(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Mm(t,e),t.opts.allowUnionTypes||qm(t,e),Nm(t,t.dataTypes))}function Mm(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Ic(t.dataTypes,r)||is(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Om(t,e)}}function qm(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&is(t,"use allowUnionTypes to allow union type keyword")}function Nm(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,ss.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>jm(e,i))&&is(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function jm(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Ic(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Om(t,e){let r=[];for(let o of t.dataTypes)Ic(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function is(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ae.checkStrictMode)(t,e,t.opts.strictTypes)}var lo=class{constructor(e,r,o){if((0,cr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ae.schemaRefOrVal)(e,this.schema,o,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",Mc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,cr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",z.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():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,x.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,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?ar.reportExtraError:ar.reportError)(this,this.def.error,r)}$dataError(){(0,ar.reportError)(this,this.def.$dataError||ar.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ar.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,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,co.checkDataTypes)(c,r,s.opts.strictNumbers,co.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,ns.getSubschema)(this.it,e);(0,ns.extendSubschemaData)(o,this.it,e),(0,ns.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return xm(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Ae.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Ae.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};Be.KeywordCxt=lo;function Cc(t,e,r,o){let n=new lo(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,cr.funcKeywordCode)(n,r):"macro"in r?(0,cr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,cr.funcKeywordCode)(n,r)}var Am=/^\/(?:[^~]|~0|~1)*$/,Dm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Mc(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return z.default.rootData;if(t[0]==="/"){if(!Am.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=z.default.rootData}else{let u=Dm.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,Ae.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Be.getData=Mc});var uo=$(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});var as=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};cs.default=as});var ur=$(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var ls=ir(),us=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,ls.resolveUrl)(e,r,o),this.missingSchema=(0,ls.normalizeId)((0,ls.getFullPath)(e,this.missingRef))}};ds.default=us});var po=$(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.resolveSchema=ve.getCompilingSchema=ve.resolveRef=ve.compileSchema=ve.SchemaEnv=void 0;var Se=R(),Zm=uo(),st=Oe(),xe=ir(),qc=N(),Lm=lr(),kt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=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,xe.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};ve.SchemaEnv=kt;function ps(t){let e=Nc.call(this,t);if(e)return e;let r=(0,xe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Se.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Zm.default,code:(0,Se._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:st.default.data,parentData:st.default.parentData,parentDataProperty:st.default.parentDataProperty,dataNames:[st.default.data],dataPathArr:[Se.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Se.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Se.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Se._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Lm.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(st.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${st.default.self}`,`${st.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:g}=u;m.evaluated={props:h instanceof Se.Name?void 0:h,items:g instanceof Se.Name?void 0:g,dynamicProps:h instanceof Se.Name,dynamicItems:g instanceof Se.Name},m.source&&(m.source.evaluated=(0,Se.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}ve.compileSchema=ps;function Fm(t,e,r){var o;r=(0,xe.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=Vm.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new kt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Hm.call(this,s)}ve.resolveRef=Fm;function Hm(t){return(0,xe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ps.call(this,t)}function Nc(t){for(let e of this._compilations)if(Um(e,t))return e}ve.getCompilingSchema=Nc;function Um(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Vm(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fo.call(this,t,e)}function fo(t,e){let r=this.opts.uriResolver.parse(e),o=(0,xe._getFullPath)(this.opts.uriResolver,r),n=(0,xe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return fs.call(this,r,t);let s=(0,xe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=fo.call(this,t,i);return typeof a?.schema!="object"?void 0:fs.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ps.call(this,i),s===(0,xe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,xe.resolveUrl)(this.opts.uriResolver,n,u)),new kt({schema:a,schemaId:c,root:t,baseId:n})}return fs.call(this,r,i)}}ve.resolveSchema=fo;var Km=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fs(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,qc.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Km.has(a)&&u&&(e=(0,xe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,qc.schemaHasRulesButRef)(r,this.RULES)){let a=(0,xe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=fo.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new kt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var jc=$((Zw,Gm)=>{Gm.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 $s=$((Lw,Hc)=>{"use strict";var Bm=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),hs=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),Jm=RegExp.prototype.test.bind(/^\d*$/u),it=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),gs=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ac=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ys=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Wm=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),de=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)de[e]="%"+t[e>>4]+t[e&15]}function ne(t){return t<2048?de[192|t>>6]+de[128|t&63]:t<65536?de[224|t>>12]+de[128|t>>6&63]+de[128|t&63]:de[240|t>>18]+de[128|t>>12&63]+de[128|t>>6&63]+de[128|t&63]}function Xm(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Qm=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Ym=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),eh=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),th=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rh(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!eh(t[e])){if(t[e]==="%"&&e+2<t.length&&it(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function Oc(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),i=t.slice(e+r).join(":");return s+"::"+i}function oh(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!hs(c))return;s+=2;continue}if(!Qm(c))return;n[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:Oc(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return Oc(i)}function ms(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&Ym(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(nh(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!rh(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=oh(o);return i===void 0?{host:t,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function nh(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function sh(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var ih={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ah=/[@/?#:]/g,ch=/[@/?#]/g;function Dc(t,e){let r=e?ch:ah;return r.lastIndex=0,t.replace(r,o=>ih[o])}function Zc(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&gs(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function lh(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&gs(i)?e+=i:e+="%"+s,r+=2;continue}}if(Ac(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Fc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function uh(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let s=t[n];if(s==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(it(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),Ac(s)&&(s!==":"||!o))r+=s;else{let i=t.charCodeAt(n);if(i<128)r+=de[i];else if(i<55296||i>57343)r+=ne(i);else if(i<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ne(65536+(i-55296<<10)+(a-56320)),n++):r+=ne(65533)}else r+=ne(65533)}}return r}function _s(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let s=t.slice(o+1,o+3);if(it(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let s=t.charCodeAt(o);if(s<128)r+=de[s];else if(s<55296||s>57343)r+=ne(s);else if(s<=56319&&o+1<t.length){let i=t.charCodeAt(o+1);i>=56320&&i<=57343?(r+=ne(65536+(s-55296<<10)+(i-56320)),o++):r+=ne(65533)}else r+=ne(65533)}}return r}function Lc(t){return _s(t,Wm)}function dh(t){return _s(t,ys)}function fh(t){return _s(t,ys)}function Fc(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function ph(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(it(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));gs(i)?e+=i:e+="%"+s,r+=2;continue}}if(ys(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Fc(n)?o:de[n];else if(n<55296||n>57343)e+=ne(n);else if(n<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=ne(65536+(n-55296<<10)+(s-56320)),r++):e+=ne(65533)}else e+=ne(65533)}}return e}function mh(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(it(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function hh(t){let e=[];if(t.userinfo!==void 0&&(e.push(Lc(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!hs(r)){let o=ms(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Zc(r,!0),o=ms(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=Dc(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!Jm(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}Hc.exports={nonSimpleDomain:th,recomposeAuthority:hh,reescapeHostDelimiters:Dc,normalizePercentEncoding:Zc,normalizePathEncoding:lh,serializePathEncoding:uh,normalizeQueryFragmentEncoding:ph,encodeUserinfo:Lc,encodeQuery:dh,encodeFragment:fh,escapePreservingEscapes:mh,removeDotSegments:sh,isIPv4:hs,isUUID:Bm,normalizeIPv6:ms,stringArrayToHexStripped:Xm}});var Bc=$((Fw,Gc)=>{"use strict";var{isUUID:gh}=$s(),yh=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,_h=["http","https","ws","wss","urn","urn:uuid"];function $h(t){return _h.indexOf(t)!==-1}function vs(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 Uc(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Vc(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 vh(t){return t.secure=vs(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function wh(t){if((t.port===(vs(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=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function bh(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(yh);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=ws(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Sh(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=ws(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function xh(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!gh(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Eh(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Kc={scheme:"http",domainHost:!0,parse:Uc,serialize:Vc},kh={scheme:"https",domainHost:Kc.domainHost,parse:Uc,serialize:Vc},mo={scheme:"ws",domainHost:!0,parse:vh,serialize:wh},zh={scheme:"wss",domainHost:mo.domainHost,parse:mo.parse,serialize:mo.serialize},Ph={scheme:"urn",parse:bh,serialize:Sh,skipNormalize:!0},Th={scheme:"urn:uuid",parse:xh,serialize:Eh,skipNormalize:!0},ho={http:Kc,https:kh,ws:mo,wss:zh,urn:Ph,"urn:uuid":Th};Object.setPrototypeOf(ho,null);function ws(t){return t&&(ho[t]||ho[t.toLowerCase()])||void 0}Gc.exports={wsIsSecure:vs,SCHEMES:ho,isValidSchemeName:$h,getSchemeHandler:ws}});var al=$((Hw,_o)=>{"use strict";var{normalizeIPv6:Yc,removeDotSegments:fr,recomposeAuthority:Rh,normalizePercentEncoding:bs,normalizePathEncoding:Ih,serializePathEncoding:Jc,normalizeQueryFragmentEncoding:Wc,encodeQuery:Ch,encodeFragment:Mh,reescapeHostDelimiters:qh,isIPv4:el,nonSimpleDomain:Nh}=$s(),{SCHEMES:tl,getSchemeHandler:Ss}=Bc(),rl=/^[A-Za-z][A-Za-z0-9+.-]*$/u,ol="URI scheme is malformed.";function Xc(t){let e=unescape(String(t));if(!rl.test(e))throw new TypeError(ol);return e}function jh(t,e){return typeof t=="string"?t=Uh(t,e):typeof t=="object"&&(t=yo(at(t,e),e)),t}function Oh(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=go(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=go(e,o);if(s||d||i||p||a||m||c||h||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=nl(n,l,o,!0),_=Ss(r&&r.scheme||y.scheme),w=y.host,E=w!==void 0&&w!==""&&(el(w)||Yc(w).isIPV6);sl(y,r||{},_,E);let O=w&&w.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(w);if(y.error&&!O)throw new Error(y.error);return o.skipEscape=!0,at(y,o)}function nl(t,e,r,o){let n={};return o||(t=yo(at(t,r),r),e=yo(at(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=fr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=fr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=fr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=fr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Ah(t,e,r){let o=Qc(t,r),n=Qc(e,r);return o!==void 0&&n!==void 0&&o===n}function at(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:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=Xc(r.scheme));let s=Ss(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(o.skipEscape?r.path=bs(r.path):r.path=Jc(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Xc(r.scheme),n.push(r.scheme,":"));let c=Rh(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(u=fr(u)),a&&(u=Jc(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",Ch(r.query)),r.fragment!==void 0&&n.push("#",Mh(r.fragment)),n.join("")}var Dh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Zh=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Lh=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Fh(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function dr(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function xs(t){return t[0]==="["&&t[t.length-1]==="]"}function Hh(t){let e=t[4];return dr(t[3])||e!==void 0&&!xs(e)&&dr(e)||dr(t[6])||dr(t[7])||dr(t[8])}function sl(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!xs(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&Nh(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function go(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(Zh);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let p=t.match(Lh);if(p!==null){let h=p[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):h.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let m=t.match(Dh);if(m){if(o.scheme=m[1],o.userinfo=m[3],o.host=m[4],o.port=parseInt(m[5],10),o.path=m[6]||"",o.query=m[7],o.fragment=m[8],o.scheme!==void 0){let y=unescape(o.scheme);rl.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||ol,u=!0)}s=Hh(m),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=m[5]);let h=Fh(o,m);if(h!==void 0&&(o.error=o.error||h,n=!0),o.host)if(el(o.host)===!1){let _=xs(o.host),w=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,E=Yc(o.host);l=E.isIPV6||E.isIPVFuture===!0,c=w&&(!_||E.error===!0),o.host=l?E.host:E.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=Ss(r.scheme||o.scheme);if(c||(a=sl(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:bs(o.host,!0);l||(y=bs(y.toLowerCase())),o.host=qh(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=Ih(o.path)),o.query&&(o.query=Wc(o.query)),o.fragment&&(o.fragment=Wc(o.fragment))),g&&g.parse&&(g.parse(o,r),g===tl.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function yo(t,e){return go(t,e).parsed}function Uh(t,e){return il(t,e).normalized}function il(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=go(t,e);return{normalized:o||n||s||i||a?t:at(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Qc(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:at(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=il(r,e);return n||s||i||a||c?void 0:o}var Es={SCHEMES:tl,normalize:jh,resolve:Oh,resolveComponent:nl,equal:Ah,serialize:at,parse:yo};_o.exports=Es;_o.exports.default=Es;_o.exports.fastUri=Es});var ll=$(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});var cl=al();cl.code='require("ajv/dist/runtime/uri").default';ks.default=cl});var yl=$(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=void 0;var Vh=lr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return Vh.KeywordCxt}});var zt=R();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return zt._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return zt.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return zt.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return zt.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return zt.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return zt.CodeGen}});var Kh=uo(),ml=ur(),Gh=Bn(),pr=po(),Bh=R(),mr=ir(),$o=sr(),Ps=N(),ul=jc(),Jh=ll(),hl=(t,e)=>new RegExp(t,e);hl.code="new RegExp";var Wh=["removeAdditional","useDefaults","coerceTypes"],Xh=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Qh={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."},Yh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dl=200;function eg(t){var e,r,o,n,s,i,a,c,u,l,d,p,m,h,g,y,_,w,E,O,P,ze,qe,Uo,Vo;let jt=t.strict,Ko=(e=t.code)===null||e===void 0?void 0:e.optimize,Ii=Ko===!0||Ko===void 0?1:Ko||0,Ci=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:hl,Yu=(n=t.uriResolver)!==null&&n!==void 0?n:Jh.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:jt)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:jt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:jt)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:jt)!==null&&p!==void 0?p:"log",strictRequired:(h=(m=t.strictRequired)!==null&&m!==void 0?m:jt)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:Ii,regExp:Ci}:{optimize:Ii,regExp:Ci},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:dl,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:dl,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(E=t.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(ze=t.validateSchema)!==null&&ze!==void 0?ze:!0,validateFormats:(qe=t.validateFormats)!==null&&qe!==void 0?qe:!0,unicodeRegExp:(Uo=t.unicodeRegExp)!==null&&Uo!==void 0?Uo:!0,int32range:(Vo=t.int32range)!==null&&Vo!==void 0?Vo:!0,uriResolver:Yu}}var hr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...eg(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Bh.ValueScope({scope:{},prefixes:Xh,es5:r,lines:o}),this.logger=ig(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Gh.getRules)(),fl.call(this,Qh,e,"NOT SUPPORTED"),fl.call(this,Yh,e,"DEPRECATED","warn"),this._metaOpts=ng.call(this),e.formats&&rg.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&og.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),tg.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=ul;o==="id"&&(n={...ul},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!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 o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ml.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,mr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=pl.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new pr.SchemaEnv({schema:{},schemaId:o});if(r=pr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=pl.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 o=e[this.opts.schemaId];return o&&(o=(0,mr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),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 o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(cg.call(this,o,r),!r)return(0,Ps.eachItem)(o,s=>zs.call(this,s)),this;ug.call(this,r);let n={...r,type:(0,$o.getJSONTypes)(r.type),schemaType:(0,$o.getJSONTypes)(r.schemaType)};return(0,Ps.eachItem)(o,n.type.length===0?s=>zs.call(this,s,n):s=>n.type.forEach(i=>zs.call(this,s,n,i))),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 o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=gl(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,mr.normalizeId)(i||o);let u=mr.getSchemaRefs.call(this,e,o);return c=new pr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):pr.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{pr.compileSchema.call(this,e)}finally{this.opts=r}}};hr.ValidationError=Kh.default;hr.MissingRefError=ml.default;Y.default=hr;function fl(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function pl(t){return t=(0,mr.normalizeId)(t),this.schemas[t]||this.refs[t]}function tg(){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 rg(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function og(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 ng(){let t={...this.opts};for(let e of Wh)delete t[e];return t}var sg={log(){},warn(){},error(){}};function ig(t){if(t===!1)return sg;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 ag=/^[a-z_$][a-z0-9_$:-]*$/i;function cg(t,e){let{RULES:r}=this;if((0,Ps.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!ag.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function zs(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,$o.getJSONTypes)(e.type),schemaType:(0,$o.getJSONTypes)(e.schemaType)}};e.before?lg.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function lg(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function ug(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=gl(e)),t.validateSchema=this.compile(e,!0))}var dg={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function gl(t){return{anyOf:[t,dg]}}});var _l=$(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var fg={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ts.default=fg});var bl=$(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.callRef=ct.getValidate=void 0;var pg=ur(),$l=$e(),fe=R(),Pt=Oe(),vl=po(),vo=N(),mg={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=vl.resolveRef.call(c,u,n,r);if(l===void 0)throw new pg.default(o.opts.uriResolver,n,r);if(l instanceof vl.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return wo(t,i,s,s.$async);let h=e.scopeValue("root",{ref:u});return wo(t,(0,fe._)`${h}.validate`,u,u.$async)}function p(h){let g=wl(t,h);wo(t,g,h,h.$async)}function m(h){let g=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,fe.stringify)(h)}:{ref:h}),y=e.name("valid"),_=t.subschema({schema:h,dataTypes:[],schemaPath:fe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function wl(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}ct.getValidate=wl;function wo(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Pt.default.this:fe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,fe._)`await ${(0,$l.callValidateCode)(t,e,u)}`),m(e),i||n.assign(h,!0)},g=>{n.if((0,fe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),p(g),i||n.assign(h,!1)}),t.ok(h)}function d(){t.result((0,$l.callValidateCode)(t,e,u),()=>m(e),()=>p(e))}function p(h){let g=(0,fe._)`${h}.errors`;n.assign(Pt.default.vErrors,(0,fe._)`${Pt.default.vErrors} === null ? ${g} : ${Pt.default.vErrors}.concat(${g})`),n.assign(Pt.default.errors,(0,fe._)`${Pt.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=vo.mergeEvaluated.props(n,y.props,s.props));else{let _=n.var("props",(0,fe._)`${h}.evaluated.props`);s.props=vo.mergeEvaluated.props(n,_,s.props,fe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=vo.mergeEvaluated.items(n,y.items,s.items));else{let _=n.var("items",(0,fe._)`${h}.evaluated.items`);s.items=vo.mergeEvaluated.items(n,_,s.items,fe.Name)}}}ct.callRef=wo;ct.default=mg});var Sl=$(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var hg=_l(),gg=bl(),yg=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",hg.default,gg.default];Rs.default=yg});var xl=$(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});var bo=R(),Je=bo.operators,So={maximum:{okStr:"<=",ok:Je.LTE,fail:Je.GT},minimum:{okStr:">=",ok:Je.GTE,fail:Je.LT},exclusiveMaximum:{okStr:"<",ok:Je.LT,fail:Je.GTE},exclusiveMinimum:{okStr:">",ok:Je.GT,fail:Je.LTE}},_g={message:({keyword:t,schemaCode:e})=>(0,bo.str)`must be ${So[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,bo._)`{comparison: ${So[t].okStr}, limit: ${e}}`},$g={keyword:Object.keys(So),type:"number",schemaType:"number",$data:!0,error:_g,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,bo._)`${r} ${So[e].fail} ${o} || isNaN(${r})`)}};Is.default=$g});var El=$(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});var gr=R(),vg={message:({schemaCode:t})=>(0,gr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,gr._)`{multipleOf: ${t}}`},wg={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:vg,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,gr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,gr._)`${i} !== parseInt(${i})`;t.fail$data((0,gr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Cs.default=wg});var zl=$(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});function kl(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}Ms.default=kl;kl.code='require("ajv/dist/runtime/ucs2length").default'});var Pl=$(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});var lt=R(),bg=N(),Sg=zl(),xg={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,lt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,lt._)`{limit: ${t}}`},Eg={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xg,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?lt.operators.GT:lt.operators.LT,i=n.opts.unicode===!1?(0,lt._)`${r}.length`:(0,lt._)`${(0,bg.useFunc)(t.gen,Sg.default)}(${r})`;t.fail$data((0,lt._)`${i} ${s} ${o}`)}};qs.default=Eg});var Tl=$(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});var kg=$e(),zg=N(),Tt=R(),Pg={message:({schemaCode:t})=>(0,Tt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Tt._)`{pattern: ${t}}`},Tg={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Pg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Tt._)`new RegExp`:(0,zg.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Tt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Tt._)`!${l}`)}else{let c=(0,kg.usePattern)(t,n);t.fail$data((0,Tt._)`!${c}.test(${r})`)}}};Ns.default=Tg});var Rl=$(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});var yr=R(),Rg={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,yr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,yr._)`{limit: ${t}}`},Ig={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Rg,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?yr.operators.GT:yr.operators.LT;t.fail$data((0,yr._)`Object.keys(${r}).length ${n} ${o}`)}};js.default=Ig});var Il=$(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});var _r=$e(),$r=R(),Cg=N(),Mg={message:({params:{missingProperty:t}})=>(0,$r.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,$r._)`{missingProperty: ${t}}`},qg={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Mg,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(m?.[g]===void 0&&!h.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,Cg.checkStrictMode)(i,_,i.opts.strictRequired)}}function u(){if(c||s)t.block$data($r.nil,d);else for(let m of r)(0,_r.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let h=e.let("valid",!0);t.block$data(h,()=>p(m,h)),t.ok(h)}else e.if((0,_r.checkMissingProp)(t,r,m)),(0,_r.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,_r.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function p(m,h){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(h,(0,_r.propertyInData)(e,n,m,a.ownProperties)),e.if((0,$r.not)(h),()=>{t.error(),e.break()})},$r.nil)}}};Os.default=qg});var Cl=$(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});var vr=R(),Ng={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,vr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,vr._)`{limit: ${t}}`},jg={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Ng,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?vr.operators.GT:vr.operators.LT;t.fail$data((0,vr._)`${r}.length ${n} ${o}`)}};As.default=jg});var xo=$(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});var Ml=rs();Ml.code='require("ajv/dist/runtime/equal").default';Ds.default=Ml});var ql=$(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});var Zs=sr(),ee=R(),Og=N(),Ag=xo(),Dg={message:({params:{i:t,j:e}})=>(0,ee.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ee._)`{i: ${t}, j: ${e}}`},Zg={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Dg,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,Zs.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ee._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,ee._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,ee._)`${h} > 1`,()=>(d()?p:m)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let y=e.name("item"),_=(0,Zs.checkDataTypes)(u,y,a.opts.strictNumbers,Zs.DataType.Wrong),w=e.const("indices",(0,ee._)`{}`);e.for((0,ee._)`;${h}--;`,()=>{e.let(y,(0,ee._)`${r}[${h}]`),e.if(_,(0,ee._)`continue`),u.length>1&&e.if((0,ee._)`typeof ${y} == "string"`,(0,ee._)`${y} += "_"`),e.if((0,ee._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(g,(0,ee._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,ee._)`${w}[${y}] = ${h}`)})}function m(h,g){let y=(0,Og.useFunc)(e,Ag.default),_=e.name("outer");e.label(_).for((0,ee._)`;${h}--;`,()=>e.for((0,ee._)`${g} = ${h}; ${g}--;`,()=>e.if((0,ee._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};Ls.default=Zg});var Nl=$(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});var Fs=R(),Lg=N(),Fg=xo(),Hg={message:"must be equal to constant",params:({schemaCode:t})=>(0,Fs._)`{allowedValue: ${t}}`},Ug={keyword:"const",$data:!0,error:Hg,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,Fs._)`!${(0,Lg.useFunc)(e,Fg.default)}(${r}, ${n})`):t.fail((0,Fs._)`${s} !== ${r}`)}};Hs.default=Ug});var jl=$(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});var wr=R(),Vg=N(),Kg=xo(),Gg={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,wr._)`{allowedValues: ${t}}`},Bg={keyword:"enum",schemaType:"array",$data:!0,error:Gg,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Vg.useFunc)(e,Kg.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,wr.or)(...n.map((h,g)=>p(m,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,wr._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function p(m,h){let g=n[h];return typeof g=="object"&&g!==null?(0,wr._)`${u()}(${r}, ${m}[${h}])`:(0,wr._)`${r} === ${g}`}}};Us.default=Bg});var Ol=$(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});var Jg=xl(),Wg=El(),Xg=Pl(),Qg=Tl(),Yg=Rl(),ey=Il(),ty=Cl(),ry=ql(),oy=Nl(),ny=jl(),sy=[Jg.default,Wg.default,Xg.default,Qg.default,Yg.default,ey.default,ty.default,ry.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oy.default,ny.default];Vs.default=sy});var Gs=$(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.validateAdditionalItems=void 0;var ut=R(),Ks=N(),iy={message:({params:{len:t}})=>(0,ut.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ut._)`{limit: ${t}}`},ay={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:iy,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,Ks.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Al(t,o)}};function Al(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,ut._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,ut._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,Ks.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,ut._)`${a} <= ${e.length}`);r.if((0,ut.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Ks.Type.Num},u),i.allErrors||r.if((0,ut.not)(u),()=>r.break())})}}br.validateAdditionalItems=Al;br.default=ay});var Bs=$(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.validateTuple=void 0;var Dl=R(),Eo=N(),cy=$e(),ly={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Zl(t,"additionalItems",e);r.items=!0,!(0,Eo.alwaysValidSchema)(r,e)&&t.ok((0,cy.validateArray)(t))}};function Zl(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Eo.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Dl._)`${s}.length`);r.forEach((d,p)=>{(0,Eo.alwaysValidSchema)(a,d)||(o.if((0,Dl._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Eo.checkStrictMode)(a,y,p.strictTuples)}}}Sr.validateTuple=Zl;Sr.default=ly});var Ll=$(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});var uy=Bs(),dy={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,uy.validateTuple)(t,"items")};Js.default=dy});var Hl=$(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});var Fl=R(),fy=N(),py=$e(),my=Gs(),hy={message:({params:{len:t}})=>(0,Fl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fl._)`{limit: ${t}}`},gy={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hy,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,fy.alwaysValidSchema)(o,e)&&(n?(0,my.validateAdditionalItems)(t,n):t.ok((0,py.validateArray)(t)))}};Ws.default=gy});var Ul=$(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});var we=R(),ko=N(),yy={message:({params:{min:t,max:e}})=>e===void 0?(0,we.str)`must contain at least ${t} valid item(s)`:(0,we.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,we._)`{minContains: ${t}}`:(0,we._)`{minContains: ${t}, maxContains: ${e}}`},_y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yy,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,we._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,ko.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ko.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ko.alwaysValidSchema)(s,r)){let g=(0,we._)`${l} >= ${i}`;a!==void 0&&(g=(0,we._)`${g} && ${l} <= ${a}`),t.pass(g);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,we._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>h(y)))}function m(g,y){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:ko.Type.Num,compositeRule:!0},g),y()})}function h(g){e.code((0,we._)`${g}++`),a===void 0?e.if((0,we._)`${g} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,we._)`${g} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,we._)`${g} >= ${i}`,()=>e.assign(d,!0)))}}};Xs.default=_y});var Gl=$(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.validateSchemaDeps=Ie.validatePropertyDeps=Ie.error=void 0;var Qs=R(),$y=N(),xr=$e();Ie.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Qs.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Qs._)`{property: ${t},
8
8
  missingProperty: ${o},
9
9
  depsCount: ${e},
10
- deps: ${r}}`};var vy={keyword:"dependencies",type:"object",schemaType:"object",error:Ie.error,code(t){let[e,r]=wy(t);Vl(t,e),Kl(t,r)}};function wy({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function Vl(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,xr.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,xr.checkReportMissingProp)(t,u)}):(r.if((0,Xs._)`${c} && (${(0,xr.checkMissingProp)(t,a,s)})`),(0,xr.reportMissingProp)(t,s),r.else())}}Ie.validatePropertyDeps=Vl;function Kl(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,$y.alwaysValidSchema)(s,e[a])||(r.if((0,xr.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ie.validateSchemaDeps=Kl;Ie.default=vy});var Jl=$(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});var Bl=R(),by=N(),Sy={message:"property name must be valid",params:({params:t})=>(0,Bl._)`{propertyName: ${t.propertyName}}`},xy={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Sy,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,by.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Bl.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};Qs.default=xy});var ei=$(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});var zo=$e(),Ee=R(),Ey=Oe(),Po=N(),ky={message:"must NOT have additional properties",params:({params:t})=>(0,Ee._)`{additionalProperty: ${t.additionalProperty}}`},zy={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ky,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Po.alwaysValidSchema)(i,r))return;let u=(0,zo.allSchemaProperties)(o.properties),l=(0,zo.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Ee._)`${s} === ${Ey.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let w=(0,Po.schemaRefOrVal)(i,o.properties,"properties");_=(0,zo.isOwnProperty)(e,w,y)}else u.length?_=(0,Ee.or)(...u.map(w=>(0,Ee._)`${y} === ${w}`)):_=Ee.nil;return l.length&&(_=(0,Ee.or)(_,...l.map(w=>(0,Ee._)`${(0,zo.usePattern)(t,w)}.test(${y})`))),(0,Ee.not)(_)}function m(y){e.code((0,Ee._)`delete ${n}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Po.alwaysValidSchema)(i,r)){let _=e.name("valid");c.removeAdditional==="failing"?(g(y,_,!1),e.if((0,Ee.not)(_),()=>{t.reset(),m(y)})):(g(y,_),a||e.if((0,Ee.not)(_),()=>e.break()))}}function g(y,_,w){let E={keyword:"additionalProperties",dataProp:y,dataPropType:Po.Type.Str};w===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(E,_)}}};Ys.default=zy});var Ql=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});var Py=lr(),Wl=$e(),ti=N(),Xl=ei(),Ty={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Xl.default.code(new Py.KeywordCxt(s,Xl.default,"additionalProperties"));let i=(0,Wl.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ti.mergeEvaluated.props(e,(0,ti.toHash)(i),s.props));let a=i.filter(d=>!(0,ti.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Wl.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ri.default=Ty});var ru=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});var Yl=$e(),To=R(),eu=N(),tu=N(),Ry={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,Yl.allSchemaProperties)(r),c=a.filter(g=>(0,eu.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof To.Name)&&(s.props=(0,tu.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let g of a)u&&m(g),s.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function m(g){for(let y in u)new RegExp(g).test(y)&&(0,eu.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",o,y=>{e.if((0,To._)`${(0,Yl.usePattern)(t,g)}.test(${y})`,()=>{let _=c.includes(g);_||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:tu.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,To._)`${d}[${y}]`,!0):!_&&!s.allErrors&&e.if((0,To.not)(l),()=>e.break())})})}}};oi.default=Ry});var ou=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});var Iy=N(),Cy={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,Iy.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ni.default=Cy});var nu=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});var My=$e(),qy={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:My.validateUnion,error:{message:"must match a schema in anyOf"}};si.default=qy});var su=$(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});var Ro=R(),Ny=N(),jy={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ro._)`{passingSchemas: ${t.passing}}`},Oy={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:jy,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,Ny.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Ro._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ro._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Ro.Name)})})}}};ii.default=Oy});var iu=$(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var Ay=N(),Dy={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,Ay.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};ai.default=Dy});var lu=$(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});var Io=R(),cu=N(),Zy={message:({params:t})=>(0,Io.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Io._)`{failingKeyword: ${t.ifClause}}`},Ly={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Zy,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,cu.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=au(o,"then"),s=au(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,Io.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Io._)`${l}`):t.setParams({ifClause:l})}}}};function au(t,e){let r=t.schema[e];return r!==void 0&&!(0,cu.alwaysValidSchema)(t,r)}ci.default=Ly});var uu=$(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var Fy=N(),Hy={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Fy.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};li.default=Hy});var du=$(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});var Uy=Ks(),Vy=Ll(),Ky=Gs(),Gy=Hl(),By=Ul(),Jy=Gl(),Wy=Jl(),Xy=ei(),Qy=Ql(),Yy=ru(),e_=ou(),t_=nu(),r_=su(),o_=iu(),n_=lu(),s_=uu();function i_(t=!1){let e=[e_.default,t_.default,r_.default,o_.default,n_.default,s_.default,Wy.default,Xy.default,Jy.default,Qy.default,Yy.default];return t?e.push(Vy.default,Gy.default):e.push(Uy.default,Ky.default),e.push(By.default),e}ui.default=i_});var fu=$(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});var B=R(),a_={message:({schemaCode:t})=>(0,B.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,B._)`{format: ${t}}`},c_={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:a_,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():m();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,B._)`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if((0,B._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,B._)`${g}.type || "string"`).assign(_,(0,B._)`${g}.validate`),()=>r.assign(y,(0,B._)`"string"`).assign(_,g)),t.fail$data((0,B.or)(w(),E()));function w(){return c.strictSchema===!1?B.nil:(0,B._)`${i} && !${_}`}function E(){let O=l.$async?(0,B._)`(${g}.async ? await ${_}(${o}) : ${_}(${o}))`:(0,B._)`${_}(${o})`,P=(0,B._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${o}))`;return(0,B._)`${_} && ${_} !== true && ${y} === ${e} && !${P}`}}function m(){let h=d.formats[s];if(!h){w();return}if(h===!0)return;let[g,y,_]=E(h);g===e&&t.pass(O());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function E(P){let ze=P instanceof RegExp?(0,B.regexpCode)(P):c.code.formats?(0,B._)`${c.code.formats}${(0,B.getProperty)(s)}`:void 0,qe=r.scopeValue("formats",{key:s,ref:P,code:ze});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,B._)`${qe}.validate`]:["string",P,qe]}function O(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,B._)`await ${_}(${o})`}return typeof y=="function"?(0,B._)`${_}(${o})`:(0,B._)`${_}.test(${o})`}}}};di.default=c_});var pu=$(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});var l_=fu(),u_=[l_.default];fi.default=u_});var mu=$(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.contentVocabulary=Rt.metadataVocabulary=void 0;Rt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Rt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gu=$(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});var d_=Sl(),f_=Ol(),p_=du(),m_=pu(),hu=mu(),h_=[d_.default,f_.default,(0,p_.default)(),m_.default,hu.metadataVocabulary,hu.contentVocabulary];pi.default=h_});var _u=$(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.DiscrError=void 0;var yu;(function(t){t.Tag="tag",t.Mapping="mapping"})(yu||(Co.DiscrError=yu={}))});var vu=$(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});var It=R(),mi=_u(),$u=po(),g_=ur(),y_=N(),__={message:({params:{discrError:t,tagName:e}})=>t===mi.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,It._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},$_={keyword:"discriminator",type:"object",schemaType:"object",error:__,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,It._)`${r}${(0,It.getProperty)(a)}`);e.if((0,It._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:mi.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=p();e.if(!1);for(let h in m)e.elseIf((0,It._)`${u} === ${h}`),e.assign(c,d(m[h]));e.else(),t.error(!1,{discrError:mi.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},h);return t.mergeEvaluated(g,It.Name),h}function p(){var m;let h={},g=_(n),y=!0;for(let O=0;O<i.length;O++){let P=i[O];if(P?.$ref&&!(0,y_.schemaHasRulesButRef)(P,s.self.RULES)){let qe=P.$ref;if(P=$u.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,qe),P instanceof $u.SchemaEnv&&(P=P.schema),P===void 0)throw new g_.default(s.opts.uriResolver,s.baseId,qe)}let ze=(m=P?.properties)===null||m===void 0?void 0:m[a];if(typeof ze!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||_(P)),w(ze,O)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:O}){return Array.isArray(O)&&O.includes(a)}function w(O,P){if(O.const)E(O.const,P);else if(O.enum)for(let ze of O.enum)E(ze,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function E(O,P){if(typeof O!="string"||O in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[O]=P}}}};hi.default=$_});var wu=$((Ib,v_)=>{v_.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 yi=$((U,gi)=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.MissingRefError=U.ValidationError=U.CodeGen=U.Name=U.nil=U.stringify=U.str=U._=U.KeywordCxt=U.Ajv=void 0;var w_=yl(),b_=gu(),S_=vu(),bu=wu(),x_=["/properties"],Mo="http://json-schema.org/draft-07/schema",Ct=class extends w_.default{_addVocabularies(){super._addVocabularies(),b_.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(S_.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(bu,x_):bu;this.addMetaSchema(e,Mo,!1),this.refs["http://json-schema.org/schema"]=Mo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Mo)?Mo:void 0)}};U.Ajv=Ct;gi.exports=U=Ct;gi.exports.Ajv=Ct;Object.defineProperty(U,"__esModule",{value:!0});U.default=Ct;var E_=lr();Object.defineProperty(U,"KeywordCxt",{enumerable:!0,get:function(){return E_.KeywordCxt}});var Mt=R();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return Mt._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return Mt.str}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return Mt.stringify}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return Mt.nil}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return Mt.Name}});Object.defineProperty(U,"CodeGen",{enumerable:!0,get:function(){return Mt.CodeGen}});var k_=uo();Object.defineProperty(U,"ValidationError",{enumerable:!0,get:function(){return k_.default}});var z_=ur();Object.defineProperty(U,"MissingRefError",{enumerable:!0,get:function(){return z_.default}})});var Ru=$(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.formatNames=Me.fastFormats=Me.fullFormats=void 0;function Ce(t,e){return{validate:t,compare:e}}Me.fullFormats={date:Ce(ku,wi),time:Ce($i(!0),bi),"date-time":Ce(Su(!0),Pu),"iso-time":Ce($i(),zu),"iso-date-time":Ce(Su(),Tu),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:M_,"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:Z_,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:q_,int32:{type:"number",validate:O_},int64:{type:"number",validate:A_},float:{type:"number",validate:Eu},double:{type:"number",validate:Eu},password:!0,binary:!0};Me.fastFormats={...Me.fullFormats,date:Ce(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,wi),time:Ce(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bi),"date-time":Ce(/^\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,Pu),"iso-time":Ce(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,zu),"iso-date-time":Ce(/^\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,Tu),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};Me.formatNames=Object.keys(Me.fullFormats);function P_(t){return t%4===0&&(t%100!==0||t%400===0)}var T_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,R_=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ku(t){let e=T_.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&P_(r)?29:R_[o])}function wi(t,e){if(t&&e)return t>e?1:t<e?-1:0}var _i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function $i(t){return function(r){let o=_i.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function bi(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function zu(t,e){if(!(t&&e))return;let r=_i.exec(t),o=_i.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var vi=/t|\s/i;function Su(t){let e=$i(t);return function(o){let n=o.split(vi);return n.length===2&&ku(n[0])&&e(n[1])}}function Pu(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Tu(t,e){if(!(t&&e))return;let[r,o]=t.split(vi),[n,s]=e.split(vi),i=wi(r,n);if(i!==void 0)return i||bi(o,s)}var I_=/\/|:/,C_=/^(?:[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 M_(t){return I_.test(t)&&C_.test(t)}var xu=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function q_(t){return xu.lastIndex=0,xu.test(t)}var N_=-(2**31),j_=2**31-1;function O_(t){return Number.isInteger(t)&&t<=j_&&t>=N_}function A_(t){return Number.isInteger(t)}function Eu(){return!0}var D_=/[^\\]\\Z/;function Z_(t){if(D_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Iu=$(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.formatLimitDefinition=void 0;var L_=yi(),ke=R(),We=ke.operators,qo={formatMaximum:{okStr:"<=",ok:We.LTE,fail:We.GT},formatMinimum:{okStr:">=",ok:We.GTE,fail:We.LT},formatExclusiveMaximum:{okStr:"<",ok:We.LT,fail:We.GTE},formatExclusiveMinimum:{okStr:">",ok:We.GT,fail:We.LTE}},F_={message:({keyword:t,schemaCode:e})=>(0,ke.str)`should be ${qo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ke._)`{comparison: ${qo[t].okStr}, limit: ${e}}`};qt.formatLimitDefinition={keyword:Object.keys(qo),type:"string",schemaType:"string",$data:!0,error:F_,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new L_.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,ke._)`${p}[${c.schemaCode}]`);t.fail$data((0,ke.or)((0,ke._)`typeof ${m} != "object"`,(0,ke._)`${m} instanceof RegExp`,(0,ke._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:m,code:i.code.formats?(0,ke._)`${i.code.formats}${(0,ke.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,ke._)`${p}.compare(${r}, ${o}) ${qo[n].fail} 0`}},dependencies:["format"]};var H_=t=>(t.addKeyword(qt.formatLimitDefinition),t);qt.default=H_});var Nu=$((Er,qu)=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});var Nt=Ru(),U_=Iu(),Si=R(),Cu=new Si.Name("fullFormats"),V_=new Si.Name("fastFormats"),xi=(t,e={keywords:!0})=>{if(Array.isArray(e))return Mu(t,e,Nt.fullFormats,Cu),t;let[r,o]=e.mode==="fast"?[Nt.fastFormats,V_]:[Nt.fullFormats,Cu],n=e.formats||Nt.formatNames;return Mu(t,n,r,o),e.keywords&&(0,U_.default)(t),t};xi.get=(t,e="full")=>{let o=(e==="fast"?Nt.fastFormats:Nt.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Mu(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Si._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}qu.exports=Er=xi;Object.defineProperty(Er,"__esModule",{value:!0});Er.default=xi});var od=Bo("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Zi.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Ai(this,"with",t)},parse(t,e){return Jo(this,t,e,{callee:this.parse})},parseAsync(t,e){return Wo(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Ot(this,t,e)},safeParseAsync(t,e){return At(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return Go(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var nd=Bo("ZodMiniObject",(t,e)=>{Li.init(t,e),od.init(t,e),Di(t,"shape",r=>r._zod.def.shape,!1)});function nn(t,e){let r={type:"object",shape:t??{},...Oi(e)};return new nd(r)}function Pe(t){return!!t._zod}function Qe(t){let e=Object.values(t);if(e.length===0)return nn({});let r=e.every(Pe),o=e.every(n=>!Pe(n));if(r)return nn(t);if(o)return ji(t);throw new Error("Mixed Zod versions detected in object shape.")}function De(t,e){return Pe(t)?Ot(t,e):t.safeParse(e)}async function Pr(t,e){return Pe(t)?await At(t,e):await t.safeParseAsync(e)}function Ze(t){if(!t)return;let e;if(Pe(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ft(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Qe(t)}}if(Pe(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function id(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function Tr(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${id(e.path)}`:e.message).join(`
11
- `);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function ga(t){return t.description}function ya(t){if(Pe(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function pt(t){if(Pe(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var an="2025-11-25";var _a=[an,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Le="io.modelcontextprotocol/related-task",Ir="2.0",J=Ui(t=>t!==null&&(typeof t=="object"||typeof t=="function")),$a=V([f(),D().int()]),va=f(),Qv=se({ttl:D().optional(),pollInterval:D().optional()}),ad=v({ttl:D().optional()}),cd=v({taskId:f()}),cn=se({progressToken:$a.optional(),[Le]:cd.optional()}),me=v({_meta:cn.optional()}),Zt=me.extend({task:ad.optional()}),wa=t=>Zt.safeParse(t).success,X=v({method:f(),params:me.loose().optional()}),ge=v({_meta:cn.optional()}),ye=v({method:f(),params:ge.loose().optional()}),Q=se({_meta:cn.optional()}),Cr=V([f(),D().int()]),ba=v({jsonrpc:S(Ir),id:Cr,...X.shape}).strict(),ln=t=>ba.safeParse(t).success,Sa=v({jsonrpc:S(Ir),...ye.shape}).strict(),xa=t=>Sa.safeParse(t).success,un=v({jsonrpc:S(Ir),id:Cr,result:Q}).strict(),Lt=t=>un.safeParse(t).success;var k;(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"})(k||(k={}));var dn=v({jsonrpc:S(Ir),id:Cr.optional(),error:v({code:D().int(),message:f(),data:G().optional()})}).strict();var Ea=t=>dn.safeParse(t).success;var ka=V([ba,Sa,un,dn]),Yv=V([un,dn]),Mr=Q.strict(),ld=ge.extend({requestId:Cr.optional(),reason:f().optional()}),qr=ye.extend({method:S("notifications/cancelled"),params:ld}),ud=v({src:f(),mimeType:f().optional(),sizes:q(f()).optional(),theme:pe(["light","dark"]).optional()}),Ft=v({icons:q(ud).optional()}),mt=v({name:f(),title:f().optional()}),za=mt.extend({...mt.shape,...Ft.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),dd=Yo(v({applyDefaults:W().optional()}),F(f(),G())),fd=en(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Yo(v({form:dd.optional(),url:J.optional()}),F(f(),G()).optional())),pd=se({list:J.optional(),cancel:J.optional(),requests:se({sampling:se({createMessage:J.optional()}).optional(),elicitation:se({create:J.optional()}).optional()}).optional()}),md=se({list:J.optional(),cancel:J.optional(),requests:se({tools:se({call:J.optional()}).optional()}).optional()}),hd=v({experimental:F(f(),J).optional(),sampling:v({context:J.optional(),tools:J.optional()}).optional(),elicitation:fd.optional(),roots:v({listChanged:W().optional()}).optional(),tasks:pd.optional(),extensions:F(f(),J).optional()}),gd=me.extend({protocolVersion:f(),capabilities:hd,clientInfo:za}),fn=X.extend({method:S("initialize"),params:gd});var yd=v({experimental:F(f(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:v({listChanged:W().optional()}).optional(),resources:v({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:v({listChanged:W().optional()}).optional(),tasks:md.optional(),extensions:F(f(),J).optional()}),_d=Q.extend({protocolVersion:f(),capabilities:yd,serverInfo:za,instructions:f().optional()}),pn=ye.extend({method:S("notifications/initialized"),params:ge.optional()});var Nr=X.extend({method:S("ping"),params:me.optional()}),$d=v({progress:D(),total:K(D()),message:K(f())}),vd=v({...ge.shape,...$d.shape,progressToken:$a}),jr=ye.extend({method:S("notifications/progress"),params:vd}),wd=me.extend({cursor:va.optional()}),Ht=X.extend({params:wd.optional()}),Ut=Q.extend({nextCursor:va.optional()}),bd=pe(["working","input_required","completed","failed","cancelled"]),Vt=v({taskId:f(),status:bd,ttl:V([D(),Fi()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:K(D()),statusMessage:K(f())}),ht=Q.extend({task:Vt}),Sd=ge.merge(Vt),Kt=ye.extend({method:S("notifications/tasks/status"),params:Sd}),Or=X.extend({method:S("tasks/get"),params:me.extend({taskId:f()})}),Ar=Q.merge(Vt),Dr=X.extend({method:S("tasks/result"),params:me.extend({taskId:f()})}),ew=Q.loose(),Zr=Ht.extend({method:S("tasks/list")}),Lr=Ut.extend({tasks:q(Vt)}),Fr=X.extend({method:S("tasks/cancel"),params:me.extend({taskId:f()})}),Pa=Q.merge(Vt),Ta=v({uri:f(),mimeType:K(f()),_meta:F(f(),G()).optional()}),Ra=Ta.extend({text:f()}),mn=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ia=Ta.extend({blob:mn}),Gt=pe(["user","assistant"]),gt=v({audience:q(Gt).optional(),priority:D().min(0).max(1).optional(),lastModified:Vi.datetime({offset:!0}).optional()}),Ca=v({...mt.shape,...Ft.shape,uri:f(),description:K(f()),mimeType:K(f()),size:K(D()),annotations:gt.optional(),_meta:K(se({}))}),xd=v({...mt.shape,...Ft.shape,uriTemplate:f(),description:K(f()),mimeType:K(f()),annotations:gt.optional(),_meta:K(se({}))}),Hr=Ht.extend({method:S("resources/list")}),Ed=Ut.extend({resources:q(Ca)}),Ur=Ht.extend({method:S("resources/templates/list")}),kd=Ut.extend({resourceTemplates:q(xd)}),hn=me.extend({uri:f()}),zd=hn,Vr=X.extend({method:S("resources/read"),params:zd}),Pd=Q.extend({contents:q(V([Ra,Ia]))}),Td=ye.extend({method:S("notifications/resources/list_changed"),params:ge.optional()}),Rd=hn,Id=X.extend({method:S("resources/subscribe"),params:Rd}),Cd=hn,Md=X.extend({method:S("resources/unsubscribe"),params:Cd}),qd=ge.extend({uri:f()}),Nd=ye.extend({method:S("notifications/resources/updated"),params:qd}),jd=v({name:f(),description:K(f()),required:K(W())}),Od=v({...mt.shape,...Ft.shape,description:K(f()),arguments:K(q(jd)),_meta:K(se({}))}),Kr=Ht.extend({method:S("prompts/list")}),Ad=Ut.extend({prompts:q(Od)}),Dd=me.extend({name:f(),arguments:F(f(),f()).optional()}),Gr=X.extend({method:S("prompts/get"),params:Dd}),gn=v({type:S("text"),text:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),yn=v({type:S("image"),data:mn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),_n=v({type:S("audio"),data:mn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),Zd=v({type:S("tool_use"),name:f(),id:f(),input:F(f(),G()),_meta:F(f(),G()).optional()}),Ld=v({type:S("resource"),resource:V([Ra,Ia]),annotations:gt.optional(),_meta:F(f(),G()).optional()}),Fd=Ca.extend({type:S("resource_link")}),$n=V([gn,yn,_n,Fd,Ld]),Hd=v({role:Gt,content:$n}),Ud=Q.extend({description:f().optional(),messages:q(Hd)}),Vd=ye.extend({method:S("notifications/prompts/list_changed"),params:ge.optional()}),Kd=v({title:f().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),Gd=v({taskSupport:pe(["required","optional","forbidden"]).optional()}),Ma=v({...mt.shape,...Ft.shape,description:f().optional(),inputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()),outputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()).optional(),annotations:Kd.optional(),execution:Gd.optional(),_meta:F(f(),G()).optional()}),Br=Ht.extend({method:S("tools/list")}),Bd=Ut.extend({tools:q(Ma)}),Jr=Q.extend({content:q($n).default([]),structuredContent:F(f(),G()).optional(),isError:W().optional()}),tw=Jr.or(Q.extend({toolResult:G()})),Jd=Zt.extend({name:f(),arguments:F(f(),G()).optional()}),yt=X.extend({method:S("tools/call"),params:Jd}),Wd=ye.extend({method:S("notifications/tools/list_changed"),params:ge.optional()}),rw=v({autoRefresh:W().default(!0),debounceMs:D().int().nonnegative().default(300)}),Bt=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Xd=me.extend({level:Bt}),vn=X.extend({method:S("logging/setLevel"),params:Xd}),Qd=ge.extend({level:Bt,logger:f().optional(),data:G()}),Yd=ye.extend({method:S("notifications/message"),params:Qd}),ef=v({name:f().optional()}),tf=v({hints:q(ef).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),rf=v({mode:pe(["auto","required","none"]).optional()}),of=v({type:S("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:q($n).default([]),structuredContent:v({}).loose().optional(),isError:W().optional(),_meta:F(f(),G()).optional()}),nf=Qo("type",[gn,yn,_n]),Rr=Qo("type",[gn,yn,_n,Zd,of]),sf=v({role:Gt,content:V([Rr,q(Rr)]),_meta:F(f(),G()).optional()}),af=Zt.extend({messages:q(sf),modelPreferences:tf.optional(),systemPrompt:f().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:q(f()).optional(),metadata:J.optional(),tools:q(Ma).optional(),toolChoice:rf.optional()}),cf=X.extend({method:S("sampling/createMessage"),params:af}),Jt=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens"]).or(f())),role:Gt,content:nf}),wn=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:Gt,content:V([Rr,q(Rr)])}),lf=v({type:S("boolean"),title:f().optional(),description:f().optional(),default:W().optional()}),uf=v({type:S("string"),title:f().optional(),description:f().optional(),minLength:D().optional(),maxLength:D().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:f().optional()}),df=v({type:pe(["number","integer"]),title:f().optional(),description:f().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),ff=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),default:f().optional()}),pf=v({type:S("string"),title:f().optional(),description:f().optional(),oneOf:q(v({const:f(),title:f()})),default:f().optional()}),mf=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),enumNames:q(f()).optional(),default:f().optional()}),hf=V([ff,pf]),gf=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({type:S("string"),enum:q(f())}),default:q(f()).optional()}),yf=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({anyOf:q(v({const:f(),title:f()}))}),default:q(f()).optional()}),_f=V([gf,yf]),$f=V([mf,hf,_f]),vf=V([$f,lf,uf,df]),wf=Zt.extend({mode:S("form").optional(),message:f(),requestedSchema:v({type:S("object"),properties:F(f(),vf),required:q(f()).optional()})}),bf=Zt.extend({mode:S("url"),message:f(),elicitationId:f(),url:f().url()}),Sf=V([wf,bf]),xf=X.extend({method:S("elicitation/create"),params:Sf}),Ef=ge.extend({elicitationId:f()}),kf=ye.extend({method:S("notifications/elicitation/complete"),params:Ef}),_t=Q.extend({action:pe(["accept","decline","cancel"]),content:en(t=>t===null?void 0:t,F(f(),V([f(),D(),W(),q(f())])).optional())}),zf=v({type:S("ref/resource"),uri:f()});var Pf=v({type:S("ref/prompt"),name:f()}),Tf=me.extend({ref:V([Pf,zf]),argument:v({name:f(),value:f()}),context:v({arguments:F(f(),f()).optional()}).optional()}),Wr=X.extend({method:S("completion/complete"),params:Tf});function qa(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Na(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Rf=Q.extend({completion:se({values:q(f()).max(100),total:K(D().int()),hasMore:K(W())})}),If=v({uri:f().startsWith("file://"),name:f().optional(),_meta:F(f(),G()).optional()}),Cf=X.extend({method:S("roots/list"),params:me.optional()}),bn=Q.extend({roots:q(If)}),Mf=ye.extend({method:S("notifications/roots/list_changed"),params:ge.optional()}),ow=V([Nr,fn,Wr,vn,Gr,Kr,Hr,Ur,Vr,Id,Md,yt,Br,Or,Dr,Zr,Fr]),nw=V([qr,jr,pn,Mf,Kt]),sw=V([Mr,Jt,wn,_t,bn,Ar,Lr,ht]),iw=V([Nr,cf,xf,Cf,Or,Dr,Zr,Fr]),aw=V([qr,jr,Yd,Nd,Td,Wd,Vd,Kt,kf]),cw=V([Mr,_d,Rf,Ud,Ad,Ed,kd,Pd,Jr,Bd,Ar,Lr,ht]),b=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===k.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new sn(n.elicitations,r)}return new t(e,r,o)}},sn=class extends b{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(k.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Fe(t){return t==="completed"||t==="failed"||t==="cancelled"}function qf(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Sn(t,e){return Pe(t)?Xo(t,{target:qf(e?.target),io:e?.pipeStrategy??"input"}):Ki(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function xn(t){let r=Ze(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function En(t,e){let r=De(t,e);if(!r.success)throw r.error;return r.data}var Nf=6e4,Xr=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(qr,r=>{this._oncancel(r)}),this.setNotificationHandler(jr,r=>{this._onprogress(r)}),this.setRequestHandler(Nr,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Or,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(k.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Dr,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new b(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new b(k.InvalidParams,`Task not found: ${s}`);if(!Fe(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(Fe(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Le]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Zr,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new b(k.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Fr,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(k.InvalidParams,`Task not found: ${r.params.taskId}`);if(Fe(n.status))throw new b(k.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new b(k.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof b?n:new b(k.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),b.fromError(k.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Lt(s)||Ea(s)?this._onresponse(s):ln(s)?this._onrequest(s,i):xa(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=b.fromError(k.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[Le]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:k.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=wa(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new b(k.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:k.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Lt(e))o(e);else{let i=new b(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Lt(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Lt(e))n(e);else{let i=b.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof b?i:new b(k.InternalError,String(i))}}return}let s;try{let i=await this.request(e,ht,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new b(k.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},Fe(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new b(k.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new b(k.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof b?i:new b(k.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Le]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`)));let E=w instanceof b?w:new b(k.RequestTimeout,String(w));l(E)};this._responseHandlers.set(p,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return l(w);try{let E=De(r,w.result);E.success?u(E.data):l(E.error)}catch(E){l(E)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let g=o?.timeout??Nf,y=()=>h(b.fromError(k.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let w=E=>{let O=this._responseHandlers.get(p);O?O(E):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch(E=>{this._cleanupTimeout(p),l(E)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ar,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Lr,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Pa,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Le]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Le]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Le]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=xn(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=En(e,n);return Promise.resolve(r(i,s))})}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 o=xn(e);this._notificationHandlers.set(o,n=>{let s=En(e,n);return Promise.resolve(r(s))})}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,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&ln(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new b(k.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new b(k.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new b(k.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new b(k.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Kt.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Fe(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new b(k.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Fe(a.status))throw new b(k.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Kt.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Fe(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ja(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Oa(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ja(i)&&ja(s)?r[n]={...i,...s}:r[n]=s}return r}var ju=Ci(yi(),1),Ou=Ci(Nu(),1);function K_(){let t=new ju.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ou.default)(t),t}var No=class{constructor(e){this._ajv=e??K_()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var jo=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Jt,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},_t,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Au(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Du(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Oo=class extends Xr{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Bt.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new No,this.setRequestHandler(fn,o=>this._oninitialize(o)),this.setNotificationHandler(pn,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(vn,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Bt.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new jo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Oa(this._capabilities,e)}setRequestHandler(e,r){let n=Ze(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=pt(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=De(yt,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new b(k.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=De(ht,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new b(k.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let m=De(Jr,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new b(k.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Du(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Au(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:_a.includes(r)?r:an,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Mr)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},wn,r):this.request({method:"sampling/createMessage",params:e},Jt,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},_t,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},_t,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new b(k.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof b?i:new b(k.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},bn,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Lu=Symbol.for("mcp.completable");function Ei(t){return!!t&&typeof t=="object"&&Lu in t}function Fu(t){return t[Lu]?.complete}var Zu;(function(t){t.Completable="McpCompletable"})(Zu||(Zu={}));var Ao=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,o){if(e.length>r)throw new Error(`${o} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let r=[],o="",n=0,s=0;for(;n<e.length;)if(e[n]==="{"){o&&(r.push(o),o="");let i=e.indexOf("}",n);if(i===-1)throw new Error("Unclosed template expression");if(s++,s>1e4)throw new Error("Template contains too many expressions (max 10000)");let a=e.slice(n+1,i),c=this.getOperator(a),u=a.includes("*"),l=this.getNames(a),d=l[0];for(let p of l)t.validateLength(p,1e6,"Variable name");r.push({name:d,operator:c,names:l,exploded:u}),n=i+1}else o+=e[n],n++;return o&&r.push(o),r}getOperator(e){return["+","#",".","/","?","&"].find(o=>e.startsWith(o))||""}getNames(e){let r=this.getOperator(e);return e.slice(r.length).split(",").map(o=>o.replace("*","").trim()).filter(o=>o.length>0)}encodeValue(e,r){return t.validateLength(e,1e6,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){let i=e.names.map(c=>{let u=r[c];if(u===void 0)return"";let l=Array.isArray(u)?u.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(u.toString(),e.operator);return`${c}=${l}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){let i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let o=r[e.name];if(o===void 0)return"";let s=(Array.isArray(o)?o:[o]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return s.join(",");case"+":return s.join(",");case"#":return"#"+s.join(",");case".":return"."+s.join(".");case"/":return"/"+s.join("/");default:return s.join(",")}}expand(e){let r="",o=!1;for(let n of this.parts){if(typeof n=="string"){r+=n;continue}let s=this.expandPart(n,e);s&&((n.operator==="?"||n.operator==="&")&&o?r+=s.replace("?","&"):r+=s,(n.operator==="?"||n.operator==="&")&&(o=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let r=[];for(let s of e.names)t.validateLength(s,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let s=0;s<e.names.length;s++){let i=e.names[s],a=s===0?"\\"+e.operator:"&";r.push({pattern:a+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let o,n=e.name;switch(e.operator){case"":o=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":o="(.+)";break;case".":o="\\.([^/,]+)";break;case"/":o="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:o="([^/]+)"}return r.push({pattern:o,name:n}),r}match(e){t.validateLength(e,1e6,"URI");let r="^",o=[];for(let a of this.parts)if(typeof a=="string")r+=this.escapeRegExp(a);else{let c=this.partToRegExp(a);for(let{pattern:u,name:l}of c)r+=u,o.push({name:l,exploded:a.exploded})}r+="$",t.validateLength(r,1e6,"Generated regex pattern");let n=new RegExp(r),s=e.match(n);if(!s)return null;let i={};for(let a=0;a<o.length;a++){let{name:c,exploded:u}=o[a],l=s[a+1],d=c.replace("*","");u&&l.includes(",")?i[d]=l.split(","):i[d]=l}return i}};var G_=/^[A-Za-z0-9._-]{1,128}$/;function B_(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!G_.test(t)){let r=t.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return e.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function J_(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ki(t){let e=B_(t);return J_(t,e.warnings),e.isValid}var Do=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,o){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,o)}};var Zo=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Oo(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Do(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Br)),this.server.assertCanSetRequestHandler(Xe(yt)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Br,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let o={name:e,title:r.title,description:r.description,inputSchema:(()=>{let n=ft(r.inputSchema);return n?Sn(n,{strictUnions:!0,pipeStrategy:"input"}):W_})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=ft(r.outputSchema);n&&(o.outputSchema=Sn(n,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(yt,async(e,r)=>{try{let o=this._registeredTools[e.params.name];if(!o)throw new b(k.InvalidParams,`Tool ${e.params.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,s=o.execution?.taskSupport,i="createTask"in o.handler;if((s==="required"||s==="optional")&&!i)throw new b(k.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!n)throw new b(k.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!n&&i)return await this.handleAutomaticTaskPolling(o,e,r);let a=await this.validateToolInput(o,e.params.arguments,e.params.name),c=await this.executeToolHandler(o,a,r);return n||await this.validateToolOutput(o,c,e.params.name),c}catch(o){if(o instanceof b&&o.code===k.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,o){if(!e.inputSchema)return;let s=ft(e.inputSchema)??e.inputSchema,i=await Pr(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=Tr(a);throw new b(k.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${c}`)}return i.data}async validateToolOutput(e,r,o){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new b(k.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let n=ft(e.outputSchema),s=await Pr(n,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=Tr(i);throw new b(k.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${a}`)}}async executeToolHandler(e,r,o){let n=e.handler;if("createTask"in n){if(!o.taskStore)throw new Error("No task store provided.");let i={...o,taskStore:o.taskStore};if(e.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,i))}else{let a=n;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=n;return await Promise.resolve(i(r,o))}else{let i=n;return await Promise.resolve(i(o))}}async handleAutomaticTaskPolling(e,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...o,taskStore:o.taskStore},a=n?await Promise.resolve(s.createTask(n,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await o.taskStore.getTask(c);if(!d)throw new b(k.InternalError,`Task ${c} not found during polling`);u=d}return await o.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xe(Wr)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Wr,async e=>{switch(e.params.ref.type){case"ref/prompt":return qa(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Na(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b(k.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let o=this._registeredPrompts[r.name];if(!o)throw new b(k.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return kr;let s=Ze(o.argsSchema)?.[e.params.argument.name];if(!Ei(s))return kr;let i=Fu(s);if(!i)return kr;let a=await i(e.params.argument.value,e.params.context);return Uu(a)}async handleResourceCompletion(e,r){let o=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return kr;throw new b(k.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=o.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return kr;let s=await n(e.params.argument.value,e.params.context);return Uu(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Hr)),this.server.assertCanSetRequestHandler(Xe(Ur)),this.server.assertCanSetRequestHandler(Xe(Vr)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Hr,async(e,r)=>{let o=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),n=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)n.push({...s.metadata,...a})}return{resources:[...o,...n]}}),this.server.setRequestHandler(Ur,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(Vr,async(e,r)=>{let o=new URL(e.params.uri),n=this._registeredResources[o.toString()];if(n){if(!n.enabled)throw new b(k.InvalidParams,`Resource ${o} disabled`);return n.readCallback(o,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(o.toString());if(i)return s.readCallback(o,i,r)}throw new b(k.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Kr)),this.server.assertCanSetRequestHandler(Xe(Gr)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Kr,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?X_(r.argsSchema):void 0}))})),this.server.setRequestHandler(Gr,async(e,r)=>{let o=this._registeredPrompts[e.params.name];if(!o)throw new b(k.InvalidParams,`Prompt ${e.params.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Prompt ${e.params.name} disabled`);if(o.argsSchema){let n=ft(o.argsSchema),s=await Pr(n,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=Tr(c);throw new b(k.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=o.callback;return await Promise.resolve(a(i,r))}else{let n=o.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...o){let n;typeof o[0]=="object"&&(n=o.shift());let s=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,o,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,o,n,s){let i={name:e,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==o&&(delete this._registeredResources[o],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[o]=i,i}_createRegisteredResourceTemplate(e,r,o,n,s){let i={resourceTemplate:o,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=o.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!o.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,o,n,s){let i={title:r,description:o,argsSchema:n===void 0?void 0:Qe(n),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Qe(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,n&&Object.values(n).some(c=>{let u=c instanceof Hi?c._def?.innerType:c;return Ei(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,o,n,s,i,a,c,u){ki(e);let l={title:r,description:o,inputSchema:Hu(n),outputSchema:Hu(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&ki(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Qe(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Qe(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let o,n,s,i;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let c=r[0];if(zi(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!zi(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,o,n,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,o){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,n,s,i,a,c,{taskSupport:"forbidden"},u,o)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let n;r.length>1&&(n=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,o,n,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,o){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,n,s,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Lo=class{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new Ao(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}},W_={type:"object",properties:{}};function Vu(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Ku(t){return"_def"in t||"_zod"in t||Vu(t)}function zi(t){return typeof t!="object"||t===null||Ku(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(Vu)}function Hu(t){if(t){if(zi(t))return Qe(t);if(!Ku(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function X_(t){let e=Ze(t);return e?Object.entries(e).map(([r,o])=>{let n=ga(o),s=ya(o);return{name:r,description:n,required:!s}}):[]}function Xe(t){let r=Ze(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}function Uu(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var kr={completion:{values:[],hasMore:!1}};import Bu from"node:process";var Q_=10*1024*1024,Fo=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??Q_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
10
+ deps: ${r}}`};var vy={keyword:"dependencies",type:"object",schemaType:"object",error:Ie.error,code(t){let[e,r]=wy(t);Vl(t,e),Kl(t,r)}};function wy({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function Vl(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,xr.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,xr.checkReportMissingProp)(t,u)}):(r.if((0,Qs._)`${c} && (${(0,xr.checkMissingProp)(t,a,s)})`),(0,xr.reportMissingProp)(t,s),r.else())}}Ie.validatePropertyDeps=Vl;function Kl(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,$y.alwaysValidSchema)(s,e[a])||(r.if((0,xr.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ie.validateSchemaDeps=Kl;Ie.default=vy});var Jl=$(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});var Bl=R(),by=N(),Sy={message:"property name must be valid",params:({params:t})=>(0,Bl._)`{propertyName: ${t.propertyName}}`},xy={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Sy,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,by.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Bl.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};Ys.default=xy});var ti=$(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var zo=$e(),Ee=R(),Ey=Oe(),Po=N(),ky={message:"must NOT have additional properties",params:({params:t})=>(0,Ee._)`{additionalProperty: ${t.additionalProperty}}`},zy={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ky,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Po.alwaysValidSchema)(i,r))return;let u=(0,zo.allSchemaProperties)(o.properties),l=(0,zo.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Ee._)`${s} === ${Ey.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let w=(0,Po.schemaRefOrVal)(i,o.properties,"properties");_=(0,zo.isOwnProperty)(e,w,y)}else u.length?_=(0,Ee.or)(...u.map(w=>(0,Ee._)`${y} === ${w}`)):_=Ee.nil;return l.length&&(_=(0,Ee.or)(_,...l.map(w=>(0,Ee._)`${(0,zo.usePattern)(t,w)}.test(${y})`))),(0,Ee.not)(_)}function m(y){e.code((0,Ee._)`delete ${n}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Po.alwaysValidSchema)(i,r)){let _=e.name("valid");c.removeAdditional==="failing"?(g(y,_,!1),e.if((0,Ee.not)(_),()=>{t.reset(),m(y)})):(g(y,_),a||e.if((0,Ee.not)(_),()=>e.break()))}}function g(y,_,w){let E={keyword:"additionalProperties",dataProp:y,dataPropType:Po.Type.Str};w===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(E,_)}}};ei.default=zy});var Ql=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});var Py=lr(),Wl=$e(),ri=N(),Xl=ti(),Ty={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Xl.default.code(new Py.KeywordCxt(s,Xl.default,"additionalProperties"));let i=(0,Wl.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ri.mergeEvaluated.props(e,(0,ri.toHash)(i),s.props));let a=i.filter(d=>!(0,ri.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Wl.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};oi.default=Ty});var ru=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});var Yl=$e(),To=R(),eu=N(),tu=N(),Ry={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,Yl.allSchemaProperties)(r),c=a.filter(g=>(0,eu.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof To.Name)&&(s.props=(0,tu.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let g of a)u&&m(g),s.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function m(g){for(let y in u)new RegExp(g).test(y)&&(0,eu.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",o,y=>{e.if((0,To._)`${(0,Yl.usePattern)(t,g)}.test(${y})`,()=>{let _=c.includes(g);_||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:tu.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,To._)`${d}[${y}]`,!0):!_&&!s.allErrors&&e.if((0,To.not)(l),()=>e.break())})})}}};ni.default=Ry});var ou=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});var Iy=N(),Cy={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,Iy.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};si.default=Cy});var nu=$(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});var My=$e(),qy={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:My.validateUnion,error:{message:"must match a schema in anyOf"}};ii.default=qy});var su=$(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var Ro=R(),Ny=N(),jy={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ro._)`{passingSchemas: ${t.passing}}`},Oy={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:jy,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,Ny.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Ro._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ro._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Ro.Name)})})}}};ai.default=Oy});var iu=$(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});var Ay=N(),Dy={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,Ay.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};ci.default=Dy});var lu=$(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var Io=R(),cu=N(),Zy={message:({params:t})=>(0,Io.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Io._)`{failingKeyword: ${t.ifClause}}`},Ly={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Zy,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,cu.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=au(o,"then"),s=au(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,Io.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Io._)`${l}`):t.setParams({ifClause:l})}}}};function au(t,e){let r=t.schema[e];return r!==void 0&&!(0,cu.alwaysValidSchema)(t,r)}li.default=Ly});var uu=$(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});var Fy=N(),Hy={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Fy.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};ui.default=Hy});var du=$(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});var Uy=Gs(),Vy=Ll(),Ky=Bs(),Gy=Hl(),By=Ul(),Jy=Gl(),Wy=Jl(),Xy=ti(),Qy=Ql(),Yy=ru(),e_=ou(),t_=nu(),r_=su(),o_=iu(),n_=lu(),s_=uu();function i_(t=!1){let e=[e_.default,t_.default,r_.default,o_.default,n_.default,s_.default,Wy.default,Xy.default,Jy.default,Qy.default,Yy.default];return t?e.push(Vy.default,Gy.default):e.push(Uy.default,Ky.default),e.push(By.default),e}di.default=i_});var fu=$(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});var B=R(),a_={message:({schemaCode:t})=>(0,B.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,B._)`{format: ${t}}`},c_={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:a_,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():m();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,B._)`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if((0,B._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,B._)`${g}.type || "string"`).assign(_,(0,B._)`${g}.validate`),()=>r.assign(y,(0,B._)`"string"`).assign(_,g)),t.fail$data((0,B.or)(w(),E()));function w(){return c.strictSchema===!1?B.nil:(0,B._)`${i} && !${_}`}function E(){let O=l.$async?(0,B._)`(${g}.async ? await ${_}(${o}) : ${_}(${o}))`:(0,B._)`${_}(${o})`,P=(0,B._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${o}))`;return(0,B._)`${_} && ${_} !== true && ${y} === ${e} && !${P}`}}function m(){let h=d.formats[s];if(!h){w();return}if(h===!0)return;let[g,y,_]=E(h);g===e&&t.pass(O());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function E(P){let ze=P instanceof RegExp?(0,B.regexpCode)(P):c.code.formats?(0,B._)`${c.code.formats}${(0,B.getProperty)(s)}`:void 0,qe=r.scopeValue("formats",{key:s,ref:P,code:ze});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,B._)`${qe}.validate`]:["string",P,qe]}function O(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,B._)`await ${_}(${o})`}return typeof y=="function"?(0,B._)`${_}(${o})`:(0,B._)`${_}.test(${o})`}}}};fi.default=c_});var pu=$(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});var l_=fu(),u_=[l_.default];pi.default=u_});var mu=$(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.contentVocabulary=Rt.metadataVocabulary=void 0;Rt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Rt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var gu=$(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});var d_=Sl(),f_=Ol(),p_=du(),m_=pu(),hu=mu(),h_=[d_.default,f_.default,(0,p_.default)(),m_.default,hu.metadataVocabulary,hu.contentVocabulary];mi.default=h_});var _u=$(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.DiscrError=void 0;var yu;(function(t){t.Tag="tag",t.Mapping="mapping"})(yu||(Co.DiscrError=yu={}))});var vu=$(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var It=R(),hi=_u(),$u=po(),g_=ur(),y_=N(),__={message:({params:{discrError:t,tagName:e}})=>t===hi.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,It._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},$_={keyword:"discriminator",type:"object",schemaType:"object",error:__,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,It._)`${r}${(0,It.getProperty)(a)}`);e.if((0,It._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:hi.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=p();e.if(!1);for(let h in m)e.elseIf((0,It._)`${u} === ${h}`),e.assign(c,d(m[h]));e.else(),t.error(!1,{discrError:hi.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},h);return t.mergeEvaluated(g,It.Name),h}function p(){var m;let h={},g=_(n),y=!0;for(let O=0;O<i.length;O++){let P=i[O];if(P?.$ref&&!(0,y_.schemaHasRulesButRef)(P,s.self.RULES)){let qe=P.$ref;if(P=$u.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,qe),P instanceof $u.SchemaEnv&&(P=P.schema),P===void 0)throw new g_.default(s.opts.uriResolver,s.baseId,qe)}let ze=(m=P?.properties)===null||m===void 0?void 0:m[a];if(typeof ze!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||_(P)),w(ze,O)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function _({required:O}){return Array.isArray(O)&&O.includes(a)}function w(O,P){if(O.const)E(O.const,P);else if(O.enum)for(let ze of O.enum)E(ze,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function E(O,P){if(typeof O!="string"||O in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[O]=P}}}};gi.default=$_});var wu=$((Ib,v_)=>{v_.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 _i=$((U,yi)=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.MissingRefError=U.ValidationError=U.CodeGen=U.Name=U.nil=U.stringify=U.str=U._=U.KeywordCxt=U.Ajv=void 0;var w_=yl(),b_=gu(),S_=vu(),bu=wu(),x_=["/properties"],Mo="http://json-schema.org/draft-07/schema",Ct=class extends w_.default{_addVocabularies(){super._addVocabularies(),b_.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(S_.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(bu,x_):bu;this.addMetaSchema(e,Mo,!1),this.refs["http://json-schema.org/schema"]=Mo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Mo)?Mo:void 0)}};U.Ajv=Ct;yi.exports=U=Ct;yi.exports.Ajv=Ct;Object.defineProperty(U,"__esModule",{value:!0});U.default=Ct;var E_=lr();Object.defineProperty(U,"KeywordCxt",{enumerable:!0,get:function(){return E_.KeywordCxt}});var Mt=R();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return Mt._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return Mt.str}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return Mt.stringify}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return Mt.nil}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return Mt.Name}});Object.defineProperty(U,"CodeGen",{enumerable:!0,get:function(){return Mt.CodeGen}});var k_=uo();Object.defineProperty(U,"ValidationError",{enumerable:!0,get:function(){return k_.default}});var z_=ur();Object.defineProperty(U,"MissingRefError",{enumerable:!0,get:function(){return z_.default}})});var Ru=$(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.formatNames=Me.fastFormats=Me.fullFormats=void 0;function Ce(t,e){return{validate:t,compare:e}}Me.fullFormats={date:Ce(ku,bi),time:Ce(vi(!0),Si),"date-time":Ce(Su(!0),Pu),"iso-time":Ce(vi(),zu),"iso-date-time":Ce(Su(),Tu),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:M_,"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:Z_,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:q_,int32:{type:"number",validate:O_},int64:{type:"number",validate:A_},float:{type:"number",validate:Eu},double:{type:"number",validate:Eu},password:!0,binary:!0};Me.fastFormats={...Me.fullFormats,date:Ce(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,bi),time:Ce(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Si),"date-time":Ce(/^\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,Pu),"iso-time":Ce(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,zu),"iso-date-time":Ce(/^\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,Tu),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};Me.formatNames=Object.keys(Me.fullFormats);function P_(t){return t%4===0&&(t%100!==0||t%400===0)}var T_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,R_=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ku(t){let e=T_.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&P_(r)?29:R_[o])}function bi(t,e){if(t&&e)return t>e?1:t<e?-1:0}var $i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function vi(t){return function(r){let o=$i.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Si(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function zu(t,e){if(!(t&&e))return;let r=$i.exec(t),o=$i.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var wi=/t|\s/i;function Su(t){let e=vi(t);return function(o){let n=o.split(wi);return n.length===2&&ku(n[0])&&e(n[1])}}function Pu(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Tu(t,e){if(!(t&&e))return;let[r,o]=t.split(wi),[n,s]=e.split(wi),i=bi(r,n);if(i!==void 0)return i||Si(o,s)}var I_=/\/|:/,C_=/^(?:[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 M_(t){return I_.test(t)&&C_.test(t)}var xu=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function q_(t){return xu.lastIndex=0,xu.test(t)}var N_=-(2**31),j_=2**31-1;function O_(t){return Number.isInteger(t)&&t<=j_&&t>=N_}function A_(t){return Number.isInteger(t)}function Eu(){return!0}var D_=/[^\\]\\Z/;function Z_(t){if(D_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Iu=$(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.formatLimitDefinition=void 0;var L_=_i(),ke=R(),We=ke.operators,qo={formatMaximum:{okStr:"<=",ok:We.LTE,fail:We.GT},formatMinimum:{okStr:">=",ok:We.GTE,fail:We.LT},formatExclusiveMaximum:{okStr:"<",ok:We.LT,fail:We.GTE},formatExclusiveMinimum:{okStr:">",ok:We.GT,fail:We.LTE}},F_={message:({keyword:t,schemaCode:e})=>(0,ke.str)`should be ${qo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ke._)`{comparison: ${qo[t].okStr}, limit: ${e}}`};qt.formatLimitDefinition={keyword:Object.keys(qo),type:"string",schemaType:"string",$data:!0,error:F_,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new L_.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,ke._)`${p}[${c.schemaCode}]`);t.fail$data((0,ke.or)((0,ke._)`typeof ${m} != "object"`,(0,ke._)`${m} instanceof RegExp`,(0,ke._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:m,code:i.code.formats?(0,ke._)`${i.code.formats}${(0,ke.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,ke._)`${p}.compare(${r}, ${o}) ${qo[n].fail} 0`}},dependencies:["format"]};var H_=t=>(t.addKeyword(qt.formatLimitDefinition),t);qt.default=H_});var Nu=$((Er,qu)=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});var Nt=Ru(),U_=Iu(),xi=R(),Cu=new xi.Name("fullFormats"),V_=new xi.Name("fastFormats"),Ei=(t,e={keywords:!0})=>{if(Array.isArray(e))return Mu(t,e,Nt.fullFormats,Cu),t;let[r,o]=e.mode==="fast"?[Nt.fastFormats,V_]:[Nt.fullFormats,Cu],n=e.formats||Nt.formatNames;return Mu(t,n,r,o),e.keywords&&(0,U_.default)(t),t};Ei.get=(t,e="full")=>{let o=(e==="fast"?Nt.fastFormats:Nt.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Mu(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,xi._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}qu.exports=Er=Ei;Object.defineProperty(Er,"__esModule",{value:!0});Er.default=Ei});var od=Bo("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Li.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Di(this,"with",t)},parse(t,e){return Jo(this,t,e,{callee:this.parse})},parseAsync(t,e){return Wo(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Ot(this,t,e)},safeParseAsync(t,e){return At(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return Go(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var nd=Bo("ZodMiniObject",(t,e)=>{Fi.init(t,e),od.init(t,e),Zi(t,"shape",r=>r._zod.def.shape,!1)});function sn(t,e){let r={type:"object",shape:t??{},...Ai(e)};return new nd(r)}function Pe(t){return!!t._zod}function Qe(t){let e=Object.values(t);if(e.length===0)return sn({});let r=e.every(Pe),o=e.every(n=>!Pe(n));if(r)return sn(t);if(o)return Oi(t);throw new Error("Mixed Zod versions detected in object shape.")}function De(t,e){return Pe(t)?Ot(t,e):t.safeParse(e)}async function Pr(t,e){return Pe(t)?await At(t,e):await t.safeParseAsync(e)}function Ze(t){if(!t)return;let e;if(Pe(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ft(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Qe(t)}}if(Pe(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function id(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function Tr(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${id(e.path)}`:e.message).join(`
11
+ `);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function ga(t){return t.description}function ya(t){if(Pe(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function pt(t){if(Pe(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var cn="2025-11-25";var _a=[cn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Le="io.modelcontextprotocol/related-task",Ir="2.0",J=Vi(t=>t!==null&&(typeof t=="object"||typeof t=="function")),$a=V([f(),D().int()]),va=f(),Qv=se({ttl:D().optional(),pollInterval:D().optional()}),ad=v({ttl:D().optional()}),cd=v({taskId:f()}),ln=se({progressToken:$a.optional(),[Le]:cd.optional()}),me=v({_meta:ln.optional()}),Zt=me.extend({task:ad.optional()}),wa=t=>Zt.safeParse(t).success,X=v({method:f(),params:me.loose().optional()}),ge=v({_meta:ln.optional()}),ye=v({method:f(),params:ge.loose().optional()}),Q=se({_meta:ln.optional()}),Cr=V([f(),D().int()]),ba=v({jsonrpc:S(Ir),id:Cr,...X.shape}).strict(),un=t=>ba.safeParse(t).success,Sa=v({jsonrpc:S(Ir),...ye.shape}).strict(),xa=t=>Sa.safeParse(t).success,dn=v({jsonrpc:S(Ir),id:Cr,result:Q}).strict(),Lt=t=>dn.safeParse(t).success;var k;(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"})(k||(k={}));var fn=v({jsonrpc:S(Ir),id:Cr.optional(),error:v({code:D().int(),message:f(),data:G().optional()})}).strict();var Ea=t=>fn.safeParse(t).success;var ka=V([ba,Sa,dn,fn]),Yv=V([dn,fn]),Mr=Q.strict(),ld=ge.extend({requestId:Cr.optional(),reason:f().optional()}),qr=ye.extend({method:S("notifications/cancelled"),params:ld}),ud=v({src:f(),mimeType:f().optional(),sizes:q(f()).optional(),theme:pe(["light","dark"]).optional()}),Ft=v({icons:q(ud).optional()}),mt=v({name:f(),title:f().optional()}),za=mt.extend({...mt.shape,...Ft.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),dd=Yo(v({applyDefaults:W().optional()}),F(f(),G())),fd=en(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Yo(v({form:dd.optional(),url:J.optional()}),F(f(),G()).optional())),pd=se({list:J.optional(),cancel:J.optional(),requests:se({sampling:se({createMessage:J.optional()}).optional(),elicitation:se({create:J.optional()}).optional()}).optional()}),md=se({list:J.optional(),cancel:J.optional(),requests:se({tools:se({call:J.optional()}).optional()}).optional()}),hd=v({experimental:F(f(),J).optional(),sampling:v({context:J.optional(),tools:J.optional()}).optional(),elicitation:fd.optional(),roots:v({listChanged:W().optional()}).optional(),tasks:pd.optional(),extensions:F(f(),J).optional()}),gd=me.extend({protocolVersion:f(),capabilities:hd,clientInfo:za}),pn=X.extend({method:S("initialize"),params:gd});var yd=v({experimental:F(f(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:v({listChanged:W().optional()}).optional(),resources:v({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:v({listChanged:W().optional()}).optional(),tasks:md.optional(),extensions:F(f(),J).optional()}),_d=Q.extend({protocolVersion:f(),capabilities:yd,serverInfo:za,instructions:f().optional()}),mn=ye.extend({method:S("notifications/initialized"),params:ge.optional()});var Nr=X.extend({method:S("ping"),params:me.optional()}),$d=v({progress:D(),total:K(D()),message:K(f())}),vd=v({...ge.shape,...$d.shape,progressToken:$a}),jr=ye.extend({method:S("notifications/progress"),params:vd}),wd=me.extend({cursor:va.optional()}),Ht=X.extend({params:wd.optional()}),Ut=Q.extend({nextCursor:va.optional()}),bd=pe(["working","input_required","completed","failed","cancelled"]),Vt=v({taskId:f(),status:bd,ttl:V([D(),Hi()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:K(D()),statusMessage:K(f())}),ht=Q.extend({task:Vt}),Sd=ge.merge(Vt),Kt=ye.extend({method:S("notifications/tasks/status"),params:Sd}),Or=X.extend({method:S("tasks/get"),params:me.extend({taskId:f()})}),Ar=Q.merge(Vt),Dr=X.extend({method:S("tasks/result"),params:me.extend({taskId:f()})}),ew=Q.loose(),Zr=Ht.extend({method:S("tasks/list")}),Lr=Ut.extend({tasks:q(Vt)}),Fr=X.extend({method:S("tasks/cancel"),params:me.extend({taskId:f()})}),Pa=Q.merge(Vt),Ta=v({uri:f(),mimeType:K(f()),_meta:F(f(),G()).optional()}),Ra=Ta.extend({text:f()}),hn=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ia=Ta.extend({blob:hn}),Gt=pe(["user","assistant"]),gt=v({audience:q(Gt).optional(),priority:D().min(0).max(1).optional(),lastModified:Ki.datetime({offset:!0}).optional()}),Ca=v({...mt.shape,...Ft.shape,uri:f(),description:K(f()),mimeType:K(f()),size:K(D()),annotations:gt.optional(),_meta:K(se({}))}),xd=v({...mt.shape,...Ft.shape,uriTemplate:f(),description:K(f()),mimeType:K(f()),annotations:gt.optional(),_meta:K(se({}))}),Hr=Ht.extend({method:S("resources/list")}),Ed=Ut.extend({resources:q(Ca)}),Ur=Ht.extend({method:S("resources/templates/list")}),kd=Ut.extend({resourceTemplates:q(xd)}),gn=me.extend({uri:f()}),zd=gn,Vr=X.extend({method:S("resources/read"),params:zd}),Pd=Q.extend({contents:q(V([Ra,Ia]))}),Td=ye.extend({method:S("notifications/resources/list_changed"),params:ge.optional()}),Rd=gn,Id=X.extend({method:S("resources/subscribe"),params:Rd}),Cd=gn,Md=X.extend({method:S("resources/unsubscribe"),params:Cd}),qd=ge.extend({uri:f()}),Nd=ye.extend({method:S("notifications/resources/updated"),params:qd}),jd=v({name:f(),description:K(f()),required:K(W())}),Od=v({...mt.shape,...Ft.shape,description:K(f()),arguments:K(q(jd)),_meta:K(se({}))}),Kr=Ht.extend({method:S("prompts/list")}),Ad=Ut.extend({prompts:q(Od)}),Dd=me.extend({name:f(),arguments:F(f(),f()).optional()}),Gr=X.extend({method:S("prompts/get"),params:Dd}),yn=v({type:S("text"),text:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),_n=v({type:S("image"),data:hn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),$n=v({type:S("audio"),data:hn,mimeType:f(),annotations:gt.optional(),_meta:F(f(),G()).optional()}),Zd=v({type:S("tool_use"),name:f(),id:f(),input:F(f(),G()),_meta:F(f(),G()).optional()}),Ld=v({type:S("resource"),resource:V([Ra,Ia]),annotations:gt.optional(),_meta:F(f(),G()).optional()}),Fd=Ca.extend({type:S("resource_link")}),vn=V([yn,_n,$n,Fd,Ld]),Hd=v({role:Gt,content:vn}),Ud=Q.extend({description:f().optional(),messages:q(Hd)}),Vd=ye.extend({method:S("notifications/prompts/list_changed"),params:ge.optional()}),Kd=v({title:f().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),Gd=v({taskSupport:pe(["required","optional","forbidden"]).optional()}),Ma=v({...mt.shape,...Ft.shape,description:f().optional(),inputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()),outputSchema:v({type:S("object"),properties:F(f(),J).optional(),required:q(f()).optional()}).catchall(G()).optional(),annotations:Kd.optional(),execution:Gd.optional(),_meta:F(f(),G()).optional()}),Br=Ht.extend({method:S("tools/list")}),Bd=Ut.extend({tools:q(Ma)}),Jr=Q.extend({content:q(vn).default([]),structuredContent:F(f(),G()).optional(),isError:W().optional()}),tw=Jr.or(Q.extend({toolResult:G()})),Jd=Zt.extend({name:f(),arguments:F(f(),G()).optional()}),yt=X.extend({method:S("tools/call"),params:Jd}),Wd=ye.extend({method:S("notifications/tools/list_changed"),params:ge.optional()}),rw=v({autoRefresh:W().default(!0),debounceMs:D().int().nonnegative().default(300)}),Bt=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Xd=me.extend({level:Bt}),wn=X.extend({method:S("logging/setLevel"),params:Xd}),Qd=ge.extend({level:Bt,logger:f().optional(),data:G()}),Yd=ye.extend({method:S("notifications/message"),params:Qd}),ef=v({name:f().optional()}),tf=v({hints:q(ef).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),rf=v({mode:pe(["auto","required","none"]).optional()}),of=v({type:S("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:q(vn).default([]),structuredContent:v({}).loose().optional(),isError:W().optional(),_meta:F(f(),G()).optional()}),nf=Qo("type",[yn,_n,$n]),Rr=Qo("type",[yn,_n,$n,Zd,of]),sf=v({role:Gt,content:V([Rr,q(Rr)]),_meta:F(f(),G()).optional()}),af=Zt.extend({messages:q(sf),modelPreferences:tf.optional(),systemPrompt:f().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:q(f()).optional(),metadata:J.optional(),tools:q(Ma).optional(),toolChoice:rf.optional()}),cf=X.extend({method:S("sampling/createMessage"),params:af}),Jt=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens"]).or(f())),role:Gt,content:nf}),bn=Q.extend({model:f(),stopReason:K(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:Gt,content:V([Rr,q(Rr)])}),lf=v({type:S("boolean"),title:f().optional(),description:f().optional(),default:W().optional()}),uf=v({type:S("string"),title:f().optional(),description:f().optional(),minLength:D().optional(),maxLength:D().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:f().optional()}),df=v({type:pe(["number","integer"]),title:f().optional(),description:f().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),ff=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),default:f().optional()}),pf=v({type:S("string"),title:f().optional(),description:f().optional(),oneOf:q(v({const:f(),title:f()})),default:f().optional()}),mf=v({type:S("string"),title:f().optional(),description:f().optional(),enum:q(f()),enumNames:q(f()).optional(),default:f().optional()}),hf=V([ff,pf]),gf=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({type:S("string"),enum:q(f())}),default:q(f()).optional()}),yf=v({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:v({anyOf:q(v({const:f(),title:f()}))}),default:q(f()).optional()}),_f=V([gf,yf]),$f=V([mf,hf,_f]),vf=V([$f,lf,uf,df]),wf=Zt.extend({mode:S("form").optional(),message:f(),requestedSchema:v({type:S("object"),properties:F(f(),vf),required:q(f()).optional()})}),bf=Zt.extend({mode:S("url"),message:f(),elicitationId:f(),url:f().url()}),Sf=V([wf,bf]),xf=X.extend({method:S("elicitation/create"),params:Sf}),Ef=ge.extend({elicitationId:f()}),kf=ye.extend({method:S("notifications/elicitation/complete"),params:Ef}),_t=Q.extend({action:pe(["accept","decline","cancel"]),content:en(t=>t===null?void 0:t,F(f(),V([f(),D(),W(),q(f())])).optional())}),zf=v({type:S("ref/resource"),uri:f()});var Pf=v({type:S("ref/prompt"),name:f()}),Tf=me.extend({ref:V([Pf,zf]),argument:v({name:f(),value:f()}),context:v({arguments:F(f(),f()).optional()}).optional()}),Wr=X.extend({method:S("completion/complete"),params:Tf});function qa(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Na(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Rf=Q.extend({completion:se({values:q(f()).max(100),total:K(D().int()),hasMore:K(W())})}),If=v({uri:f().startsWith("file://"),name:f().optional(),_meta:F(f(),G()).optional()}),Cf=X.extend({method:S("roots/list"),params:me.optional()}),Sn=Q.extend({roots:q(If)}),Mf=ye.extend({method:S("notifications/roots/list_changed"),params:ge.optional()}),ow=V([Nr,pn,Wr,wn,Gr,Kr,Hr,Ur,Vr,Id,Md,yt,Br,Or,Dr,Zr,Fr]),nw=V([qr,jr,mn,Mf,Kt]),sw=V([Mr,Jt,bn,_t,Sn,Ar,Lr,ht]),iw=V([Nr,cf,xf,Cf,Or,Dr,Zr,Fr]),aw=V([qr,jr,Yd,Nd,Td,Wd,Vd,Kt,kf]),cw=V([Mr,_d,Rf,Ud,Ad,Ed,kd,Pd,Jr,Bd,Ar,Lr,ht]),b=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===k.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new an(n.elicitations,r)}return new t(e,r,o)}},an=class extends b{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(k.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Fe(t){return t==="completed"||t==="failed"||t==="cancelled"}function qf(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function xn(t,e){return Pe(t)?Xo(t,{target:qf(e?.target),io:e?.pipeStrategy??"input"}):Gi(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function En(t){let r=Ze(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function kn(t,e){let r=De(t,e);if(!r.success)throw r.error;return r.data}var Nf=6e4,Xr=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(qr,r=>{this._oncancel(r)}),this.setNotificationHandler(jr,r=>{this._onprogress(r)}),this.setRequestHandler(Nr,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Or,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(k.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Dr,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new b(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new b(k.InvalidParams,`Task not found: ${s}`);if(!Fe(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(Fe(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Le]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Zr,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new b(k.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Fr,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new b(k.InvalidParams,`Task not found: ${r.params.taskId}`);if(Fe(n.status))throw new b(k.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new b(k.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof b?n:new b(k.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),b.fromError(k.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Lt(s)||Ea(s)?this._onresponse(s):un(s)?this._onrequest(s,i):xa(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=b.fromError(k.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[Le]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:k.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=wa(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new b(k.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:k.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Lt(e))o(e);else{let i=new b(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Lt(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Lt(e))n(e);else{let i=b.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof b?i:new b(k.InternalError,String(i))}}return}let s;try{let i=await this.request(e,ht,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new b(k.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},Fe(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new b(k.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new b(k.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof b?i:new b(k.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Le]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`)));let E=w instanceof b?w:new b(k.RequestTimeout,String(w));l(E)};this._responseHandlers.set(p,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return l(w);try{let E=De(r,w.result);E.success?u(E.data):l(E.error)}catch(E){l(E)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let g=o?.timeout??Nf,y=()=>h(b.fromError(k.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let w=E=>{let O=this._responseHandlers.get(p);O?O(E):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch(E=>{this._cleanupTimeout(p),l(E)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ar,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Lr,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Pa,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Le]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Le]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Le]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=En(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=kn(e,n);return Promise.resolve(r(i,s))})}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 o=En(e);this._notificationHandlers.set(o,n=>{let s=kn(e,n);return Promise.resolve(r(s))})}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,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&un(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new b(k.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new b(k.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new b(k.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new b(k.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Kt.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Fe(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new b(k.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Fe(a.status))throw new b(k.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Kt.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Fe(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ja(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Oa(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ja(i)&&ja(s)?r[n]={...i,...s}:r[n]=s}return r}var ju=Mi(_i(),1),Ou=Mi(Nu(),1);function K_(){let t=new ju.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ou.default)(t),t}var No=class{constructor(e){this._ajv=e??K_()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var jo=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Jt,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},_t,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Au(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Du(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Oo=class extends Xr{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Bt.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new No,this.setRequestHandler(pn,o=>this._oninitialize(o)),this.setNotificationHandler(mn,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(wn,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Bt.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new jo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Oa(this._capabilities,e)}setRequestHandler(e,r){let n=Ze(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=pt(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=De(yt,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new b(k.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=De(ht,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new b(k.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let m=De(Jr,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new b(k.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Du(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Au(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:_a.includes(r)?r:cn,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Mr)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},bn,r):this.request({method:"sampling/createMessage",params:e},Jt,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},_t,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},_t,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new b(k.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof b?i:new b(k.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Sn,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Lu=Symbol.for("mcp.completable");function ki(t){return!!t&&typeof t=="object"&&Lu in t}function Fu(t){return t[Lu]?.complete}var Zu;(function(t){t.Completable="McpCompletable"})(Zu||(Zu={}));var Ao=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,o){if(e.length>r)throw new Error(`${o} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let r=[],o="",n=0,s=0;for(;n<e.length;)if(e[n]==="{"){o&&(r.push(o),o="");let i=e.indexOf("}",n);if(i===-1)throw new Error("Unclosed template expression");if(s++,s>1e4)throw new Error("Template contains too many expressions (max 10000)");let a=e.slice(n+1,i),c=this.getOperator(a),u=a.includes("*"),l=this.getNames(a),d=l[0];for(let p of l)t.validateLength(p,1e6,"Variable name");r.push({name:d,operator:c,names:l,exploded:u}),n=i+1}else o+=e[n],n++;return o&&r.push(o),r}getOperator(e){return["+","#",".","/","?","&"].find(o=>e.startsWith(o))||""}getNames(e){let r=this.getOperator(e);return e.slice(r.length).split(",").map(o=>o.replace("*","").trim()).filter(o=>o.length>0)}encodeValue(e,r){return t.validateLength(e,1e6,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){let i=e.names.map(c=>{let u=r[c];if(u===void 0)return"";let l=Array.isArray(u)?u.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(u.toString(),e.operator);return`${c}=${l}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){let i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let o=r[e.name];if(o===void 0)return"";let s=(Array.isArray(o)?o:[o]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return s.join(",");case"+":return s.join(",");case"#":return"#"+s.join(",");case".":return"."+s.join(".");case"/":return"/"+s.join("/");default:return s.join(",")}}expand(e){let r="",o=!1;for(let n of this.parts){if(typeof n=="string"){r+=n;continue}let s=this.expandPart(n,e);s&&((n.operator==="?"||n.operator==="&")&&o?r+=s.replace("?","&"):r+=s,(n.operator==="?"||n.operator==="&")&&(o=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let r=[];for(let s of e.names)t.validateLength(s,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let s=0;s<e.names.length;s++){let i=e.names[s],a=s===0?"\\"+e.operator:"&";r.push({pattern:a+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let o,n=e.name;switch(e.operator){case"":o=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":o="(.+)";break;case".":o="\\.([^/,]+)";break;case"/":o="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:o="([^/]+)"}return r.push({pattern:o,name:n}),r}match(e){t.validateLength(e,1e6,"URI");let r="^",o=[];for(let a of this.parts)if(typeof a=="string")r+=this.escapeRegExp(a);else{let c=this.partToRegExp(a);for(let{pattern:u,name:l}of c)r+=u,o.push({name:l,exploded:a.exploded})}r+="$",t.validateLength(r,1e6,"Generated regex pattern");let n=new RegExp(r),s=e.match(n);if(!s)return null;let i={};for(let a=0;a<o.length;a++){let{name:c,exploded:u}=o[a],l=s[a+1],d=c.replace("*","");u&&l.includes(",")?i[d]=l.split(","):i[d]=l}return i}};var G_=/^[A-Za-z0-9._-]{1,128}$/;function B_(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!G_.test(t)){let r=t.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return e.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function J_(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function zi(t){let e=B_(t);return J_(t,e.warnings),e.isValid}var Do=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,o){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,o)}};var Zo=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Oo(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Do(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Br)),this.server.assertCanSetRequestHandler(Xe(yt)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Br,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let o={name:e,title:r.title,description:r.description,inputSchema:(()=>{let n=ft(r.inputSchema);return n?xn(n,{strictUnions:!0,pipeStrategy:"input"}):W_})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=ft(r.outputSchema);n&&(o.outputSchema=xn(n,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(yt,async(e,r)=>{try{let o=this._registeredTools[e.params.name];if(!o)throw new b(k.InvalidParams,`Tool ${e.params.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,s=o.execution?.taskSupport,i="createTask"in o.handler;if((s==="required"||s==="optional")&&!i)throw new b(k.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!n)throw new b(k.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!n&&i)return await this.handleAutomaticTaskPolling(o,e,r);let a=await this.validateToolInput(o,e.params.arguments,e.params.name),c=await this.executeToolHandler(o,a,r);return n||await this.validateToolOutput(o,c,e.params.name),c}catch(o){if(o instanceof b&&o.code===k.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,o){if(!e.inputSchema)return;let s=ft(e.inputSchema)??e.inputSchema,i=await Pr(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=Tr(a);throw new b(k.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${c}`)}return i.data}async validateToolOutput(e,r,o){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new b(k.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let n=ft(e.outputSchema),s=await Pr(n,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=Tr(i);throw new b(k.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${a}`)}}async executeToolHandler(e,r,o){let n=e.handler;if("createTask"in n){if(!o.taskStore)throw new Error("No task store provided.");let i={...o,taskStore:o.taskStore};if(e.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,i))}else{let a=n;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=n;return await Promise.resolve(i(r,o))}else{let i=n;return await Promise.resolve(i(o))}}async handleAutomaticTaskPolling(e,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...o,taskStore:o.taskStore},a=n?await Promise.resolve(s.createTask(n,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await o.taskStore.getTask(c);if(!d)throw new b(k.InternalError,`Task ${c} not found during polling`);u=d}return await o.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xe(Wr)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Wr,async e=>{switch(e.params.ref.type){case"ref/prompt":return qa(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Na(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b(k.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let o=this._registeredPrompts[r.name];if(!o)throw new b(k.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return kr;let s=Ze(o.argsSchema)?.[e.params.argument.name];if(!ki(s))return kr;let i=Fu(s);if(!i)return kr;let a=await i(e.params.argument.value,e.params.context);return Uu(a)}async handleResourceCompletion(e,r){let o=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return kr;throw new b(k.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=o.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return kr;let s=await n(e.params.argument.value,e.params.context);return Uu(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Hr)),this.server.assertCanSetRequestHandler(Xe(Ur)),this.server.assertCanSetRequestHandler(Xe(Vr)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Hr,async(e,r)=>{let o=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),n=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)n.push({...s.metadata,...a})}return{resources:[...o,...n]}}),this.server.setRequestHandler(Ur,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(Vr,async(e,r)=>{let o=new URL(e.params.uri),n=this._registeredResources[o.toString()];if(n){if(!n.enabled)throw new b(k.InvalidParams,`Resource ${o} disabled`);return n.readCallback(o,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(o.toString());if(i)return s.readCallback(o,i,r)}throw new b(k.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Xe(Kr)),this.server.assertCanSetRequestHandler(Xe(Gr)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Kr,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?X_(r.argsSchema):void 0}))})),this.server.setRequestHandler(Gr,async(e,r)=>{let o=this._registeredPrompts[e.params.name];if(!o)throw new b(k.InvalidParams,`Prompt ${e.params.name} not found`);if(!o.enabled)throw new b(k.InvalidParams,`Prompt ${e.params.name} disabled`);if(o.argsSchema){let n=ft(o.argsSchema),s=await Pr(n,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=Tr(c);throw new b(k.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=o.callback;return await Promise.resolve(a(i,r))}else{let n=o.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...o){let n;typeof o[0]=="object"&&(n=o.shift());let s=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,o,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,o.title,r,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,o,n,s){let i={name:e,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==o&&(delete this._registeredResources[o],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[o]=i,i}_createRegisteredResourceTemplate(e,r,o,n,s){let i={resourceTemplate:o,title:r,metadata:n,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=o.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!o.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,o,n,s){let i={title:r,description:o,argsSchema:n===void 0?void 0:Qe(n),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Qe(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,n&&Object.values(n).some(c=>{let u=c instanceof Ui?c._def?.innerType:c;return ki(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,o,n,s,i,a,c,u){zi(e);let l={title:r,description:o,inputSchema:Hu(n),outputSchema:Hu(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&zi(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Qe(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Qe(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let o,n,s,i;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let c=r[0];if(Pi(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Pi(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,o,n,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,o){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,n,s,i,a,c,{taskSupport:"forbidden"},u,o)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let n;r.length>1&&(n=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,o,n,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,o){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,n,s,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Lo=class{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new Ao(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}},W_={type:"object",properties:{}};function Vu(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Ku(t){return"_def"in t||"_zod"in t||Vu(t)}function Pi(t){return typeof t!="object"||t===null||Ku(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(Vu)}function Hu(t){if(t){if(Pi(t))return Qe(t);if(!Ku(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function X_(t){let e=Ze(t);return e?Object.entries(e).map(([r,o])=>{let n=ga(o),s=ya(o);return{name:r,description:n,required:!s}}):[]}function Xe(t){let r=Ze(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=pt(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}function Uu(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var kr={completion:{values:[],hasMore:!1}};import Bu from"node:process";var Q_=10*1024*1024,Fo=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??Q_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
12
12
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Y_(r)}clear(){this._buffer=void 0}};function Y_(t){return ka.parse(JSON.parse(t))}function Gu(t){return JSON.stringify(t)+`
13
- `}var Ho=class{constructor(e=Bu.stdin,r=Bu.stdout,o){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new Fo({maxBufferSize:o?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Gu(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};sa();qi().then(t=>{t&&Mi(t,zr)&&console.error(`conformtools ${zr} is running but ${t} is on npm \u2014 ${Ni}`)});var e0=await Dt(),t0=await oa("mcp"),he=new Zo({name:"conformtools",version:zr},{instructions:t0});function r0(t){let e=t._meta?.progressToken;if(e===void 0)return;let r=0,o="",n=0,s=-1,i=0;return(a,c,u)=>{u!==o&&(r+=n,o=u),n=c;let l=Date.now(),d=Math.max(r+a,s+.001);l-i<500&&a<c||(i=l,s=d,t.sendNotification({method:"notifications/progress",params:{progressToken:e,progress:d,total:c?r+c:void 0,message:c?`${u} ${a}/${c}`:u}}).catch(()=>{}))}}var Ju=!1;async function o0(t){if(Ju||!he.server.getClientCapabilities()?.elicitation||!await tn())return;Ju=!0;let e=await he.server.elicitInput({message:"conform.tools: did that do what you wanted?",requestedSchema:{type:"object",required:["worked"],properties:{worked:{type:"string",title:"Did it work?",enum:["yes","partly","no"]},what:{type:"string",title:"What was wrong? (optional, goes to the conform.tools team)"}}}});if(e.action!=="accept"||!e.content)return;let r=String(e.content.worked??""),o=String(e.content.what??"").trim();await rn("feedback",{summary:`did it work? ${r}${o?`: ${o}`:""}`,topic:r==="yes"?"suggestion":"problem",words:"user",verb:"finish",context:{asked:"after finish",agent_said:String(t??"")}})}var Xu="__session_id_filled";for(let t of on)he.registerTool(t.name,{title:t.title,description:t.description,inputSchema:fa(t),annotations:da(t.name)},async(e,r)=>{let{[Xu]:o,...n}=e,s=ua(t.name,n,()=>void aa("finish_missing"));s&&ia(t.name,s,0,Object.keys(n));let i=t.name==="finish"?la().wrote.length:0,a=s??await ha(t.name,n)??await rn(t.name,n,{progress:r0(r),signal:r.signal});return i&&!a.isError&&a.structuredContent?.ok_to_send&&o0(n.outcome).catch(()=>{}),o&&a.content[0]?.type==="text"&&(a.content[0].text=`(session_id was missing from the call, so ${o}, the session last read here, was used)
14
- ${a.content[0].text}`),Bi(Gi(t.name,a))});var n0=async t=>{for(let e of await Dt()){let r=e.files.find(o=>o.uri===t);if(r)return{sk:e,f:r}}return null};he.registerResource("skill",new Lo("skill://{+path}",{list:async()=>({resources:(await Dt()).flatMap(t=>t.files.map(e=>({uri:e.uri,name:`${t.name}/${e.path}`,mimeType:e.mimeType,description:e.path==="SKILL.md"?String(t.frontmatter.description):void 0})))})}),{description:"conform.tools playbook files (signed-in account)"},async t=>{let e=await n0(t.href);if(!e)throw Object.assign(new Error(`No skill file at ${t.href}${(await Dt()).length?"":" (playbooks not loaded: call account_login, then try again)"}`),{code:-32002});let{f:r}=e;return r.mimeType.startsWith("text/")||r.mimeType.endsWith("json")||r.mimeType.endsWith("yaml")?{contents:[{uri:r.uri,mimeType:r.mimeType,text:new TextDecoder().decode(r.bytes)}]}:{contents:[{uri:r.uri,mimeType:r.mimeType,blob:btoa(String.fromCharCode(...r.bytes))}]}});he.server.registerCapabilities({extensions:{[Qi]:{directoryRead:!0}}});var Pi=async t=>{try{return await t()}catch(e){throw e instanceof Yi?Object.assign(new Error(e.message),{code:e.code}):e}},Ti=t=>dt.object({method:dt.literal(t),params:dt.object({uri:dt.string().optional(),cursor:dt.string().optional()}).passthrough().optional()});he.server.setRequestHandler(Ti("skills/list"),()=>Pi(ea));he.server.setRequestHandler(Ti("skills/get"),t=>Pi(()=>ta(t.params?.uri)));he.server.setRequestHandler(Ti("resources/directory/read"),t=>Pi(()=>ra(t.params?.uri)));var Qu=he,Wu=Qu.validateToolInput?.bind(he);Wu&&(Qu.validateToolInput=async(t,e,r)=>{let o=pa(r,e);try{let n=await Wu(t,o?{...e,session_id:o}:e,r);return o?{...n,[Xu]:o}:n}catch(n){throw ma(r,e),n}});he.server.oninitialized=()=>{let t=he.server.getClientVersion()?.name;na(t),ca(),(async()=>{let e=Ji(t);if(!e||!await tn())return;let r=await Wi(e);(r.result==="installed"||r.result==="updated")&&console.error(`conformtools: agent hook ${r.result} in ${r.file} \u2014 it records ${Xi}; conformtools hooks off removes it${e==="codex"?"; Codex asks you to trust it once (/hooks)":""}`)})().catch(()=>{})};await he.connect(new Ho);console.error(`conformtools MCP ready (${on.length} verbs, ${e0.length} skills, stdio)`);
13
+ `}var Ho=class{constructor(e=Bu.stdin,r=Bu.stdout,o){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new Fo({maxBufferSize:o?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Gu(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};ia();Ni().then(t=>{t&&qi(t,zr)&&console.error(`conformtools ${zr} is running but ${t} is on npm \u2014 ${ji}`)});var e0=await Dt(),t0=await na("mcp"),he=new Zo({name:"conformtools",version:zr},{instructions:t0});function r0(t){let e=t._meta?.progressToken;if(e===void 0)return;let r=0,o="",n=0,s=-1,i=0;return(a,c,u)=>{u!==o&&(r+=n,o=u),n=c;let l=Date.now(),d=Math.max(r+a,s+.001);l-i<500&&a<c||(i=l,s=d,t.sendNotification({method:"notifications/progress",params:{progressToken:e,progress:d,total:c?r+c:void 0,message:c?`${u} ${a}/${c}`:u}}).catch(()=>{}))}}var Ju=!1;async function o0(t){if(Ju||!he.server.getClientCapabilities()?.elicitation||!await tn())return;Ju=!0;let e=await he.server.elicitInput({message:"conform.tools: did that do what you wanted?",requestedSchema:{type:"object",required:["worked"],properties:{worked:{type:"string",title:"Did it work?",enum:["yes","partly","no"]},what:{type:"string",title:"What was wrong? (optional, goes to the conform.tools team)"}}}});if(e.action!=="accept"||!e.content)return;let r=String(e.content.worked??""),o=String(e.content.what??"").trim();await on("feedback",{summary:`did it work? ${r}${o?`: ${o}`:""}`,topic:r==="yes"?"suggestion":"problem",words:"user",verb:"finish",context:{asked:"after finish",agent_said:String(t??"")}})}var Xu="__session_id_filled";for(let t of nn)he.registerTool(t.name,{title:t.title,description:t.description,inputSchema:fa(t),annotations:da(t.name)},async(e,r)=>{let{[Xu]:o,...n}=e,s=ua(t.name,n,()=>void ca("finish_missing"));s&&aa(t.name,s,0,Object.keys(n));let i=t.name==="finish"?la().wrote.length:0,a=s??await ha(t.name,n)??await on(t.name,n,{progress:r0(r),signal:r.signal});return i&&!a.isError&&a.structuredContent?.ok_to_send&&o0(n.outcome).catch(()=>{}),o&&a.content[0]?.type==="text"&&(a.content[0].text=`(session_id was missing from the call, so ${o}, the session last read here, was used)
14
+ ${a.content[0].text}`),Ji(Bi(t.name,a))});var n0=async t=>{for(let e of await Dt()){let r=e.files.find(o=>o.uri===t);if(r)return{sk:e,f:r}}return null};he.registerResource("skill",new Lo("skill://{+path}",{list:async()=>({resources:(await Dt()).flatMap(t=>t.files.map(e=>({uri:e.uri,name:`${t.name}/${e.path}`,mimeType:e.mimeType,description:e.path==="SKILL.md"?String(t.frontmatter.description):void 0})))})}),{description:"conform.tools playbook files (signed-in account)"},async t=>{let e=await n0(t.href);if(!e)throw Object.assign(new Error(`No skill file at ${t.href}${(await Dt()).length?"":" (playbooks not loaded: call account_login, then try again)"}`),{code:-32002});let{f:r}=e;return r.mimeType.startsWith("text/")||r.mimeType.endsWith("json")||r.mimeType.endsWith("yaml")?{contents:[{uri:r.uri,mimeType:r.mimeType,text:new TextDecoder().decode(r.bytes)}]}:{contents:[{uri:r.uri,mimeType:r.mimeType,blob:btoa(String.fromCharCode(...r.bytes))}]}});he.server.registerCapabilities({extensions:{[Yi]:{directoryRead:!0}}});var Ti=async t=>{try{return await t()}catch(e){throw e instanceof ea?Object.assign(new Error(e.message),{code:e.code}):e}},Ri=t=>dt.object({method:dt.literal(t),params:dt.object({uri:dt.string().optional(),cursor:dt.string().optional()}).passthrough().optional()});he.server.setRequestHandler(Ri("skills/list"),()=>Ti(ta));he.server.setRequestHandler(Ri("skills/get"),t=>Ti(()=>ra(t.params?.uri)));he.server.setRequestHandler(Ri("resources/directory/read"),t=>Ti(()=>oa(t.params?.uri)));var Qu=he,Wu=Qu.validateToolInput?.bind(he);Wu&&(Qu.validateToolInput=async(t,e,r)=>{let o=pa(r,e);try{let n=await Wu(t,o?{...e,session_id:o}:e,r);return o?{...n,[Xu]:o}:n}catch(n){throw ma(r,e),n}});he.server.oninitialized=()=>{let t=he.server.getClientVersion()?.name;sa(t),rn(),(async()=>{let e=Wi(t);if(!e||!await tn())return;let r=await Xi(e);(r.result==="installed"||r.result==="updated")&&console.error(`conformtools: agent hook ${r.result} in ${r.file} \u2014 it records ${Qi}; conformtools hooks off removes it${e==="codex"?"; Codex asks you to trust it once (/hooks)":""}`)})().catch(()=>{})};process.stdin.on("end",()=>void rn({force:!0}));await he.connect(new Ho);console.error(`conformtools MCP ready (${nn.length} verbs, ${e0.length} skills, stdio)`);