@prompt-optimizer/mcp-server 0.1.0 → 0.1.1

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 (67) hide show
  1. package/README.md +9 -7
  2. package/dist/browser.js +10 -4200
  3. package/dist/chunk-2AOVKKBT.js +7 -0
  4. package/dist/chunk-5QROM7SH.js +3 -0
  5. package/dist/chunk-7FYOSVIN.js +3 -0
  6. package/dist/chunk-AKXNS3YY.js +4 -0
  7. package/dist/chunk-BBXFEEUH.js +43 -0
  8. package/dist/chunk-CHINCAF5.js +33 -0
  9. package/dist/chunk-EJ2IIPFF.js +3 -0
  10. package/dist/chunk-FLQML3XF.js +64 -0
  11. package/dist/chunk-GA7S5A7R.js +3 -0
  12. package/dist/chunk-IABPRAPS.js +3 -0
  13. package/dist/chunk-JE2EBI2C.js +3 -0
  14. package/dist/chunk-JL6XIA4S.js +4 -0
  15. package/dist/chunk-JXWLV6TC.js +12 -0
  16. package/dist/chunk-MUXGFCOV.js +7012 -0
  17. package/dist/chunk-NT2DBZVA.js +3 -0
  18. package/dist/chunk-NVZFDKDX.js +3 -0
  19. package/dist/chunk-PKJ2PK6J.js +106 -0
  20. package/dist/chunk-SDHFVY4F.js +6 -0
  21. package/dist/chunk-TWLLFRFQ.js +6 -0
  22. package/dist/desktop-business.js +4 -1225
  23. package/dist/desktop-comparison-UIIN3WK4.js +3 -0
  24. package/dist/desktop-storage-KJWV2A3P.js +3 -0
  25. package/dist/desktop.js +1 -24
  26. package/dist/dist-OM6QMJNC.js +10 -0
  27. package/dist/dist-YR425RV6.js +3 -0
  28. package/dist/index.js +1 -10
  29. package/dist/legacy.js +97 -26634
  30. package/dist/multipart-parser-XGXMMB2Z.js +4 -0
  31. package/dist/node-2SMUH4FH.js +3 -0
  32. package/dist/node-NX6BPYD5.js +3 -0
  33. package/dist/node-U7LDATXE.js +17 -0
  34. package/dist/registry-H5F4DGAM-2GPEVJMD.js +3 -0
  35. package/dist/src-3F22P42W.js +5 -0
  36. package/dist/start.js +2 -13
  37. package/package.json +10 -1
  38. package/preload-env.cjs +3 -352
  39. package/dist/chunk-3FYJ3FRD.js +0 -57
  40. package/dist/chunk-E7Z4Y3F4.js +0 -36402
  41. package/dist/chunk-GBDJTSRW.js +0 -298
  42. package/dist/chunk-HLCN3DLS.js +0 -19745
  43. package/dist/chunk-HYVN7FZZ.js +0 -4787
  44. package/dist/chunk-MEUCFQGU.js +0 -537
  45. package/dist/chunk-N6AUTPPS.js +0 -10647
  46. package/dist/chunk-Q52SACHI.js +0 -304
  47. package/dist/chunk-Q5B3KFB3.js +0 -31
  48. package/dist/chunk-QSPNNVX3.js +0 -49017
  49. package/dist/chunk-SO4YJHYW.js +0 -13450
  50. package/dist/chunk-SV2GETJH.js +0 -65
  51. package/dist/chunk-TFH2LO2H.js +0 -58
  52. package/dist/chunk-TFJEYQ3G.js +0 -786
  53. package/dist/chunk-TLOFCHZI.js +0 -70
  54. package/dist/chunk-TQGHULC7.js +0 -188
  55. package/dist/chunk-UTOMPKTK.js +0 -2209
  56. package/dist/chunk-XXALDAL7.js +0 -1838
  57. package/dist/chunk-YT3U6B54.js +0 -21
  58. package/dist/desktop-comparison-HDIQ6K45.js +0 -22
  59. package/dist/desktop-storage-YRABQCLF.js +0 -14
  60. package/dist/dist-O5VNBF5I.js +0 -622
  61. package/dist/dist-UMX52UME.js +0 -481
  62. package/dist/multipart-parser-XE6WGDAU.js +0 -373
  63. package/dist/node-2RBNZOSK.js +0 -2225
  64. package/dist/node-4Z3USCHW.js +0 -21
  65. package/dist/node-QHGLD5ST.js +0 -25
  66. package/dist/registry-H5F4DGAM-UHR4F6LL.js +0 -13
  67. package/dist/src-7PBMYCGI.js +0 -1398
@@ -0,0 +1,3 @@
1
+ import { createRequire as __mcpCreateRequire } from "node:module";
2
+ const require = __mcpCreateRequire(import.meta.url);
3
+ import{a as r}from"./chunk-NT2DBZVA.js";var c=async n=>{try{let{openExistingDesktopStorage:i}=await import("./node-2SMUH4FH.js"),o=await i(n);if(!o.provider.readOnly)throw await o.provider.close(),new r("SOURCE_NOT_READY");return o}catch{throw new r("SOURCE_NOT_READY")}};function s(n,i){let o=n?.params?.reason;return typeof o=="string"&&o===i}var D=async(n,i)=>{let o;try{let t=await import("./node-2SMUH4FH.js");try{o=await t.openExistingDesktopStorageForWriting(n)}catch(e){throw s(e,t.DESKTOP_STORAGE_DIVERGENCE_REASON)?new r("SOURCE_DATA_DIVERGED"):e}if(o.provider.readOnly)throw new r("SOURCE_NOT_READY");let a=await import("./desktop-comparison-UIIN3WK4.js"),p=a.createTextComparisonService({storage:o.provider,executionSource:i});return{...o,comparison:{runner:p,repository:a.createComparisonRepository(o.provider),errorCode(e){return s(e,t.DESKTOP_STORAGE_DIVERGENCE_REASON)?"SOURCE_DATA_DIVERGED":e instanceof a.TextComparisonError||e instanceof a.ComparisonRepositoryError||e instanceof a.AssetReadError?e.code:void 0}}}}catch(t){if(o)try{await o.provider.close()}catch{throw new r("SOURCE_CLOSE_FAILED")}throw t instanceof r?t:new r("SOURCE_NOT_READY")}};export{c as a,D as b};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __mcpCreateRequire } from "node:module";
2
+ const require = __mcpCreateRequire(import.meta.url);
3
+ import{a as s}from"./chunk-NT2DBZVA.js";import{isAbsolute as c}from"node:path";function l(t){if(t.includes("--mode"))throw new s("INVALID_INPUT");let r=t.filter(o=>o.startsWith("--mode="));if(r.length>1)throw new s("INVALID_INPUT");let e=r[0]?.slice(7)??"legacy",i=t.filter(o=>o.startsWith("--desktop-profile="));if(e==="browser"){if(t.some(o=>o!=="--mode=browser"&&o!=="--transport=stdio")||t.filter(o=>o.startsWith("--transport=")).length>1)throw new s("INVALID_INPUT");return{mode:e}}if(e==="legacy"){if(t.some(o=>o.startsWith("--desktop-")))throw new s("INVALID_INPUT");return{mode:e}}if(e!=="desktop-readonly"&&e!=="desktop-comparison"&&e!=="desktop")throw new s("INVALID_INPUT");if(t.some(o=>!o.startsWith("--desktop-profile=")&&o!==r[0]&&o!=="--transport=stdio"))throw new s("INVALID_INPUT");if(i.length<1||i.length>8||t.filter(o=>o.startsWith("--transport=")).length>1)throw new s("INVALID_INPUT");let p=i.map((o,n)=>{let a=o.slice(18);if(!c(a))throw new s("INVALID_INPUT");return{label:`Desktop profile ${n+1}`,userDataPath:a}});return{mode:e,profiles:p}}async function h(t=process.argv.slice(2),r={}){let e=l(t);if(e.mode==="desktop"){console.log=console.info=console.debug=console.warn=console.error=()=>{};let{startDesktopBusinessStdio:o}=await import("./desktop-business.js");return o(e.profiles)}if(e.mode==="browser")return(await import("./browser.js")).startBrowserStdio();if(e.mode==="desktop-readonly"){let o=r.desktopMain??(await import("./desktop.js")).startDesktopReadonlyStdio,n=r.openDesktop??(await import("./desktop-storage-KJWV2A3P.js")).openReadonlyDesktop;return o(e.profiles,n)}if(e.mode==="desktop-comparison"){let o=r.desktopComparisonMain??(await import("./desktop.js")).startDesktopComparisonStdio,n=r.openDesktopComparison??(await import("./desktop-storage-KJWV2A3P.js")).openComparisonDesktop;return o(e.profiles,n)}return r.legacyMain?r.legacyMain():((t.find(o=>o.startsWith("--transport="))?.slice(12)??"stdio")==="stdio"&&(console.log=console.error.bind(console),console.info=console.error.bind(console),console.debug=console.error.bind(console)),await import("../preload-env.cjs"),(await import("./legacy.js")).main())}export{h as a};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __mcpCreateRequire } from "node:module";
2
+ const require = __mcpCreateRequire(import.meta.url);
3
+ import*as o from"node:child_process";import*as r from"node:crypto";import*as m from"node:fs";import*as s from"node:os";import*as t from"node:path";import*as p from"node:stream";import*as a from"node:util";export{o as a,r as b,m as c,s as d,t as e,p as f,a as g};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __mcpCreateRequire } from "node:module";
2
+ const require = __mcpCreateRequire(import.meta.url);
3
+ import{a as y,b as I,c as h,d as k}from"./chunk-NT2DBZVA.js";import{h as S,i as w,j as R,k as b}from"./chunk-JXWLV6TC.js";var s={type:"string",minLength:1},g={limit:{type:"integer",minimum:1,maximum:100},cursor:s},x={favoriteId:s,assetId:s,expectedRevision:s},_={readOnlyHint:!0,destructiveHint:!1},u={readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1};function l(t,e){return{type:"object",properties:t,required:e,additionalProperties:!1}}function c(t,e){return l({connectionId:s,...t},["connectionId",...e])}function p(t,e,o,a=_){return{name:t,description:e,inputSchema:o,annotations:a}}var T=c({source:l({favoriteId:s,assetId:s,versionId:s,expectedRevision:s},["favoriteId","assetId","versionId","expectedRevision"]),variables:{type:"object",additionalProperties:{type:"string"},propertyNames:{not:{enum:["__proto__","constructor","prototype"]}}},candidatePrompt:l({kind:{type:"string",enum:["draft","saved-version"]},text:s,versionId:s},["kind"]),candidates:{type:"array",minItems:2,maxItems:2,items:l({id:{type:"string",enum:["a","b"]},configKey:s,expectedRevision:s},["id","configKey","expectedRevision"])}},["source","variables","candidates"]),C=[p("po_tests_prepare","Preview a variable-workspace favorite with two different saved model configurations. To compare prompts under the same model, pass candidatePrompt as a draft with text or a saved-version with versionId and use the same model configuration and revision for A and B.",T,u),p("po_tests_execute","Start both prepared model requests. This sends the previewed prompt to the saved model endpoints using the MCP Node runtime network settings and can incur charges.",c({preparedId:s,previewRevision:s},["preparedId","previewRevision"]),{...u,openWorldHint:!0}),p("po_tests_get","Read the current state and outputs of both candidates for a prepared comparison.",c({preparedId:s},["preparedId"])),p("po_tests_cancel","Cancel an active comparison or a single candidate by runId. Any partial output already received is retained.",c({preparedId:s,runId:s},["preparedId"]),u),p("po_comparisons_save","Save both completed results. Reuse the same saveKey after an uncertain response. The returned comparisonId opens the result in the desktop variable workspace.",c({preparedId:s,saveKey:s},["preparedId","saveKey"]),{...u,idempotentHint:!0}),p("po_comparisons_list","List saved comparison summaries for this desktop source.",c({...g,favoriteId:s},[])),p("po_comparisons_get","Read a saved comparison, including its frozen input and both outcomes.",c({comparisonId:s},["comparisonId"])),p("po_comparisons_delete","Permanently delete the selected saved comparison using its current revision.",c({comparisonId:s,expectedRevision:s},["comparisonId","expectedRevision"]),{...u,destructiveHint:!0,idempotentHint:!0})];function P(t){let e=t==="compare",o=[p("po_sources_list","List configured desktop source labels without opening storage.",l({},[])),p("po_sources_open",e?"Open one configured migrated desktop source with comparison execution and storage permissions.":"Open one configured migrated desktop source for reading only.",l({sourceId:s,access:{type:"string",enum:[t]}},["sourceId","access"]),e?u:_),p("po_sources_close",e?"Cancel active requests, release this source, and invalidate its prepared comparisons and revisions.":"Close this connection and invalidate its reader revisions.",c({},[]),e?u:_),p("po_models_list",e?"List saved model descriptions and whether each can run a text comparison.":"List saved model descriptions; execution is unavailable.",c(g,[])),p("po_assets_list","List saved prompt assets without contents or private metadata.",c({...g,modeKey:s,query:{type:"string"}},[])),p("po_assets_list_versions","List the versions of a saved prompt in descending version order. Use the returned version ID and asset revision to read the requested version.",c({...x,...g},["favoriteId","assetId"])),p("po_assets_get_version","Read one exact saved or legacy current text version.",c({...x,versionId:s},["favoriteId","assetId","versionId"]))];return e?[...o,...C]:o}function j(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function v(t,e){switch(t.type){case"string":return typeof e=="string"&&(!t.minLength||e.trim().length>=t.minLength)&&(!t.enum||t.enum.includes(e));case"integer":return typeof e=="number"&&Number.isSafeInteger(e)&&e>=t.minimum&&e<=t.maximum;case"array":return Array.isArray(e)&&e.length>=t.minItems&&e.length<=t.maxItems&&e.every(o=>v(t.items,o));case"object":return j(e)?"properties"in t?t.required.every(o=>Object.hasOwn(e,o))&&Object.entries(e).every(([o,a])=>Object.hasOwn(t.properties,o)&&v(t.properties[o],a)):Object.entries(e).every(([o,a])=>!t.propertyNames.not.enum.includes(o)&&v(t.additionalProperties,a)):!1}}function A(t,e){let o=P(t),a=new Map(o.map(d=>[d.name,d]));return{specs:o,has:d=>a.has(d),async call(d,m){let i=a.get(d);if(!i)throw new y("UNKNOWN_TOOL");if(!v(i.inputSchema,m))throw new y("INVALID_INPUT");let{connectionId:n,...r}=m,f={limit:r.limit,cursor:r.cursor};switch(d){case"po_sources_list":return e.listSources();case"po_sources_open":return e.open(r.sourceId,r.access);case"po_sources_close":return e.close(n);case"po_models_list":return e.listModels(n,f);case"po_assets_list":return e.listAssets(n,{...f,modeKey:r.modeKey,query:r.query});case"po_assets_list_versions":return e.listAssetVersions(n,{favoriteId:r.favoriteId,assetId:r.assetId,expectedRevision:r.expectedRevision},f);case"po_assets_get_version":return e.getAssetVersion(n,r);case"po_tests_prepare":return e.prepare(n,r);case"po_tests_execute":return e.execute(n,r.preparedId,r.previewRevision);case"po_tests_get":return e.getTest(n,r.preparedId);case"po_tests_cancel":return e.cancel(n,r.preparedId,r.runId);case"po_comparisons_save":return e.saveComparison(n,r.preparedId,r.saveKey);case"po_comparisons_list":return e.listComparisons(n,{...f,favoriteId:r.favoriteId});case"po_comparisons_get":return e.getComparison(n,r.comparisonId);case"po_comparisons_delete":return e.deleteComparison(n,r.comparisonId,r.expectedRevision);default:throw new y("UNKNOWN_TOOL")}}}}function O(t,e){let o=A(t,e),a=new R({name:t==="compare"?"prompt-optimizer-desktop-comparison":"prompt-optimizer-desktop-readonly",version:"0.1.1"},{capabilities:{tools:{}}});return a.setRequestHandler(S,async()=>({tools:o.specs})),a.setRequestHandler(w,async d=>{try{let{name:m,arguments:i}=d.params,n=await o.call(m,i??{});return{structuredContent:n,content:[{type:"text",text:JSON.stringify(n)}]}}catch(m){let i={error:k(m,t)};return{isError:!0,structuredContent:i,content:[{type:"text",text:JSON.stringify(i)}]}}}),a.onclose=()=>{e.dispose().catch(()=>{})},{server:a,router:e}}function N(t,e){return O("read",I(t,e))}function L(t,e){return O("compare",h(t,e))}async function D(t,{server:e,router:o}){let a,d=!1,m=()=>(a??=(async()=>{process.stdin.off("end",i),process.stdin.off("close",i),process.off("SIGINT",i),process.off("SIGTERM",i);try{await o.dispose()}finally{try{await e.close()}finally{process.stdin.pause(),process.stdin.destroy()}}})(),a),i=()=>{m().catch(()=>{let n=t==="compare"?"comparison":"readonly";d||process.stderr.write(`Desktop ${n} shutdown failed (SOURCE_CLOSE_FAILED).
4
+ `),d=!0,process.exitCode=1})};e.onclose=i,process.stdin.once("end",i),process.stdin.once("close",i),process.once("SIGINT",i),process.once("SIGTERM",i);try{await e.connect(new b)}catch{throw await m(),new y("SOURCE_OPEN_FAILED")}return{server:e,router:o,close:m}}function H(t,e){return D("read",N(t,e))}function M(t,e){return D("compare",L(t,e))}export{P as a,v as b,A as c,N as d,L as e,H as f,M as g};
@@ -0,0 +1,12 @@
1
+ import { createRequire as __mcpCreateRequire } from "node:module";
2
+ const require = __mcpCreateRequire(import.meta.url);
3
+ import{a as Ps,b as f,c as D,d as Q,e as Yo,f as G,g as N,h as $,i as ae,j as Z,k as Es,l as xs,m as V,n as me,o as S,p as K,q as Xo,r as Ts,s as ea}from"./chunk-FLQML3XF.js";import{c as v,e as Wo}from"./chunk-EJ2IIPFF.js";var Ut=v(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.regexpCode=M.getEsmExportName=M.getProperty=M.safeStringify=M.stringify=M.strConcat=M.addCodeArg=M.str=M._=M.nil=M._Code=M.Name=M.IDENTIFIER=M._CodeOrName=void 0;var Lt=class{};M._CodeOrName=Lt;M.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qe=class extends Lt{constructor(e){if(super(),!M.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}}};M.Name=Qe;var _e=class extends Lt{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,s)=>`${r}${s}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,s)=>(s instanceof Qe&&(r[s.str]=(r[s.str]||0)+1),r),{})}};M._Code=_e;M.nil=new _e("");function va(t,...e){let r=[t[0]],s=0;for(;s<e.length;)Qs(r,e[s]),r.push(t[++s]);return new _e(r)}M._=va;var Bs=new _e("+");function $a(t,...e){let r=[Vt(t[0])],s=0;for(;s<e.length;)r.push(Bs),Qs(r,e[s]),r.push(Bs,Vt(t[++s]));return hd(r),new _e(r)}M.str=$a;function Qs(t,e){e instanceof _e?t.push(...e._items):e instanceof Qe?t.push(e):t.push(_d(e))}M.addCodeArg=Qs;function hd(t){let e=1;for(;e<t.length-1;){if(t[e]===Bs){let r=gd(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function gd(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Qe||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 Qe))return`"${t}${e.slice(1)}`}function yd(t,e){return e.emptyStr()?t:t.emptyStr()?e:$a`${t}${e}`}M.strConcat=yd;function _d(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Vt(Array.isArray(t)?t.join(","):t)}function vd(t){return new _e(Vt(t))}M.stringify=vd;function Vt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}M.safeStringify=Vt;function $d(t){return typeof t=="string"&&M.IDENTIFIER.test(t)?new _e(`.${t}`):va`[${t}]`}M.getProperty=$d;function bd(t){if(typeof t=="string"&&M.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}M.getEsmExportName=bd;function Sd(t){return new _e(t.toString())}M.regexpCode=Sd});var Xs=v(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.ValueScope=ue.ValueScopeName=ue.Scope=ue.varKinds=ue.UsedValueState=void 0;var le=Ut(),Ws=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Cr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Cr||(ue.UsedValueState=Cr={}));ue.varKinds={const:new le.Name("const"),let:new le.Name("let"),var:new le.Name("var")};var Ar=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof le.Name?e:this.name(e)}name(e){return new le.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,s;if(!((s=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||s===void 0)&&s.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}}};ue.Scope=Ar;var Mr=class extends le.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:s}){this.value=e,this.scopePath=(0,le._)`.${new le.Name(r)}[${s}]`}};ue.ValueScopeName=Mr;var wd=(0,le._)`\n`,Ys=class extends Ar{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?wd:le.nil}}get(){return this._scope}name(e){return new Mr(e,this._newName(e))}value(e,r){var s;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,a=(s=r.key)!==null&&s!==void 0?s:r.ref,i=this._values[o];if(i){let l=i.get(a);if(l)return l}else i=this._values[o]=new Map;i.set(a,n);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:o,itemIndex:u}),n}getValue(e,r){let s=this._values[e];if(s)return s.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,s=>{if(s.scopePath===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return(0,le._)`${e}${s.scopePath}`})}scopeCode(e=this._values,r,s){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,s)}_reduceValues(e,r,s={},n){let o=le.nil;for(let a in e){let i=e[a];if(!i)continue;let c=s[a]=s[a]||new Map;i.forEach(u=>{if(c.has(u))return;c.set(u,Cr.Started);let l=r(u);if(l){let d=this.opts.es5?ue.varKinds.var:ue.varKinds.const;o=(0,le._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))o=(0,le._)`${o}${l}${this.opts._n}`;else throw new Ws(u);c.set(u,Cr.Completed)})}return o}};ue.ValueScope=Ys});var T=v(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 O=Ut(),Se=Xs(),Ve=Ut();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return Ve._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return Ve.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return Ve.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return Ve.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return Ve.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return Ve.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return Ve.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return Ve.Name}});var Vr=Xs();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return Vr.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return Vr.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return Vr.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return Vr.varKinds}});I.operators={GT:new O._Code(">"),GTE:new O._Code(">="),LT:new O._Code("<"),LTE:new O._Code("<="),EQ:new O._Code("==="),NEQ:new O._Code("!=="),NOT:new O._Code("!"),OR:new O._Code("||"),AND:new O._Code("&&"),ADD:new O._Code("+")};var je=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},en=class extends je{constructor(e,r,s){super(),this.varKind=e,this.name=r,this.rhs=s}render({es5:e,_n:r}){let s=e?Se.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${s} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=pt(this.rhs,e,r)),this}get names(){return this.rhs instanceof O._CodeOrName?this.rhs.names:{}}},Dr=class extends je{constructor(e,r,s){super(),this.lhs=e,this.rhs=r,this.sideEffects=s}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof O.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=pt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof O.Name?{}:{...this.lhs.names};return Lr(e,this.rhs)}},tn=class extends Dr{constructor(e,r,s,n){super(e,s,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},rn=class extends je{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},sn=class extends je{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},nn=class extends je{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},on=class extends je{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=pt(this.code,e,r),this}get names(){return this.code instanceof O._CodeOrName?this.code.names:{}}},Ht=class extends je{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,s)=>r+s.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let s=e[r].optimizeNodes();Array.isArray(s)?e.splice(r,1,...s):s?e[r]=s:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:s}=this,n=s.length;for(;n--;){let o=s[n];o.optimizeNames(e,r)||(zd(e,o.names),s.splice(n,1))}return s.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Xe(e,r.names),{})}},Ce=class extends Ht{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},an=class extends Ht{},ft=class extends Ce{};ft.kind="else";var We=class t extends Ce{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 s=r.optimizeNodes();r=this.else=Array.isArray(s)?new ft(s):s}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ba(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var s;if(this.else=(s=this.else)===null||s===void 0?void 0:s.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=pt(this.condition,e,r),this}get names(){let e=super.names;return Lr(e,this.condition),this.else&&Xe(e,this.else.names),e}};We.kind="if";var Ye=class extends Ce{};Ye.kind="for";var cn=class extends Ye{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=pt(this.iteration,e,r),this}get names(){return Xe(super.names,this.iteration.names)}},ln=class extends Ye{constructor(e,r,s,n){super(),this.varKind=e,this.name=r,this.from=s,this.to=n}render(e){let r=e.es5?Se.varKinds.var:this.varKind,{name:s,from:n,to:o}=this;return`for(${r} ${s}=${n}; ${s}<${o}; ${s}++)`+super.render(e)}get names(){let e=Lr(super.names,this.from);return Lr(e,this.to)}},Fr=class extends Ye{constructor(e,r,s,n){super(),this.loop=e,this.varKind=r,this.name=s,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=pt(this.iterable,e,r),this}get names(){return Xe(super.names,this.iterable.names)}},Zt=class extends Ce{constructor(e,r,s){super(),this.name=e,this.args=r,this.async=s}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Zt.kind="func";var Kt=class extends Ht{render(e){return"return "+super.render(e)}};Kt.kind="return";var un=class extends Ce{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 s,n;return super.optimizeNames(e,r),(s=this.catch)===null||s===void 0||s.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Xe(e,this.catch.names),this.finally&&Xe(e,this.finally.names),e}},Gt=class extends Ce{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Gt.kind="catch";var Jt=class extends Ce{render(e){return"finally"+super.render(e)}};Jt.kind="finally";var dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
+ `:""},this._extScope=e,this._scope=new Se.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 s=this._extScope.value(e,r);return(this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}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,s,n){let o=this._scope.toName(r);return s!==void 0&&n&&(this._constants[o.str]=s),this._leafNode(new en(e,o,s)),o}const(e,r,s){return this._def(Se.varKinds.const,e,r,s)}let(e,r,s){return this._def(Se.varKinds.let,e,r,s)}var(e,r,s){return this._def(Se.varKinds.var,e,r,s)}assign(e,r,s){return this._leafNode(new Dr(e,r,s))}add(e,r){return this._leafNode(new tn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==O.nil&&this._leafNode(new on(e)),this}object(...e){let r=["{"];for(let[s,n]of e)r.length>1&&r.push(","),r.push(s),(s!==n||this.opts.es5)&&(r.push(":"),(0,O.addCodeArg)(r,n));return r.push("}"),new O._Code(r)}if(e,r,s){if(this._blockNode(new We(e)),r&&s)this.code(r).else().code(s).endIf();else if(r)this.code(r).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new We(e))}else(){return this._elseNode(new ft)}endIf(){return this._endBlockNode(We,ft)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new cn(e),r)}forRange(e,r,s,n,o=this.opts.es5?Se.varKinds.var:Se.varKinds.let){let a=this._scope.toName(e);return this._for(new ln(o,a,r,s),()=>n(a))}forOf(e,r,s,n=Se.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let a=r instanceof O.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,O._)`${a}.length`,i=>{this.var(o,(0,O._)`${a}[${i}]`),s(o)})}return this._for(new Fr("of",n,o,r),()=>s(o))}forIn(e,r,s,n=this.opts.es5?Se.varKinds.var:Se.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,O._)`Object.keys(${r})`,s);let o=this._scope.toName(e);return this._for(new Fr("in",n,o,r),()=>s(o))}endFor(){return this._endBlockNode(Ye)}label(e){return this._leafNode(new rn(e))}break(e){return this._leafNode(new sn(e))}return(e){let r=new Kt;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Kt)}try(e,r,s){if(!r&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new un;if(this._blockNode(n),this.code(e),r){let o=this.name("e");this._currNode=n.catch=new Gt(o),r(o)}return s&&(this._currNode=n.finally=new Jt,this.code(s)),this._endBlockNode(Gt,Jt)}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 s=this._nodes.length-r;if(s<0||e!==void 0&&s!==e)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=O.nil,s,n){return this._blockNode(new Zt(e,r,s)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Zt)}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 s=this._currNode;if(s instanceof e||r&&s 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 We))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=dn;function Xe(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Lr(t,e){return e instanceof O._CodeOrName?Xe(t,e.names):t}function pt(t,e,r){if(t instanceof O.Name)return s(t);if(!n(t))return t;return new O._Code(t._items.reduce((o,a)=>(a instanceof O.Name&&(a=s(a)),a instanceof O._Code?o.push(...a._items):o.push(a),o),[]));function s(o){let a=r[o.str];return a===void 0||e[o.str]!==1?o:(delete e[o.str],a)}function n(o){return o instanceof O._Code&&o._items.some(a=>a instanceof O.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function zd(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ba(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,O._)`!${fn(t)}`}I.not=ba;var kd=Sa(I.operators.AND);function Pd(...t){return t.reduce(kd)}I.and=Pd;var Ed=Sa(I.operators.OR);function xd(...t){return t.reduce(Ed)}I.or=xd;function Sa(t){return(e,r)=>e===O.nil?r:r===O.nil?e:(0,O._)`${fn(e)} ${t} ${fn(r)}`}function fn(t){return t instanceof O.Name?t:(0,O._)`(${t})`}});var j=v(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;var L=T(),Td=Ut();function Rd(t){let e={};for(let r of t)e[r]=!0;return e}q.toHash=Rd;function Id(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ka(t,e),!Pa(e,t.self.RULES.all))}q.alwaysValidSchema=Id;function ka(t,e=t.schema){let{opts:r,self:s}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=s.RULES.keywords;for(let o in e)n[o]||Ta(t,`unknown keyword: "${o}"`)}q.checkUnknownRules=ka;function Pa(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}q.schemaHasRules=Pa;function qd(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}q.schemaHasRulesButRef=qd;function Od({topSchemaRef:t,schemaPath:e},r,s,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)(s)}`}q.schemaRefOrVal=Od;function Nd(t){return Ea(decodeURIComponent(t))}q.unescapeFragment=Nd;function jd(t){return encodeURIComponent(mn(t))}q.escapeFragment=jd;function mn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=mn;function Ea(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=Ea;function Cd(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}q.eachItem=Cd;function wa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:s}){return(n,o,a,i)=>{let c=a===void 0?o:a instanceof L.Name?(o instanceof L.Name?t(n,o,a):e(n,o,a),a):o instanceof L.Name?(e(n,a,o),o):r(o,a);return i===L.Name&&!(c instanceof L.Name)?s(n,c):c}}q.mergeEvaluated={props:wa({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} || {}`),hn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:xa}),items:wa({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 xa(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&hn(t,r,e),r}q.evaluatedPropsToName=xa;function hn(t,e,r){Object.keys(r).forEach(s=>t.assign((0,L._)`${e}${(0,L.getProperty)(s)}`,!0))}q.setEvaluated=hn;var za={};function Ad(t,e){return t.scopeValue("func",{ref:e,code:za[e.code]||(za[e.code]=new Td._Code(e.code))})}q.useFunc=Ad;var pn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(pn||(q.Type=pn={}));function Md(t,e,r){if(t instanceof L.Name){let s=e===pn.Num;return r?s?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:s?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+mn(t)}q.getErrorPath=Md;function Ta(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}q.checkStrictMode=Ta});var Ae=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});var re=T(),Dd={data:new re.Name("data"),valCxt:new re.Name("valCxt"),instancePath:new re.Name("instancePath"),parentData:new re.Name("parentData"),parentDataProperty:new re.Name("parentDataProperty"),rootData:new re.Name("rootData"),dynamicAnchors:new re.Name("dynamicAnchors"),vErrors:new re.Name("vErrors"),errors:new re.Name("errors"),this:new re.Name("this"),self:new re.Name("self"),scope:new re.Name("scope"),json:new re.Name("json"),jsonPos:new re.Name("jsonPos"),jsonLen:new re.Name("jsonLen"),jsonPart:new re.Name("jsonPart")};gn.default=Dd});var Bt=v(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.extendErrors=se.resetErrorsCount=se.reportExtraError=se.reportError=se.keyword$DataError=se.keywordError=void 0;var C=T(),Ur=j(),ie=Ae();se.keywordError={message:({keyword:t})=>(0,C.str)`must pass "${t}" keyword validation`};se.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,C.str)`"${t}" keyword must be ${e} ($data)`:(0,C.str)`"${t}" keyword is invalid ($data)`};function Fd(t,e=se.keywordError,r,s){let{it:n}=t,{gen:o,compositeRule:a,allErrors:i}=n,c=qa(t,e,r);s??(a||i)?Ra(o,c):Ia(n,(0,C._)`[${c}]`)}se.reportError=Fd;function Ld(t,e=se.keywordError,r){let{it:s}=t,{gen:n,compositeRule:o,allErrors:a}=s,i=qa(t,e,r);Ra(n,i),o||a||Ia(s,ie.default.vErrors)}se.reportExtraError=Ld;function Vd(t,e){t.assign(ie.default.errors,e),t.if((0,C._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,C._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}se.resetErrorsCount=Vd;function Ud({gen:t,keyword:e,schemaValue:r,data:s,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",n,ie.default.errors,i=>{t.const(a,(0,C._)`${ie.default.vErrors}[${i}]`),t.if((0,C._)`${a}.instancePath === undefined`,()=>t.assign((0,C._)`${a}.instancePath`,(0,C.strConcat)(ie.default.instancePath,o.errorPath))),t.assign((0,C._)`${a}.schemaPath`,(0,C.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,C._)`${a}.schema`,r),t.assign((0,C._)`${a}.data`,s))})}se.extendErrors=Ud;function Ra(t,e){let r=t.const("err",e);t.if((0,C._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,C._)`[${r}]`),(0,C._)`${ie.default.vErrors}.push(${r})`),t.code((0,C._)`${ie.default.errors}++`)}function Ia(t,e){let{gen:r,validateName:s,schemaEnv:n}=t;n.$async?r.throw((0,C._)`new ${t.ValidationError}(${e})`):(r.assign((0,C._)`${s}.errors`,e),r.return(!1))}var et={keyword:new C.Name("keyword"),schemaPath:new C.Name("schemaPath"),params:new C.Name("params"),propertyName:new C.Name("propertyName"),message:new C.Name("message"),schema:new C.Name("schema"),parentSchema:new C.Name("parentSchema")};function qa(t,e,r){let{createErrors:s}=t.it;return s===!1?(0,C._)`{}`:Hd(t,e,r)}function Hd(t,e,r={}){let{gen:s,it:n}=t,o=[Zd(n,r),Kd(t,r)];return Gd(t,e,o),s.object(...o)}function Zd({errorPath:t},{instancePath:e}){let r=e?(0,C.str)`${t}${(0,Ur.getErrorPath)(e,Ur.Type.Str)}`:t;return[ie.default.instancePath,(0,C.strConcat)(ie.default.instancePath,r)]}function Kd({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:s}){let n=s?e:(0,C.str)`${e}/${t}`;return r&&(n=(0,C.str)`${n}${(0,Ur.getErrorPath)(r,Ur.Type.Str)}`),[et.schemaPath,n]}function Gd(t,{params:e,message:r},s){let{keyword:n,data:o,schemaValue:a,it:i}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=i;s.push([et.keyword,n],[et.params,typeof e=="function"?e(t):e||(0,C._)`{}`]),c.messages&&s.push([et.message,typeof r=="function"?r(t):r]),c.verbose&&s.push([et.schema,a],[et.parentSchema,(0,C._)`${l}${d}`],[ie.default.data,o]),u&&s.push([et.propertyName,u])}});var Na=v(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.boolOrEmptySchema=mt.topBoolOrEmptySchema=void 0;var Jd=Bt(),Bd=T(),Qd=Ae(),Wd={message:"boolean schema is false"};function Yd(t){let{gen:e,schema:r,validateName:s}=t;r===!1?Oa(t,!1):typeof r=="object"&&r.$async===!0?e.return(Qd.default.data):(e.assign((0,Bd._)`${s}.errors`,null),e.return(!0))}mt.topBoolOrEmptySchema=Yd;function Xd(t,e){let{gen:r,schema:s}=t;s===!1?(r.var(e,!1),Oa(t)):r.var(e,!0)}mt.boolOrEmptySchema=Xd;function Oa(t,e){let{gen:r,data:s}=t,n={gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Jd.reportError)(n,Wd,void 0,e)}});var yn=v(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getRules=ht.isJSONType=void 0;var ef=["string","number","integer","boolean","null","object","array"],tf=new Set(ef);function rf(t){return typeof t=="string"&&tf.has(t)}ht.isJSONType=rf;function sf(){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:{}}}ht.getRules=sf});var _n=v(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function nf({schema:t,self:e},r){let s=e.RULES.types[r];return s&&s!==!0&&ja(t,s)}Ue.schemaHasRulesForType=nf;function ja(t,e){return e.rules.some(r=>Ca(t,r))}Ue.shouldUseGroup=ja;function Ca(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(s=>t[s]!==void 0))}Ue.shouldUseRule=Ca});var Qt=v(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.reportTypeError=ne.checkDataTypes=ne.checkDataType=ne.coerceAndCheckDataType=ne.getJSONTypes=ne.getSchemaTypes=ne.DataType=void 0;var of=yn(),af=_n(),cf=Bt(),x=T(),Aa=j(),gt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(gt||(ne.DataType=gt={}));function lf(t){let e=Ma(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}ne.getSchemaTypes=lf;function Ma(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(of.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ne.getJSONTypes=Ma;function uf(t,e){let{gen:r,data:s,opts:n}=t,o=df(e,n.coerceTypes),a=e.length>0&&!(o.length===0&&e.length===1&&(0,af.schemaHasRulesForType)(t,e[0]));if(a){let i=$n(e,s,n.strictNumbers,gt.Wrong);r.if(i,()=>{o.length?ff(t,e,o):bn(t)})}return a}ne.coerceAndCheckDataType=uf;var Da=new Set(["string","number","integer","boolean","null"]);function df(t,e){return e?t.filter(r=>Da.has(r)||e==="array"&&r==="array"):[]}function ff(t,e,r){let{gen:s,data:n,opts:o}=t,a=s.let("dataType",(0,x._)`typeof ${n}`),i=s.let("coerced",(0,x._)`undefined`);o.coerceTypes==="array"&&s.if((0,x._)`${a} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>s.assign(n,(0,x._)`${n}[0]`).assign(a,(0,x._)`typeof ${n}`).if($n(e,n,o.strictNumbers),()=>s.assign(i,n))),s.if((0,x._)`${i} !== undefined`);for(let u of r)(Da.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);s.else(),bn(t),s.endIf(),s.if((0,x._)`${i} !== undefined`,()=>{s.assign(n,i),pf(t,i)});function c(u){switch(u){case"string":s.elseIf((0,x._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0,x._)`"" + ${n}`).elseIf((0,x._)`${n} === null`).assign(i,(0,x._)`""`);return;case"number":s.elseIf((0,x._)`${a} == "boolean" || ${n} === null
5
+ || (${a} == "string" && ${n} && ${n} == +${n})`).assign(i,(0,x._)`+${n}`);return;case"integer":s.elseIf((0,x._)`${a} === "boolean" || ${n} === null
6
+ || (${a} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(i,(0,x._)`+${n}`);return;case"boolean":s.elseIf((0,x._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(i,!1).elseIf((0,x._)`${n} === "true" || ${n} === 1`).assign(i,!0);return;case"null":s.elseIf((0,x._)`${n} === "" || ${n} === 0 || ${n} === false`),s.assign(i,null);return;case"array":s.elseIf((0,x._)`${a} === "string" || ${a} === "number"
7
+ || ${a} === "boolean" || ${n} === null`).assign(i,(0,x._)`[${n}]`)}}}function pf({gen:t,parentData:e,parentDataProperty:r},s){t.if((0,x._)`${e} !== undefined`,()=>t.assign((0,x._)`${e}[${r}]`,s))}function vn(t,e,r,s=gt.Correct){let n=s===gt.Correct?x.operators.EQ:x.operators.NEQ,o;switch(t){case"null":return(0,x._)`${e} ${n} null`;case"array":o=(0,x._)`Array.isArray(${e})`;break;case"object":o=(0,x._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=a((0,x._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=a();break;default:return(0,x._)`typeof ${e} ${n} ${t}`}return s===gt.Correct?o:(0,x.not)(o);function a(i=x.nil){return(0,x.and)((0,x._)`typeof ${e} == "number"`,i,r?(0,x._)`isFinite(${e})`:x.nil)}}ne.checkDataType=vn;function $n(t,e,r,s){if(t.length===1)return vn(t[0],e,r,s);let n,o=(0,Aa.toHash)(t);if(o.array&&o.object){let a=(0,x._)`typeof ${e} != "object"`;n=o.null?a:(0,x._)`!${e} || ${a}`,delete o.null,delete o.array,delete o.object}else n=x.nil;o.number&&delete o.integer;for(let a in o)n=(0,x.and)(n,vn(a,e,r,s));return n}ne.checkDataTypes=$n;var mf={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,x._)`{type: ${t}}`:(0,x._)`{type: ${e}}`};function bn(t){let e=hf(t);(0,cf.reportError)(e,mf)}ne.reportTypeError=bn;function hf(t){let{gen:e,data:r,schema:s}=t,n=(0,Aa.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:t}}});var La=v(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.assignDefaults=void 0;var yt=T(),gf=j();function yf(t,e){let{properties:r,items:s}=t.schema;if(e==="object"&&r)for(let n in r)Fa(t,n,r[n].default);else e==="array"&&Array.isArray(s)&&s.forEach((n,o)=>Fa(t,o,n.default))}Hr.assignDefaults=yf;function Fa(t,e,r){let{gen:s,compositeRule:n,data:o,opts:a}=t;if(r===void 0)return;let i=(0,yt._)`${o}${(0,yt.getProperty)(e)}`;if(n){(0,gf.checkStrictMode)(t,`default is ignored for: ${i}`);return}let c=(0,yt._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0,yt._)`${c} || ${i} === null || ${i} === ""`),s.if(c,(0,yt._)`${i} = ${(0,yt.stringify)(r)}`)}});var ve=v(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.validateUnion=F.validateArray=F.usePattern=F.callValidateCode=F.schemaProperties=F.allSchemaProperties=F.noPropertyInData=F.propertyInData=F.isOwnProperty=F.hasPropFunc=F.reportMissingProp=F.checkMissingProp=F.checkReportMissingProp=void 0;var U=T(),Sn=j(),He=Ae(),_f=j();function vf(t,e){let{gen:r,data:s,it:n}=t;r.if(zn(r,s,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,U._)`${e}`},!0),t.error()})}F.checkReportMissingProp=vf;function $f({gen:t,data:e,it:{opts:r}},s,n){return(0,U.or)(...s.map(o=>(0,U.and)(zn(t,e,o,r.ownProperties),(0,U._)`${n} = ${o}`)))}F.checkMissingProp=$f;function bf(t,e){t.setParams({missingProperty:e},!0),t.error()}F.reportMissingProp=bf;function Va(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,U._)`Object.prototype.hasOwnProperty`})}F.hasPropFunc=Va;function wn(t,e,r){return(0,U._)`${Va(t)}.call(${e}, ${r})`}F.isOwnProperty=wn;function Sf(t,e,r,s){let n=(0,U._)`${e}${(0,U.getProperty)(r)} !== undefined`;return s?(0,U._)`${n} && ${wn(t,e,r)}`:n}F.propertyInData=Sf;function zn(t,e,r,s){let n=(0,U._)`${e}${(0,U.getProperty)(r)} === undefined`;return s?(0,U.or)(n,(0,U.not)(wn(t,e,r))):n}F.noPropertyInData=zn;function Ua(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}F.allSchemaProperties=Ua;function wf(t,e){return Ua(e).filter(r=>!(0,Sn.alwaysValidSchema)(t,e[r]))}F.schemaProperties=wf;function zf({schemaCode:t,data:e,it:{gen:r,topSchemaRef:s,schemaPath:n,errorPath:o},it:a},i,c,u){let l=u?(0,U._)`${t}, ${e}, ${s}${n}`:e,d=[[He.default.instancePath,(0,U.strConcat)(He.default.instancePath,o)],[He.default.parentData,a.parentData],[He.default.parentDataProperty,a.parentDataProperty],[He.default.rootData,He.default.rootData]];a.opts.dynamicRef&&d.push([He.default.dynamicAnchors,He.default.dynamicAnchors]);let h=(0,U._)`${l}, ${r.object(...d)}`;return c!==U.nil?(0,U._)`${i}.call(${c}, ${h})`:(0,U._)`${i}(${h})`}F.callValidateCode=zf;var kf=(0,U._)`new RegExp`;function Pf({gen:t,it:{opts:e}},r){let s=e.unicodeRegExp?"u":"",{regExp:n}=e.code,o=n(r,s);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,U._)`${n.code==="new RegExp"?kf:(0,_f.useFunc)(t,n)}(${r}, ${s})`})}F.usePattern=Pf;function Ef(t){let{gen:e,data:r,keyword:s,it:n}=t,o=e.name("valid");if(n.allErrors){let i=e.let("valid",!0);return a(()=>e.assign(i,!1)),i}return e.var(o,!0),a(()=>e.break()),o;function a(i){let c=e.const("len",(0,U._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:Sn.Type.Num},o),e.if((0,U.not)(o),i)})}}F.validateArray=Ef;function xf(t){let{gen:e,schema:r,keyword:s,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Sn.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let a=e.let("valid",!1),i=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:s,schemaProp:u,compositeRule:!0},i);e.assign(a,(0,U._)`${a} || ${i}`),t.mergeValidEvaluated(l,i)||e.if((0,U.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}F.validateUnion=xf});var Ka=v(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.validateKeywordUsage=xe.validSchemaType=xe.funcKeywordCode=xe.macroKeywordCode=void 0;var ce=T(),tt=Ae(),Tf=ve(),Rf=Bt();function If(t,e){let{gen:r,keyword:s,schema:n,parentSchema:o,it:a}=t,i=e.macro.call(a.self,n,o,a),c=Za(r,s,i);a.opts.validateSchema!==!1&&a.self.validateSchema(i,!0);let u=r.name("valid");t.subschema({schema:i,schemaPath:ce.nil,errSchemaPath:`${a.errSchemaPath}/${s}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}xe.macroKeywordCode=If;function qf(t,e){var r;let{gen:s,keyword:n,schema:o,parentSchema:a,$data:i,it:c}=t;Nf(c,e);let u=!i&&e.compile?e.compile.call(c.self,o,a,c):e.validate,l=Za(s,n,u),d=s.let("valid");t.block$data(d,h),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function h(){if(e.errors===!1)m(),e.modifying&&Ha(t),y(()=>t.error());else{let _=e.async?g():p();e.modifying&&Ha(t),y(()=>Of(t,_))}}function g(){let _=s.let("ruleErrs",null);return s.try(()=>m((0,ce._)`await `),b=>s.assign(d,!1).if((0,ce._)`${b} instanceof ${c.ValidationError}`,()=>s.assign(_,(0,ce._)`${b}.errors`),()=>s.throw(b))),_}function p(){let _=(0,ce._)`${l}.errors`;return s.assign(_,null),m(ce.nil),_}function m(_=e.async?(0,ce._)`await `:ce.nil){let b=c.opts.passContext?tt.default.this:tt.default.self,z=!("compile"in e&&!i||e.schema===!1);s.assign(d,(0,ce._)`${_}${(0,Tf.callValidateCode)(t,l,b,z)}`,e.modifying)}function y(_){var b;s.if((0,ce.not)((b=e.valid)!==null&&b!==void 0?b:d),_)}}xe.funcKeywordCode=qf;function Ha(t){let{gen:e,data:r,it:s}=t;e.if(s.parentData,()=>e.assign(r,(0,ce._)`${s.parentData}[${s.parentDataProperty}]`))}function Of(t,e){let{gen:r}=t;r.if((0,ce._)`Array.isArray(${e})`,()=>{r.assign(tt.default.vErrors,(0,ce._)`${tt.default.vErrors} === null ? ${e} : ${tt.default.vErrors}.concat(${e})`).assign(tt.default.errors,(0,ce._)`${tt.default.vErrors}.length`),(0,Rf.extendErrors)(t)},()=>t.error())}function Nf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Za(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,ce.stringify)(r)})}function jf(t,e,r=!1){return!e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||r&&typeof t>"u")}xe.validSchemaType=jf;function Cf({schema:t,opts:e,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let a=n.dependencies;if(a?.some(i=>!Object.prototype.hasOwnProperty.call(t,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}xe.validateKeywordUsage=Cf});var Ja=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendSubschemaMode=Ze.extendSubschemaData=Ze.getSubschema=void 0;var Te=T(),Ga=j();function Af(t,{keyword:e,schemaProp:r,schema:s,schemaPath:n,errSchemaPath:o,topSchemaRef:a}){if(e!==void 0&&s!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let i=t.schema[e];return r===void 0?{schema:i,schemaPath:(0,Te._)`${t.schemaPath}${(0,Te.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[r],schemaPath:(0,Te._)`${t.schemaPath}${(0,Te.getProperty)(e)}${(0,Te.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ga.escapeFragment)(r)}`}}if(s!==void 0){if(n===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:n,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Ze.getSubschema=Af;function Mf(t,e,{dataProp:r,dataPropType:s,data:n,dataTypes:o,propertyName:a}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,h=i.let("data",(0,Te._)`${e.data}${(0,Te.getProperty)(r)}`,!0);c(h),t.errorPath=(0,Te.str)`${u}${(0,Ga.getErrorPath)(r,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Te._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Te.Name?n:i.let("data",n,!0);c(u),a!==void 0&&(t.propertyName=a)}o&&(t.dataTypes=o);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]}}Ze.extendSubschemaData=Mf;function Df(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){s!==void 0&&(t.compositeRule=s),n!==void 0&&(t.createErrors=n),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}Ze.extendSubschemaMode=Df});var kn=v((X$,Ba)=>{"use strict";Ba.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 s,n,o;if(Array.isArray(e)){if(s=e.length,s!=r.length)return!1;for(n=s;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),s=o.length,s!==Object.keys(r).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;n--!==0;){var a=o[n];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var Wa=v((eb,Qa)=>{"use strict";var Ke=Qa.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Zr(e,s,n,t,"",t)};Ke.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ke.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ke.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ke.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 Zr(t,e,r,s,n,o,a,i,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,n,o,a,i,c,u);for(var l in s){var d=s[l];if(Array.isArray(d)){if(l in Ke.arrayKeywords)for(var h=0;h<d.length;h++)Zr(t,e,r,d[h],n+"/"+l+"/"+h,o,n,l,s,h)}else if(l in Ke.propsKeywords){if(d&&typeof d=="object")for(var g in d)Zr(t,e,r,d[g],n+"/"+l+"/"+Ff(g),o,n,l,s,g)}else(l in Ke.keywords||t.allKeys&&!(l in Ke.skipKeywords))&&Zr(t,e,r,d,n+"/"+l,o,n,l,s)}r(s,n,o,a,i,c,u)}}function Ff(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Wt=v(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.getSchemaRefs=de.resolveUrl=de.normalizeId=de._getFullPath=de.getFullPath=de.inlineRef=void 0;var Lf=j(),Vf=kn(),Uf=Wa(),Hf=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Zf(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Pn(t):e?Ya(t)<=e:!1}de.inlineRef=Zf;var Kf=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Pn(t){for(let e in t){if(Kf.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Pn)||typeof r=="object"&&Pn(r))return!0}return!1}function Ya(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Hf.has(r)&&(typeof t[r]=="object"&&(0,Lf.eachItem)(t[r],s=>e+=Ya(s)),e===1/0))return 1/0}return e}function Xa(t,e="",r){r!==!1&&(e=_t(e));let s=t.parse(e);return ei(t,s)}de.getFullPath=Xa;function ei(t,e){return t.serialize(e).split("#")[0]+"#"}de._getFullPath=ei;var Gf=/#\/?$/;function _t(t){return t?t.replace(Gf,""):""}de.normalizeId=_t;function Jf(t,e,r){return r=_t(r),t.resolve(e,r)}de.resolveUrl=Jf;var Bf=/^[a-z_][-a-z0-9._]*$/i;function Qf(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:s}=this.opts,n=_t(t[r]||e),o={"":n},a=Xa(s,n,!1),i={},c=new Set;return Uf(t,{allKeys:!0},(d,h,g,p)=>{if(p===void 0)return;let m=a+h,y=o[p];typeof d[r]=="string"&&(y=_.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[h]=y;function _(z){let A=this.opts.uriResolver.resolve;if(z=_t(y?A(y,z):z),c.has(z))throw l(z);c.add(z);let E=this.refs[z];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(d,E.schema,z):z!==_t(m)&&(z[0]==="#"?(u(d,i[z],z),i[z]=d):this.refs[z]=m),z}function b(z){if(typeof z=="string"){if(!Bf.test(z))throw new Error(`invalid anchor "${z}"`);_.call(this,`#${z}`)}}}),i;function u(d,h,g){if(h!==void 0&&!Vf(d,h))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}de.getSchemaRefs=Qf});var er=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getData=Ge.KeywordCxt=Ge.validateFunctionCode=void 0;var oi=Na(),ti=Qt(),xn=_n(),Kr=Qt(),Wf=La(),Xt=Ka(),En=Ja(),w=T(),k=Ae(),Yf=Wt(),Me=j(),Yt=Bt();function Xf(t){if(ci(t)&&(li(t),ii(t))){rp(t);return}ai(t,()=>(0,oi.topBoolOrEmptySchema)(t))}Ge.validateFunctionCode=Xf;function ai({gen:t,validateName:e,schema:r,schemaEnv:s,opts:n},o){n.code.es5?t.func(e,(0,w._)`${k.default.data}, ${k.default.valCxt}`,s.$async,()=>{t.code((0,w._)`"use strict"; ${ri(r,n)}`),tp(t,n),t.code(o)}):t.func(e,(0,w._)`${k.default.data}, ${ep(n)}`,s.$async,()=>t.code(ri(r,n)).code(o))}function ep(t){return(0,w._)`{${k.default.instancePath}="", ${k.default.parentData}, ${k.default.parentDataProperty}, ${k.default.rootData}=${k.default.data}${t.dynamicRef?(0,w._)`, ${k.default.dynamicAnchors}={}`:w.nil}}={}`}function tp(t,e){t.if(k.default.valCxt,()=>{t.var(k.default.instancePath,(0,w._)`${k.default.valCxt}.${k.default.instancePath}`),t.var(k.default.parentData,(0,w._)`${k.default.valCxt}.${k.default.parentData}`),t.var(k.default.parentDataProperty,(0,w._)`${k.default.valCxt}.${k.default.parentDataProperty}`),t.var(k.default.rootData,(0,w._)`${k.default.valCxt}.${k.default.rootData}`),e.dynamicRef&&t.var(k.default.dynamicAnchors,(0,w._)`${k.default.valCxt}.${k.default.dynamicAnchors}`)},()=>{t.var(k.default.instancePath,(0,w._)`""`),t.var(k.default.parentData,(0,w._)`undefined`),t.var(k.default.parentDataProperty,(0,w._)`undefined`),t.var(k.default.rootData,k.default.data),e.dynamicRef&&t.var(k.default.dynamicAnchors,(0,w._)`{}`)})}function rp(t){let{schema:e,opts:r,gen:s}=t;ai(t,()=>{r.$comment&&e.$comment&&di(t),ip(t),s.let(k.default.vErrors,null),s.let(k.default.errors,0),r.unevaluated&&sp(t),ui(t),up(t)})}function sp(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,w._)`${r}.evaluated`),e.if((0,w._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,w._)`${t.evaluated}.props`,(0,w._)`undefined`)),e.if((0,w._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,w._)`${t.evaluated}.items`,(0,w._)`undefined`))}function ri(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,w._)`/*# sourceURL=${r} */`:w.nil}function np(t,e){if(ci(t)&&(li(t),ii(t))){op(t,e);return}(0,oi.boolOrEmptySchema)(t,e)}function ii({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 ci(t){return typeof t.schema!="boolean"}function op(t,e){let{schema:r,gen:s,opts:n}=t;n.$comment&&r.$comment&&di(t),cp(t),lp(t);let o=s.const("_errs",k.default.errors);ui(t,o),s.var(e,(0,w._)`${o} === ${k.default.errors}`)}function li(t){(0,Me.checkUnknownRules)(t),ap(t)}function ui(t,e){if(t.opts.jtd)return si(t,[],!1,e);let r=(0,ti.getSchemaTypes)(t.schema),s=(0,ti.coerceAndCheckDataType)(t,r);si(t,r,!s,e)}function ap(t){let{schema:e,errSchemaPath:r,opts:s,self:n}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,Me.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function ip(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Me.checkStrictMode)(t,"default is ignored in the schema root")}function cp(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Yf.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function lp(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function di({gen:t,schemaEnv:e,schema:r,errSchemaPath:s,opts:n}){let o=r.$comment;if(n.$comment===!0)t.code((0,w._)`${k.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let a=(0,w.str)`${s}/$comment`,i=t.scopeValue("root",{ref:e.root});t.code((0,w._)`${k.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`)}}function up(t){let{gen:e,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=t;r.$async?e.if((0,w._)`${k.default.errors} === 0`,()=>e.return(k.default.data),()=>e.throw((0,w._)`new ${n}(${k.default.vErrors})`)):(e.assign((0,w._)`${s}.errors`,k.default.vErrors),o.unevaluated&&dp(t),e.return((0,w._)`${k.default.errors} === 0`))}function dp({gen:t,evaluated:e,props:r,items:s}){r instanceof w.Name&&t.assign((0,w._)`${e}.props`,r),s instanceof w.Name&&t.assign((0,w._)`${e}.items`,s)}function si(t,e,r,s){let{gen:n,schema:o,data:a,allErrors:i,opts:c,self:u}=t,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Me.schemaHasRulesButRef)(o,l))){n.block(()=>pi(t,"$ref",l.all.$ref.definition));return}c.jtd||fp(t,e),n.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,xn.shouldUseGroup)(o,h)&&(h.type?(n.if((0,Kr.checkDataType)(h.type,a,c.strictNumbers)),ni(t,h),e.length===1&&e[0]===h.type&&r&&(n.else(),(0,Kr.reportTypeError)(t)),n.endIf()):ni(t,h),i||n.if((0,w._)`${k.default.errors} === ${s||0}`))}}function ni(t,e){let{gen:r,schema:s,opts:{useDefaults:n}}=t;n&&(0,Wf.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,xn.shouldUseRule)(s,o)&&pi(t,o.keyword,o.definition,e.type)})}function fp(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(pp(t,e),t.opts.allowUnionTypes||mp(t,e),hp(t,t.dataTypes))}function pp(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{fi(t.dataTypes,r)||Tn(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),yp(t,e)}}function mp(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Tn(t,"use allowUnionTypes to allow union type keyword")}function hp(t,e){let r=t.self.RULES.all;for(let s in r){let n=r[s];if(typeof n=="object"&&(0,xn.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(a=>gp(e,a))&&Tn(t,`missing type "${o.join(",")}" for keyword "${s}"`)}}}function gp(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function fi(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function yp(t,e){let r=[];for(let s of t.dataTypes)fi(e,s)?r.push(s):e.includes("integer")&&s==="number"&&r.push("integer");t.dataTypes=r}function Tn(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Me.checkStrictMode)(t,e,t.opts.strictTypes)}var Gr=class{constructor(e,r,s){if((0,Xt.validateKeywordUsage)(e,r,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Me.schemaRefOrVal)(e,this.schema,s,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",mi(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Xt.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",k.default.errors))}result(e,r,s){this.failResult((0,w.not)(e),r,s)}failResult(e,r,s){this.gen.if(e),s?s():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,w.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,w._)`${r} !== undefined && (${(0,w.or)(this.invalid$data(),e)})`)}error(e,r,s){if(r){this.setParams(r),this._error(e,s),this.setParams({});return}this._error(e,s)}_error(e,r){(e?Yt.reportExtraError:Yt.reportError)(this,this.def.error,r)}$dataError(){(0,Yt.reportError)(this,this.def.$dataError||Yt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Yt.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,s=w.nil){this.gen.block(()=>{this.check$data(e,s),r()})}check$data(e=w.nil,r=w.nil){if(!this.$data)return;let{gen:s,schemaCode:n,schemaType:o,def:a}=this;s.if((0,w.or)((0,w._)`${n} === undefined`,r)),e!==w.nil&&s.assign(e,!0),(o.length||a.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==w.nil&&s.assign(e,!1)),s.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:s,def:n,it:o}=this;return(0,w.or)(a(),i());function a(){if(s.length){if(!(r instanceof w.Name))throw new Error("ajv implementation error");let c=Array.isArray(s)?s:[s];return(0,w._)`${(0,Kr.checkDataTypes)(c,r,o.opts.strictNumbers,Kr.DataType.Wrong)}`}return w.nil}function i(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,w._)`!${c}(${r})`}return w.nil}}subschema(e,r){let s=(0,En.getSubschema)(this.it,e);(0,En.extendSubschemaData)(s,this.it,e),(0,En.extendSubschemaMode)(s,e);let n={...this.it,...s,items:void 0,props:void 0};return np(n,r),n}mergeEvaluated(e,r){let{it:s,gen:n}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=Me.mergeEvaluated.props(n,e.props,s.props,r)),s.items!==!0&&e.items!==void 0&&(s.items=Me.mergeEvaluated.items(n,e.items,s.items,r)))}mergeValidEvaluated(e,r){let{it:s,gen:n}=this;if(s.opts.unevaluated&&(s.props!==!0||s.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,w.Name)),!0}};Ge.KeywordCxt=Gr;function pi(t,e,r,s){let n=new Gr(t,r,e);"code"in r?r.code(n,s):n.$data&&r.validate?(0,Xt.funcKeywordCode)(n,r):"macro"in r?(0,Xt.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Xt.funcKeywordCode)(n,r)}var _p=/^\/(?:[^~]|~0|~1)*$/,vp=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mi(t,{dataLevel:e,dataNames:r,dataPathArr:s}){let n,o;if(t==="")return k.default.rootData;if(t[0]==="/"){if(!_p.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=k.default.rootData}else{let u=vp.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 s[e-l]}if(l>e)throw new Error(c("data",l));if(o=r[e-l],!n)return o}let a=o,i=n.split("/");for(let u of i)u&&(o=(0,w._)`${o}${(0,w.getProperty)((0,Me.unescapeJsonPointer)(u))}`,a=(0,w._)`${a} && ${o}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Ge.getData=mi});var Jr=v(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});var Rn=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};In.default=Rn});var tr=v(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});var qn=Wt(),On=class extends Error{constructor(e,r,s,n){super(n||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0,qn.resolveUrl)(e,r,s),this.missingSchema=(0,qn.normalizeId)((0,qn.getFullPath)(e,this.missingRef))}};Nn.default=On});var Qr=v($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.resolveSchema=$e.getCompilingSchema=$e.resolveRef=$e.compileSchema=$e.SchemaEnv=void 0;var we=T(),$p=Jr(),rt=Ae(),ze=Wt(),hi=j(),bp=er(),vt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=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,ze.normalizeId)(s?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s?.$async,this.refs={}}};$e.SchemaEnv=vt;function Cn(t){let e=gi.call(this,t);if(e)return e;let r=(0,ze.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:n}=this.opts.code,{ownProperties:o}=this.opts,a=new we.CodeGen(this.scope,{es5:s,lines:n,ownProperties:o}),i;t.$async&&(i=a.scopeValue("Error",{ref:$p.default,code:(0,we._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:rt.default.data,parentData:rt.default.parentData,parentDataProperty:rt.default.parentDataProperty,dataNames:[rt.default.data],dataPathArr:[we.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,we.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:we.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,we._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,bp.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(rt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let g=new Function(`${rt.default.self}`,`${rt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:g}),g.errors=null,g.schema=t.schema,g.schemaEnv=t,t.$async&&(g.$async=!0),this.opts.code.source===!0&&(g.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:p,items:m}=u;g.evaluated={props:p instanceof we.Name?void 0:p,items:m instanceof we.Name?void 0:m,dynamicProps:p instanceof we.Name,dynamicItems:m instanceof we.Name},g.source&&(g.source.evaluated=(0,we.stringify)(g.evaluated))}return t.validate=g,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)}}$e.compileSchema=Cn;function Sp(t,e,r){var s;r=(0,ze.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let o=kp.call(this,t,r);if(o===void 0){let a=(s=t.localRefs)===null||s===void 0?void 0:s[r],{schemaId:i}=this.opts;a&&(o=new vt({schema:a,schemaId:i,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=wp.call(this,o)}$e.resolveRef=Sp;function wp(t){return(0,ze.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Cn.call(this,t)}function gi(t){for(let e of this._compilations)if(zp(e,t))return e}$e.getCompilingSchema=gi;function zp(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function kp(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Br.call(this,t,e)}function Br(t,e){let r=this.opts.uriResolver.parse(e),s=(0,ze._getFullPath)(this.opts.uriResolver,r),n=(0,ze.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===n)return jn.call(this,r,t);let o=(0,ze.normalizeId)(s),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=Br.call(this,t,a);return typeof i?.schema!="object"?void 0:jn.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Cn.call(this,a),o===(0,ze.normalizeId)(e)){let{schema:i}=a,{schemaId:c}=this.opts,u=i[c];return u&&(n=(0,ze.resolveUrl)(this.opts.uriResolver,n,u)),new vt({schema:i,schemaId:c,root:t,baseId:n})}return jn.call(this,r,a)}}$e.resolveSchema=Br;var Pp=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function jn(t,{baseId:e,schema:r,root:s}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,hi.unescapeFragment)(i)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Pp.has(i)&&u&&(e=(0,ze.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,hi.schemaHasRulesButRef)(r,this.RULES)){let i=(0,ze.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Br.call(this,s,i)}let{schemaId:a}=this.opts;if(o=o||new vt({schema:r,schemaId:a,root:s,baseId:e}),o.schema!==o.root.schema)return o}});var yi=v((ab,Ep)=>{Ep.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 Vn=v((ib,ki)=>{"use strict";var xp=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Mn=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),Tp=RegExp.prototype.test.bind(/^\d*$/u),st=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Dn=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),vi=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Fn=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Rp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),fe=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)fe[e]="%"+t[e>>4]+t[e&15]}function oe(t){return t<2048?fe[192|t>>6]+fe[128|t&63]:t<65536?fe[224|t>>12]+fe[128|t>>6&63]+fe[128|t&63]:fe[240|t>>18]+fe[128|t>>12&63]+fe[128|t>>6&63]+fe[128|t&63]}function Ip(t){let e="",r=0,s=0;for(s=0;s<t.length;s++)if(r=t[s].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s];break}for(s+=1;s<t.length;s++){if(r=t[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s]}return e}var qp=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Op=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Np=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jp=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Cp(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!Np(t[e])){if(t[e]==="%"&&e+2<t.length&&st(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function _i(t){let e=-1,r=0,s=-1,n=0;for(let i=0;i<t.length;i++)t[i]==="0"?(s===-1&&(s=i),n++,n>r&&(r=n,e=s)):(s=-1,n=0);if(r<2)return t.join(":");let o=t.slice(0,e).join(":"),a=t.slice(e+r).join(":");return o+"::"+a}function Ap(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(":"),s=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),s.length===1&&s[0]===""&&(s.length=0));let n=r.concat(s),o=0;for(let i=0;i<n.length;i++){let c=n[i];if(c==="")return;if(c.indexOf(".")!==-1){if(i!==n.length-1||e!==-1&&s.length===0||!Mn(c))return;o+=2;continue}if(!qp(c))return;n[i]=parseInt(c,16).toString(16),o++}if(e===-1)return o!==8?void 0:_i(n);if(o>=8)return;let a=n.slice(0,r.length);for(let i=o;i<8;i++)a.push("0");for(let i=r.length;i<n.length;i++)a.push(n[i]);return _i(a)}function An(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 s=e?t.slice(1,-1):t;if(e&&Op(s))return s=s.toLowerCase(),{host:`[${s}]`,escapedHost:s,isIPV6:!1,isIPVFuture:!0};if(Mp(s,":")<2)return{host:t,isIPV6:!1,error:e};let n="",o=s.indexOf("%");if(o!==-1){let i=s.slice(o,o+3).toLowerCase()==="%25"?3:1;if(n=s.slice(o+i),!Cp(n))return{host:t,isIPV6:!1,error:!0};s=s.slice(0,o)}let a=Ap(s);return a===void 0?{host:t,isIPV6:!1,error:!0}:{host:a+(n?"%"+n:""),escapedHost:a+(n?"%25"+n:""),isIPV6:!0}}function Mp(t,e){let r=0;for(let s=0;s<t.length;s++)t[s]===e&&r++;return r}function $i(t){let e=t,r=[],s=-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((s=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,s)),e=e.slice(s)}return r.join("")}function Dp(t){if(t===""||t[0]==="/")return $i(t);let e=t.split("/"),r=e.length-1,s=[],n=!1;for(let o=0;o<=r;o++){let a=e[o];a==="."||a===".."?(a===".."&&(s.length!==0&&s[s.length-1]!==".."?s.pop():s.push("..")),n=o===r):s.push(a)}return n&&s[s.length-1]!==".."&&s.push(""),(s.length===0||s[0]===""||s[0].includes(":"))&&s.unshift("."),s.join("/")}var Fp={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Lp=/[@/?#:]/g,Vp=/[@/?#]/g;function bi(t,e){let r=e?Vp:Lp;return r.lastIndex=0,t.replace(r,s=>Fp[s])}function Si(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let s=0;s<t.length;s++){if(t[s]==="%"&&s+2<t.length){let n=t.slice(s+1,s+3);if(st(n)){let o=n.toUpperCase(),a=String.fromCharCode(parseInt(o,16));e&&Dn(a)?r+=a:r+="%"+o,s+=2;continue}}r+=t[s]}return r}function Up(t){let e="";for(let r=0;r<t.length;r++){let s=t[r];if(s==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(st(n)){let o=n.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&Dn(a)?e+=a:e+="%"+o,r+=2;continue}}if(vi(s))e+=s;else{let n=t.charCodeAt(r);if(n<128)e+=zi(n)?s:fe[n];else if(n<55296||n>57343)e+=oe(n);else if(n<=56319&&r+1<t.length){let o=t.charCodeAt(r+1);o>=56320&&o<=57343?(e+=oe(65536+(n-55296<<10)+(o-56320)),r++):e+=oe(65533)}else e+=oe(65533)}}return e}function Hp(t,e=!1){let r="",s=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let o=t[n];if(o==="%"&&n+2<t.length){let a=t.slice(n+1,n+3);if(st(a)){r+="%"+a.toUpperCase(),n+=2;continue}}if(o==="/"&&(s=!1),vi(o)&&(o!==":"||!s))r+=o;else{let a=t.charCodeAt(n);if(a<128)r+=fe[a];else if(a<55296||a>57343)r+=oe(a);else if(a<=56319&&n+1<t.length){let i=t.charCodeAt(n+1);i>=56320&&i<=57343?(r+=oe(65536+(a-55296<<10)+(i-56320)),n++):r+=oe(65533)}else r+=oe(65533)}}return r}function Ln(t,e){let r="";for(let s=0;s<t.length;s++){let n=t[s];if(n==="%"&&s+2<t.length){let o=t.slice(s+1,s+3);if(st(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(e(n))r+=n;else{let o=t.charCodeAt(s);if(o<128)r+=fe[o];else if(o<55296||o>57343)r+=oe(o);else if(o<=56319&&s+1<t.length){let a=t.charCodeAt(s+1);a>=56320&&a<=57343?(r+=oe(65536+(o-55296<<10)+(a-56320)),s++):r+=oe(65533)}else r+=oe(65533)}}return r}function wi(t){return Ln(t,Rp)}function Zp(t){return Ln(t,Fn)}function Kp(t){return Ln(t,Fn)}function zi(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 Gp(t){let e="";for(let r=0;r<t.length;r++){let s=t[r];if(s==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(st(n)){let o=n.toUpperCase(),a=String.fromCharCode(parseInt(o,16));Dn(a)?e+=a:e+="%"+o,r+=2;continue}}if(Fn(s))e+=s;else{let n=t.charCodeAt(r);if(n<128)e+=zi(n)?s:fe[n];else if(n<55296||n>57343)e+=oe(n);else if(n<=56319&&r+1<t.length){let o=t.charCodeAt(r+1);o>=56320&&o<=57343?(e+=oe(65536+(n-55296<<10)+(o-56320)),r++):e+=oe(65533)}else e+=oe(65533)}}return e}function Jp(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let s=t.slice(r+1,r+3);if(st(s)){e+="%"+s.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function Bp(t){let e=[];if(t.userinfo!==void 0&&(e.push(wi(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!Mn(r)){let s=An(r);s.isIPV6!==!0&&s.isIPVFuture!==!0&&(r=Si(r,!0),s=An(r)),s.isIPV6===!0||s.isIPVFuture===!0?r=`[${s.escapedHost}]`:r=bi(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!Tp(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}ki.exports={nonSimpleDomain:jp,recomposeAuthority:Bp,reescapeHostDelimiters:bi,normalizePercentEncoding:Si,normalizePathEncoding:Up,serializePathEncoding:Hp,normalizeQueryFragmentEncoding:Gp,encodeUserinfo:wi,encodeQuery:Zp,encodeFragment:Kp,escapePreservingEscapes:Jp,removeDotSegments:$i,removeDotSegmentsRelative:Dp,isIPv4:Mn,isUUID:xp,normalizeIPv6:An,stringArrayToHexStripped:Ip}});var Ri=v((cb,Ti)=>{"use strict";var{isUUID:Qp}=Vn(),Wp=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Yp=["http","https","ws","wss","urn","urn:uuid"];function Xp(t){return Yp.indexOf(t)!==-1}function Un(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 Pi(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ei(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 em(t){return t.secure=Un(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function tm(t){if((t.port===(Un(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 rm(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(Wp);if(r&&r[0]===t.path){let s=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${s}:${e.nid||t.nid}`,o=Hn(n);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function sm(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),n=`${r}:${e.nid||s}`,o=Hn(n);o&&(t=o.serialize(t,e));let a=t,i=t.nss;return a.path=`${s||e.nid}:${i}`,e.skipEscape=!0,a}function nm(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Qp(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function om(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var xi={scheme:"http",domainHost:!0,parse:Pi,serialize:Ei},am={scheme:"https",domainHost:xi.domainHost,parse:Pi,serialize:Ei},Wr={scheme:"ws",domainHost:!0,parse:em,serialize:tm},im={scheme:"wss",domainHost:Wr.domainHost,parse:Wr.parse,serialize:Wr.serialize},cm={scheme:"urn",parse:rm,serialize:sm,skipNormalize:!0},lm={scheme:"urn:uuid",parse:nm,serialize:om,skipNormalize:!0},Yr={http:xi,https:am,ws:Wr,wss:im,urn:cm,"urn:uuid":lm};Object.setPrototypeOf(Yr,null);function Hn(t){return t&&(Yr[t]||Yr[t.toLowerCase()])||void 0}Ti.exports={wsIsSecure:Un,SCHEMES:Yr,isValidSchemeName:Xp,getSchemeHandler:Hn}});var Zi=v((lb,ss)=>{"use strict";var{normalizeIPv6:ji,removeDotSegments:sr,removeDotSegmentsRelative:Ci,recomposeAuthority:um,normalizePercentEncoding:Zn,normalizePathEncoding:dm,serializePathEncoding:Ii,normalizeQueryFragmentEncoding:qi,encodeQuery:fm,encodeFragment:pm,reescapeHostDelimiters:mm,isIPv4:Ai,nonSimpleDomain:hm}=Vn(),{SCHEMES:Mi,getSchemeHandler:Kn}=Ri(),Di=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Fi="URI scheme is malformed.",Xr="URI host is malformed.",gm=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function Oi(t){let e=String(t);if(!Di.test(e))throw new TypeError(Fi);return e}function ym(t,e){return typeof t=="string"?t=Pm(t,e):typeof t=="object"&&(t=ts(nt(t,e),e)),t}function _m(t,e,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:a,malformedSchemeSpecific:i,malformedHost:c,malformedScheme:u}=es(t,s),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:h,malformedSchemeSpecific:g,malformedHost:p,malformedScheme:m}=es(e,s);if(o||d||a||h||i||g||c||p||u||m)throw new Error(n.error||l.error||"URI is malformed.");let y=Li(n,l,s,!0),_=Kn(r&&r.scheme||y.scheme),b=y.host,z=b!==void 0&&b!==""&&(Ai(b)||ji(b).isIPV6);if(Ui(y,r||{},_,z))throw new Error(Xr);Vi(y,r||{},_,z);let A=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(y.error&&!A)throw new Error(y.error);return s.skipEscape=!0,nt(y,s)}function Li(t,e,r,s){let n={};if(s||(t=ts(nt(t,r),r),e=ts(nt(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=sr(e.path||""),n.query=e.query;else{if(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=sr(e.path||""),n.query=e.query;else{if(!e.path)n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query;else{if(e.path[0]==="/")n.path=sr(e.path);else{let o=t.userinfo!==void 0||t.host!==void 0||t.port!==void 0;o&&!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=t.scheme===void 0&&!o&&n.path[0]!=="/"?Ci(n.path):sr(n.path)}n.query=e.query}n.userinfo=t.userinfo,n.host=t.host,n.port=t.port}n.scheme=t.scheme}return n.fragment=e.fragment,n}function vm(t,e,r){let s=Ni(t,r),n=Ni(e,r);return s!==void 0&&n!==void 0&&s===n}function nt(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:""},s=Object.assign({},e),n=[];r.scheme&&(r.scheme=Oi(r.scheme));let o=Kn(s.scheme||r.scheme);o&&o.serialize&&o.serialize(r,s);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,i=(r.scheme===void 0||s.reference==="suffix")&&!a,c=!s.skipEscape&&i;r.path!==void 0&&(s.skipEscape?r.path=Zn(r.path):r.path=Ii(r.path,c)),s.reference!=="suffix"&&r.scheme&&(r.scheme=Oi(r.scheme),n.push(r.scheme,":"));let u=um(r);if(u!==void 0&&(s.reference!=="suffix"&&n.push("//"),n.push(u),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let l=r.path;!s.absolutePath&&(!o||!o.absolutePath)&&(l=i&&l[0]!=="/"?Ci(l):sr(l)),i&&(l=Ii(l,!0)),u===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),n.push(l)}return r.query!==void 0&&n.push("?",fm(r.query)),r.fragment!==void 0&&n.push("#",pm(r.fragment)),n.join("")}var $m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,bm=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Sm=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function wm(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 rr(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 rs(t){return t[0]==="["&&t[t.length-1]==="]"}function zm(t){let e=t[4];return rr(t[3])||e!==void 0&&!rs(e)&&rr(e)||rr(t[6])||rr(t[7])||rr(t[8])}function Vi(t,e,r,s){if(Ui(t,e,r,s))return t.error=t.error||Xr,!0;if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!rs(t.host)&&(e.domainHost||r&&r.domainHost)&&s===!1&&hm(t.host)){let n;try{n=new URL("http://"+t.host)}catch(o){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!km(n))return t.error=t.error||Xr,!0;t.host=n.hostname}return!1}function Ui(t,e,r,s){return!!(t.host&&s===!1&&!rs(t.host)&&(e.domainHost||r&&r.domainHost)&&gm.test(t.host))}function km(t){return t.username===""&&t.password===""&&t.port===""&&t.pathname==="/"&&t.search===""&&t.hash===""&&t.hostname!==""}function es(t,e){let r=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1,a=!1,i=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(bm);d!==null&&d[1].indexOf("\\")!==-1&&(s.error="URI authority must not contain a literal backslash.",n=!0);let h=t.match(Sm);if(h!==null){let p=h[1],m=p.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(s.error=s.error||"URI authority must not contain a literal backslash.",n=!0):p.length!==m.length&&(s.error=s.error||"URI authority introducer must not contain whitespace.",n=!0))}let g=t.match($m);if(g){s.scheme=g[1],s.userinfo=g[3],s.host=g[4],s.port=parseInt(g[5],10),s.path=g[6]||"",s.query=g[7],s.fragment=g[8],s.scheme!==void 0&&(Di.test(s.scheme)?s.scheme=s.scheme.toLowerCase():(s.error=s.error||Fi,u=!0)),o=zm(g),o&&(s.error=s.error||"URI contains malformed percent-encoding."),isNaN(s.port)&&(s.port=g[5]);let p=wm(s,g);if(p!==void 0&&(s.error=s.error||p,n=!0),s.host)if(Ai(s.host)===!1){let _=rs(s.host),b=s.host.indexOf("[")!==-1||s.host.indexOf("]")!==-1,z=ji(s.host);l=z.isIPV6||z.isIPVFuture===!0,c=b&&(!_||z.error===!0),s.host=l?z.host:z.host.toLowerCase(),c&&(s.error=s.error||Xr,n=!0)}else l=!0;s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==s.reference&&(s.error=s.error||"URI is not a "+r.reference+" reference.");let m=Kn(r.scheme||s.scheme);if(c||(i=Vi(s,r,m,l)),t.indexOf("%")!==-1&&s.host!==void 0&&!c){let y=l?s.host:Zn(s.host,!0);l||(y=Zn(y.toLowerCase())),s.host=l||r.scheme!=="null"?mm(y,l):y}(!m||m&&!m.skipNormalize)&&(s.path&&(s.path=dm(s.path)),s.query&&(s.query=qi(s.query)),s.fragment&&(s.fragment=qi(s.fragment))),m&&m.parse&&(m.parse(s,r),m===Mi.urn&&s.nid===void 0&&(a=!0))}else s.error=s.error||"URI can not be parsed.";return{parsed:s,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:i,malformedScheme:u}}function ts(t,e){return es(t,e).parsed}function Pm(t,e){return Hi(t,e).normalized}function Hi(t,e){let{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:i}=es(t,e);return{normalized:s||n||o||a||i?t:nt(r,e),malformedAuthorityOrPort:s,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:i}}function Ni(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:nt(t,e)}catch{return}let{normalized:s,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:i,malformedScheme:c}=Hi(r,e);return n||o||a||i||c?void 0:s}var Gn={SCHEMES:Mi,normalize:ym,resolve:_m,resolveComponent:Li,equal:vm,serialize:nt,parse:ts};ss.exports=Gn;ss.exports.default=Gn;ss.exports.fastUri=Gn});var Gi=v(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});var Ki=Zi();Ki.code='require("ajv/dist/runtime/uri").default';Jn.default=Ki});var tc=v(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.CodeGen=ee.Name=ee.nil=ee.stringify=ee.str=ee._=ee.KeywordCxt=void 0;var Em=er();Object.defineProperty(ee,"KeywordCxt",{enumerable:!0,get:function(){return Em.KeywordCxt}});var $t=T();Object.defineProperty(ee,"_",{enumerable:!0,get:function(){return $t._}});Object.defineProperty(ee,"str",{enumerable:!0,get:function(){return $t.str}});Object.defineProperty(ee,"stringify",{enumerable:!0,get:function(){return $t.stringify}});Object.defineProperty(ee,"nil",{enumerable:!0,get:function(){return $t.nil}});Object.defineProperty(ee,"Name",{enumerable:!0,get:function(){return $t.Name}});Object.defineProperty(ee,"CodeGen",{enumerable:!0,get:function(){return $t.CodeGen}});var xm=Jr(),Yi=tr(),Tm=yn(),nr=Qr(),Rm=T(),or=Wt(),ns=Qt(),Qn=j(),Ji=yi(),Im=Gi(),Xi=(t,e)=>new RegExp(t,e);Xi.code="new RegExp";var qm=["removeAdditional","useDefaults","coerceTypes"],Om=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Nm={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."},jm={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Bi=200;function Cm(t){var e,r,s,n,o,a,i,c,u,l,d,h,g,p,m,y,_,b,z,A,E,Ee,Oe,ws,zs;let Tt=t.strict,ks=(e=t.code)===null||e===void 0?void 0:e.optimize,Bo=ks===!0||ks===void 0?1:ks||0,Qo=(s=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&s!==void 0?s:Xi,xl=(n=t.uriResolver)!==null&&n!==void 0?n:Im.default;return{strictSchema:(a=(o=t.strictSchema)!==null&&o!==void 0?o:Tt)!==null&&a!==void 0?a:!0,strictNumbers:(c=(i=t.strictNumbers)!==null&&i!==void 0?i:Tt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:Tt)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=t.strictTuples)!==null&&d!==void 0?d:Tt)!==null&&h!==void 0?h:"log",strictRequired:(p=(g=t.strictRequired)!==null&&g!==void 0?g:Tt)!==null&&p!==void 0?p:!1,code:t.code?{...t.code,optimize:Bo,regExp:Qo}:{optimize:Bo,regExp:Qo},loopRequired:(m=t.loopRequired)!==null&&m!==void 0?m:Bi,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Bi,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(z=t.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(A=t.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(Ee=t.validateSchema)!==null&&Ee!==void 0?Ee:!0,validateFormats:(Oe=t.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(ws=t.unicodeRegExp)!==null&&ws!==void 0?ws:!0,int32range:(zs=t.int32range)!==null&&zs!==void 0?zs:!0,uriResolver:xl}}var ar=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,...Cm(e)};let{es5:r,lines:s}=this.opts.code;this.scope=new Rm.ValueScope({scope:{},prefixes:Om,es5:r,lines:s}),this.logger=Vm(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Tm.getRules)(),Qi.call(this,Nm,e,"NOT SUPPORTED"),Qi.call(this,jm,e,"DEPRECATED","warn"),this._metaOpts=Fm.call(this),e.formats&&Mm.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Dm.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Am.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:s}=this.opts,n=Ji;s==="id"&&(n={...Ji},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[s],!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 s;if(typeof e=="string"){if(s=this.getSchema(e),!s)throw new Error(`no schema with key or ref "${e}"`)}else s=this.compile(e);let n=s(r);return"$async"in s||(this.errors=s.errors),n}compile(e,r){let s=this._addSchema(e,r);return s.validate||this._compileSchemaEnv(s)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:s}=this.opts;return n.call(this,e,r);async function n(l,d){await o.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||a.call(this,h)}async function o(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Yi.default))throw d;return i.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function i({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 o.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]=s(l))}finally{delete this._loading[l]}}}addSchema(e,r,s,n=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,s,n);return this}let o;if(typeof e=="object"){let{schemaId:a}=this.opts;if(o=e[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0,or.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,s,r,n,!0),this}addMetaSchema(e,r,s=this.opts.validateSchema){return this.addSchema(e,r,!0,s),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let s;if(s=e.$schema,s!==void 0&&typeof s!="string")throw new Error("$schema must be a string");if(s=s||this.opts.defaultMeta||this.defaultMeta(),!s)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(s,e);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(e){let r;for(;typeof(r=Wi.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:s}=this.opts,n=new nr.SchemaEnv({schema:{},schemaId:s});if(r=nr.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=Wi.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 s=e[this.opts.schemaId];return s&&(s=(0,or.normalizeId)(s),delete this.schemas[s],delete this.refs[s]),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 s;if(typeof e=="string")s=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=s);else if(typeof e=="object"&&r===void 0){if(r=e,s=r.keyword,Array.isArray(s)&&!s.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Hm.call(this,s,r),!r)return(0,Qn.eachItem)(s,o=>Bn.call(this,o)),this;Km.call(this,r);let n={...r,type:(0,ns.getJSONTypes)(r.type),schemaType:(0,ns.getJSONTypes)(r.schemaType)};return(0,Qn.eachItem)(s,n.type.length===0?o=>Bn.call(this,o,n):o=>n.type.forEach(a=>Bn.call(this,o,n,a))),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 s of r.rules){let n=s.rules.findIndex(o=>o.keyword===e);n>=0&&s.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:s="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${s}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(e,r){let s=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let o=n.split("/").slice(1),a=e;for(let i of o)a=a[i];for(let i in s){let c=s[i];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[i];u&&l&&(a[i]=ec(l))}}return e}_removeAllSchemas(e,r){for(let s in e){let n=e[s];(!r||r.test(s))&&(typeof n=="string"?delete e[s]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[s]))}}_addSchema(e,r,s,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:i}=this.opts;if(typeof e=="object")a=e[i];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;s=(0,or.normalizeId)(a||s);let u=or.getSchemaRefs.call(this,e,s);return c=new nr.SchemaEnv({schema:e,schemaId:i,meta:r,baseId:s,localRefs:u}),this._cache.set(c.schema,c),o&&!s.startsWith("#")&&(s&&this._checkUnique(s),this.refs[s]=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):nr.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{nr.compileSchema.call(this,e)}finally{this.opts=r}}};ar.ValidationError=xm.default;ar.MissingRefError=Yi.default;ee.default=ar;function Qi(t,e,r,s="error"){for(let n in t){let o=n;o in e&&this.logger[s](`${r}: option ${n}. ${t[o]}`)}}function Wi(t){return t=(0,or.normalizeId)(t),this.schemas[t]||this.refs[t]}function Am(){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 Mm(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Dm(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 Fm(){let t={...this.opts};for(let e of qm)delete t[e];return t}var Lm={log(){},warn(){},error(){}};function Vm(t){if(t===!1)return Lm;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 Um=/^[a-z_$][a-z0-9_$:-]*$/i;function Hm(t,e){let{RULES:r}=this;if((0,Qn.eachItem)(t,s=>{if(r.keywords[s])throw new Error(`Keyword ${s} is already defined`);if(!Um.test(s))throw new Error(`Keyword ${s} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Bn(t,e,r){var s;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=n?o.post:o.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[t]=!0,!e)return;let i={keyword:t,definition:{...e,type:(0,ns.getJSONTypes)(e.type),schemaType:(0,ns.getJSONTypes)(e.schemaType)}};e.before?Zm.call(this,a,i,e.before):a.rules.push(i),o.all[t]=i,(s=e.implements)===null||s===void 0||s.forEach(c=>this.addKeyword(c))}function Zm(t,e,r){let s=t.rules.findIndex(n=>n.keyword===r);s>=0?t.rules.splice(s,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Km(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=ec(e)),t.validateSchema=this.compile(e,!0))}var Gm={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ec(t){return{anyOf:[t,Gm]}}});var rc=v(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});var Jm={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Wn.default=Jm});var ac=v(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.callRef=ot.getValidate=void 0;var Bm=tr(),sc=ve(),pe=T(),bt=Ae(),nc=Qr(),os=j(),Qm={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:s}=t,{baseId:n,schemaEnv:o,validateName:a,opts:i,self:c}=s,{root:u}=o;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=nc.resolveRef.call(c,u,n,r);if(l===void 0)throw new Bm.default(s.opts.uriResolver,n,r);if(l instanceof nc.SchemaEnv)return h(l);return g(l);function d(){if(o===u)return as(t,a,o,o.$async);let p=e.scopeValue("root",{ref:u});return as(t,(0,pe._)`${p}.validate`,u,u.$async)}function h(p){let m=oc(t,p);as(t,m,p,p.$async)}function g(p){let m=e.scopeValue("schema",i.code.source===!0?{ref:p,code:(0,pe.stringify)(p)}:{ref:p}),y=e.name("valid"),_=t.subschema({schema:p,dataTypes:[],schemaPath:pe.nil,topSchemaRef:m,errSchemaPath:r},y);t.mergeEvaluated(_),t.ok(y)}}};function oc(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,pe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}ot.getValidate=oc;function as(t,e,r,s){let{gen:n,it:o}=t,{allErrors:a,schemaEnv:i,opts:c}=o,u=c.passContext?bt.default.this:pe.nil;s?l():d();function l(){if(!i.$async)throw new Error("async schema referenced by sync schema");let p=n.let("valid");n.try(()=>{n.code((0,pe._)`await ${(0,sc.callValidateCode)(t,e,u)}`),g(e),a||n.assign(p,!0)},m=>{n.if((0,pe._)`!(${m} instanceof ${o.ValidationError})`,()=>n.throw(m)),h(m),a||n.assign(p,!1)}),t.ok(p)}function d(){t.result((0,sc.callValidateCode)(t,e,u),()=>g(e),()=>h(e))}function h(p){let m=(0,pe._)`${p}.errors`;n.assign(bt.default.vErrors,(0,pe._)`${bt.default.vErrors} === null ? ${m} : ${bt.default.vErrors}.concat(${m})`),n.assign(bt.default.errors,(0,pe._)`${bt.default.vErrors}.length`)}function g(p){var m;if(!o.opts.unevaluated)return;let y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=os.mergeEvaluated.props(n,y.props,o.props));else{let _=n.var("props",(0,pe._)`${p}.evaluated.props`);o.props=os.mergeEvaluated.props(n,_,o.props,pe.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=os.mergeEvaluated.items(n,y.items,o.items));else{let _=n.var("items",(0,pe._)`${p}.evaluated.items`);o.items=os.mergeEvaluated.items(n,_,o.items,pe.Name)}}}ot.callRef=as;ot.default=Qm});var ic=v(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});var Wm=rc(),Ym=ac(),Xm=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Wm.default,Ym.default];Yn.default=Xm});var cc=v(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});var is=T(),Je=is.operators,cs={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}},eh={message:({keyword:t,schemaCode:e})=>(0,is.str)`must be ${cs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,is._)`{comparison: ${cs[t].okStr}, limit: ${e}}`},th={keyword:Object.keys(cs),type:"number",schemaType:"number",$data:!0,error:eh,code(t){let{keyword:e,data:r,schemaCode:s}=t;t.fail$data((0,is._)`${r} ${cs[e].fail} ${s} || isNaN(${r})`)}};Xn.default=th});var lc=v(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});var ir=T(),rh={message:({schemaCode:t})=>(0,ir.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ir._)`{multipleOf: ${t}}`},sh={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:rh,code(t){let{gen:e,data:r,schemaCode:s,it:n}=t,o=n.opts.multipleOfPrecision,a=e.let("res"),i=o?(0,ir._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,ir._)`${a} !== parseInt(${a})`;t.fail$data((0,ir._)`(${s} === 0 || (${a} = ${r}/${s}, ${i}))`)}};eo.default=sh});var dc=v(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});function uc(t){let e=t.length,r=0,s=0,n;for(;s<e;)r++,n=t.charCodeAt(s++),n>=55296&&n<=56319&&s<e&&(n=t.charCodeAt(s),(n&64512)===56320&&s++);return r}to.default=uc;uc.code='require("ajv/dist/runtime/ucs2length").default'});var fc=v(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var at=T(),nh=j(),oh=dc(),ah={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,at.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,at._)`{limit: ${t}}`},ih={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ah,code(t){let{keyword:e,data:r,schemaCode:s,it:n}=t,o=e==="maxLength"?at.operators.GT:at.operators.LT,a=n.opts.unicode===!1?(0,at._)`${r}.length`:(0,at._)`${(0,nh.useFunc)(t.gen,oh.default)}(${r})`;t.fail$data((0,at._)`${a} ${o} ${s}`)}};ro.default=ih});var pc=v(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});var ch=ve(),lh=j(),St=T(),uh={message:({schemaCode:t})=>(0,St.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,St._)`{pattern: ${t}}`},dh={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uh,code(t){let{gen:e,data:r,$data:s,schema:n,schemaCode:o,it:a}=t,i=a.opts.unicodeRegExp?"u":"";if(s){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,St._)`new RegExp`:(0,lh.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,St._)`${u}(${o}, ${i}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,St._)`!${l}`)}else{let c=(0,ch.usePattern)(t,n);t.fail$data((0,St._)`!${c}.test(${r})`)}}};so.default=dh});var mc=v(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});var cr=T(),fh={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,cr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,cr._)`{limit: ${t}}`},ph={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:fh,code(t){let{keyword:e,data:r,schemaCode:s}=t,n=e==="maxProperties"?cr.operators.GT:cr.operators.LT;t.fail$data((0,cr._)`Object.keys(${r}).length ${n} ${s}`)}};no.default=ph});var hc=v(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});var lr=ve(),ur=T(),mh=j(),hh={message:({params:{missingProperty:t}})=>(0,ur.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ur._)`{missingProperty: ${t}}`},gh={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hh,code(t){let{gen:e,schema:r,schemaCode:s,data:n,$data:o,it:a}=t,{opts:i}=a;if(!o&&r.length===0)return;let c=r.length>=i.loopRequired;if(a.allErrors?u():l(),i.strictRequired){let g=t.parentSchema.properties,{definedProperties:p}=t.it;for(let m of r)if(g?.[m]===void 0&&!p.has(m)){let y=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,mh.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(c||o)t.block$data(ur.nil,d);else for(let g of r)(0,lr.checkReportMissingProp)(t,g)}function l(){let g=e.let("missing");if(c||o){let p=e.let("valid",!0);t.block$data(p,()=>h(g,p)),t.ok(p)}else e.if((0,lr.checkMissingProp)(t,r,g)),(0,lr.reportMissingProp)(t,g),e.else()}function d(){e.forOf("prop",s,g=>{t.setParams({missingProperty:g}),e.if((0,lr.noPropertyInData)(e,n,g,i.ownProperties),()=>t.error())})}function h(g,p){t.setParams({missingProperty:g}),e.forOf(g,s,()=>{e.assign(p,(0,lr.propertyInData)(e,n,g,i.ownProperties)),e.if((0,ur.not)(p),()=>{t.error(),e.break()})},ur.nil)}}};oo.default=gh});var gc=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});var dr=T(),yh={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,dr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,dr._)`{limit: ${t}}`},_h={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:yh,code(t){let{keyword:e,data:r,schemaCode:s}=t,n=e==="maxItems"?dr.operators.GT:dr.operators.LT;t.fail$data((0,dr._)`${r}.length ${n} ${s}`)}};ao.default=_h});var ls=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});var yc=kn();yc.code='require("ajv/dist/runtime/equal").default';io.default=yc});var _c=v(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});var co=Qt(),te=T(),vh=j(),$h=ls(),bh={message:({params:{i:t,j:e}})=>(0,te.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,te._)`{i: ${t}, j: ${e}}`},Sh={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:bh,code(t){let{gen:e,data:r,$data:s,schema:n,parentSchema:o,schemaCode:a,it:i}=t;if(!s&&!n)return;let c=e.let("valid"),u=o.items?(0,co.getSchemaTypes)(o.items):[];t.block$data(c,l,(0,te._)`${a} === false`),t.ok(c);function l(){let p=e.let("i",(0,te._)`${r}.length`),m=e.let("j");t.setParams({i:p,j:m}),e.assign(c,!0),e.if((0,te._)`${p} > 1`,()=>(d()?h:g)(p,m))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,m){let y=e.name("item"),_=(0,co.checkDataTypes)(u,y,i.opts.strictNumbers,co.DataType.Wrong),b=e.const("indices",(0,te._)`{}`);e.for((0,te._)`;${p}--;`,()=>{e.let(y,(0,te._)`${r}[${p}]`),e.if(_,(0,te._)`continue`),u.length>1&&e.if((0,te._)`typeof ${y} == "string"`,(0,te._)`${y} += "_"`),e.if((0,te._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(m,(0,te._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,te._)`${b}[${y}] = ${p}`)})}function g(p,m){let y=(0,vh.useFunc)(e,$h.default),_=e.name("outer");e.label(_).for((0,te._)`;${p}--;`,()=>e.for((0,te._)`${m} = ${p}; ${m}--;`,()=>e.if((0,te._)`${y}(${r}[${p}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};lo.default=Sh});var vc=v(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});var uo=T(),wh=j(),zh=ls(),kh={message:"must be equal to constant",params:({schemaCode:t})=>(0,uo._)`{allowedValue: ${t}}`},Ph={keyword:"const",$data:!0,error:kh,code(t){let{gen:e,data:r,$data:s,schemaCode:n,schema:o}=t;s||o&&typeof o=="object"?t.fail$data((0,uo._)`!${(0,wh.useFunc)(e,zh.default)}(${r}, ${n})`):t.fail((0,uo._)`${o} !== ${r}`)}};fo.default=Ph});var $c=v(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});var fr=T(),Eh=j(),xh=ls(),Th={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,fr._)`{allowedValues: ${t}}`},Rh={keyword:"enum",schemaType:"array",$data:!0,error:Th,code(t){let{gen:e,data:r,$data:s,schema:n,schemaCode:o,it:a}=t;if(!s&&n.length===0)throw new Error("enum must have non-empty array");let i=n.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,Eh.useFunc)(e,xh.default)),l;if(i||s)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let g=e.const("vSchema",o);l=(0,fr.or)(...n.map((p,m)=>h(g,m)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",o,g=>e.if((0,fr._)`${u()}(${r}, ${g})`,()=>e.assign(l,!0).break()))}function h(g,p){let m=n[p];return typeof m=="object"&&m!==null?(0,fr._)`${u()}(${r}, ${g}[${p}])`:(0,fr._)`${r} === ${m}`}}};po.default=Rh});var bc=v(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});var Ih=cc(),qh=lc(),Oh=fc(),Nh=pc(),jh=mc(),Ch=hc(),Ah=gc(),Mh=_c(),Dh=vc(),Fh=$c(),Lh=[Ih.default,qh.default,Oh.default,Nh.default,jh.default,Ch.default,Ah.default,Mh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Dh.default,Fh.default];mo.default=Lh});var go=v(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.validateAdditionalItems=void 0;var it=T(),ho=j(),Vh={message:({params:{len:t}})=>(0,it.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,it._)`{limit: ${t}}`},Uh={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Vh,code(t){let{parentSchema:e,it:r}=t,{items:s}=e;if(!Array.isArray(s)){(0,ho.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sc(t,s)}};function Sc(t,e){let{gen:r,schema:s,data:n,keyword:o,it:a}=t;a.items=!0;let i=r.const("len",(0,it._)`${n}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,it._)`${i} <= ${e.length}`);else if(typeof s=="object"&&!(0,ho.alwaysValidSchema)(a,s)){let u=r.var("valid",(0,it._)`${i} <= ${e.length}`);r.if((0,it.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,i,l=>{t.subschema({keyword:o,dataProp:l,dataPropType:ho.Type.Num},u),a.allErrors||r.if((0,it.not)(u),()=>r.break())})}}pr.validateAdditionalItems=Sc;pr.default=Uh});var yo=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.validateTuple=void 0;var wc=T(),us=j(),Hh=ve(),Zh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return zc(t,"additionalItems",e);r.items=!0,!(0,us.alwaysValidSchema)(r,e)&&t.ok((0,Hh.validateArray)(t))}};function zc(t,e,r=t.schema){let{gen:s,parentSchema:n,data:o,keyword:a,it:i}=t;l(n),i.opts.unevaluated&&r.length&&i.items!==!0&&(i.items=us.mergeEvaluated.items(s,r.length,i.items));let c=s.name("valid"),u=s.const("len",(0,wc._)`${o}.length`);r.forEach((d,h)=>{(0,us.alwaysValidSchema)(i,d)||(s.if((0,wc._)`${u} > ${h}`,()=>t.subschema({keyword:a,schemaProp:h,dataProp:h},c)),t.ok(c))});function l(d){let{opts:h,errSchemaPath:g}=i,p=r.length,m=p===d.minItems&&(p===d.maxItems||d[e]===!1);if(h.strictTuples&&!m){let y=`"${a}" is ${p}-tuple, but minItems or maxItems/${e} are not specified or different at path "${g}"`;(0,us.checkStrictMode)(i,y,h.strictTuples)}}}mr.validateTuple=zc;mr.default=Zh});var kc=v(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});var Kh=yo(),Gh={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Kh.validateTuple)(t,"items")};_o.default=Gh});var Ec=v(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var Pc=T(),Jh=j(),Bh=ve(),Qh=go(),Wh={message:({params:{len:t}})=>(0,Pc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Pc._)`{limit: ${t}}`},Yh={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Wh,code(t){let{schema:e,parentSchema:r,it:s}=t,{prefixItems:n}=r;s.items=!0,!(0,Jh.alwaysValidSchema)(s,e)&&(n?(0,Qh.validateAdditionalItems)(t,n):t.ok((0,Bh.validateArray)(t)))}};vo.default=Yh});var xc=v($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});var be=T(),ds=j(),Xh={message:({params:{min:t,max:e}})=>e===void 0?(0,be.str)`must contain at least ${t} valid item(s)`:(0,be.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,be._)`{minContains: ${t}}`:(0,be._)`{minContains: ${t}, maxContains: ${e}}`},eg={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Xh,code(t){let{gen:e,schema:r,parentSchema:s,data:n,it:o}=t,a,i,{minContains:c,maxContains:u}=s;o.opts.next?(a=c===void 0?1:c,i=u):a=1;let l=e.const("len",(0,be._)`${n}.length`);if(t.setParams({min:a,max:i}),i===void 0&&a===0){(0,ds.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0,ds.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ds.alwaysValidSchema)(o,r)){let m=(0,be._)`${l} >= ${a}`;i!==void 0&&(m=(0,be._)`${m} && ${l} <= ${i}`),t.pass(m);return}o.items=!0;let d=e.name("valid");i===void 0&&a===1?g(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),i!==void 0&&e.if((0,be._)`${n}.length > 0`,h)):(e.let(d,!1),h()),t.result(d,()=>t.reset());function h(){let m=e.name("_valid"),y=e.let("count",0);g(m,()=>e.if(m,()=>p(y)))}function g(m,y){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:ds.Type.Num,compositeRule:!0},m),y()})}function p(m){e.code((0,be._)`${m}++`),i===void 0?e.if((0,be._)`${m} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,be._)`${m} > ${i}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,be._)`${m} >= ${a}`,()=>e.assign(d,!0)))}}};$o.default=eg});var Ic=v(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.validateSchemaDeps=Re.validatePropertyDeps=Re.error=void 0;var bo=T(),tg=j(),hr=ve();Re.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let s=e===1?"property":"properties";return(0,bo.str)`must have ${s} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:s}})=>(0,bo._)`{property: ${t},
8
+ missingProperty: ${s},
9
+ depsCount: ${e},
10
+ deps: ${r}}`};var rg={keyword:"dependencies",type:"object",schemaType:"object",error:Re.error,code(t){let[e,r]=sg(t);Tc(t,e),Rc(t,r)}};function sg({schema:t}){let e={},r={};for(let s in t){if(s==="__proto__")continue;let n=Array.isArray(t[s])?e:r;n[s]=t[s]}return[e,r]}function Tc(t,e=t.schema){let{gen:r,data:s,it:n}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let a in e){let i=e[a];if(i.length===0)continue;let c=(0,hr.propertyInData)(r,s,a,n.opts.ownProperties);t.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of i)(0,hr.checkReportMissingProp)(t,u)}):(r.if((0,bo._)`${c} && (${(0,hr.checkMissingProp)(t,i,o)})`),(0,hr.reportMissingProp)(t,o),r.else())}}Re.validatePropertyDeps=Tc;function Rc(t,e=t.schema){let{gen:r,data:s,keyword:n,it:o}=t,a=r.name("valid");for(let i in e)(0,tg.alwaysValidSchema)(o,e[i])||(r.if((0,hr.propertyInData)(r,s,i,o.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:i},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}Re.validateSchemaDeps=Rc;Re.default=rg});var Oc=v(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});var qc=T(),ng=j(),og={message:"property name must be valid",params:({params:t})=>(0,qc._)`{propertyName: ${t.propertyName}}`},ag={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:og,code(t){let{gen:e,schema:r,data:s,it:n}=t;if((0,ng.alwaysValidSchema)(n,r))return;let o=e.name("valid");e.forIn("key",s,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),e.if((0,qc.not)(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}};So.default=ag});var zo=v(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});var fs=ve(),ke=T(),ig=Ae(),ps=j(),cg={message:"must NOT have additional properties",params:({params:t})=>(0,ke._)`{additionalProperty: ${t.additionalProperty}}`},lg={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:cg,code(t){let{gen:e,schema:r,parentSchema:s,data:n,errsCount:o,it:a}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:i,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,ps.alwaysValidSchema)(a,r))return;let u=(0,fs.allSchemaProperties)(s.properties),l=(0,fs.allSchemaProperties)(s.patternProperties);d(),t.ok((0,ke._)`${o} === ${ig.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?p(y):e.if(h(y),()=>p(y))})}function h(y){let _;if(u.length>8){let b=(0,ps.schemaRefOrVal)(a,s.properties,"properties");_=(0,fs.isOwnProperty)(e,b,y)}else u.length?_=(0,ke.or)(...u.map(b=>(0,ke._)`${y} === ${b}`)):_=ke.nil;return l.length&&(_=(0,ke.or)(_,...l.map(b=>(0,ke._)`${(0,fs.usePattern)(t,b)}.test(${y})`))),(0,ke.not)(_)}function g(y){e.code((0,ke._)`delete ${n}[${y}]`)}function p(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){g(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),i||e.break();return}if(typeof r=="object"&&!(0,ps.alwaysValidSchema)(a,r)){let _=e.name("valid");c.removeAdditional==="failing"?(m(y,_,!1),e.if((0,ke.not)(_),()=>{t.reset(),g(y)})):(m(y,_),i||e.if((0,ke.not)(_),()=>e.break()))}}function m(y,_,b){let z={keyword:"additionalProperties",dataProp:y,dataPropType:ps.Type.Str};b===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(z,_)}}};wo.default=lg});var Cc=v(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});var ug=er(),Nc=ve(),ko=j(),jc=zo(),dg={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:s,data:n,it:o}=t;o.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&jc.default.code(new ug.KeywordCxt(o,jc.default,"additionalProperties"));let a=(0,Nc.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=ko.mergeEvaluated.props(e,(0,ko.toHash)(a),o.props));let i=a.filter(d=>!(0,ko.alwaysValidSchema)(o,r[d]));if(i.length===0)return;let c=e.name("valid");for(let d of i)u(d)?l(d):(e.if((0,Nc.propertyInData)(e,n,d,o.opts.ownProperties)),l(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Po.default=dg});var Fc=v(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});var Ac=ve(),ms=T(),Mc=j(),Dc=j(),fg={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:s,parentSchema:n,it:o}=t,{opts:a}=o,i=(0,Ac.allSchemaProperties)(r),c=i.filter(m=>(0,Mc.alwaysValidSchema)(o,r[m]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&n.properties,l=e.name("valid");o.props!==!0&&!(o.props instanceof ms.Name)&&(o.props=(0,Dc.evaluatedPropsToName)(e,o.props));let{props:d}=o;h();function h(){for(let m of i)u&&g(m),o.allErrors?p(m):(e.var(l,!0),p(m),e.if(l))}function g(m){for(let y in u)new RegExp(m).test(y)&&(0,Mc.checkStrictMode)(o,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function p(m){e.forIn("key",s,y=>{e.if((0,ms._)`${(0,Ac.usePattern)(t,m)}.test(${y})`,()=>{let _=c.includes(m);_||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:Dc.Type.Str},l),o.opts.unevaluated&&d!==!0?e.assign((0,ms._)`${d}[${y}]`,!0):!_&&!o.allErrors&&e.if((0,ms.not)(l),()=>e.break())})})}}};Eo.default=fg});var Lc=v(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});var pg=j(),mg={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:s}=t;if((0,pg.alwaysValidSchema)(s,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"}};xo.default=mg});var Vc=v(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});var hg=ve(),gg={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hg.validateUnion,error:{message:"must match a schema in anyOf"}};To.default=gg});var Uc=v(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});var hs=T(),yg=j(),_g={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hs._)`{passingSchemas: ${t.passing}}`},vg={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:_g,code(t){let{gen:e,schema:r,parentSchema:s,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&s.discriminator)return;let o=r,a=e.let("valid",!1),i=e.let("passing",null),c=e.name("_valid");t.setParams({passing:i}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){o.forEach((l,d)=>{let h;(0,yg.alwaysValidSchema)(n,l)?e.var(c,!0):h=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,hs._)`${c} && ${a}`).assign(a,!1).assign(i,(0,hs._)`[${i}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(i,d),h&&t.mergeEvaluated(h,hs.Name)})})}}};Ro.default=vg});var Hc=v(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});var $g=j(),bg={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((o,a)=>{if((0,$g.alwaysValidSchema)(s,o))return;let i=t.subschema({keyword:"allOf",schemaProp:a},n);t.ok(n),t.mergeEvaluated(i)})}};Io.default=bg});var Gc=v(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});var gs=T(),Kc=j(),Sg={message:({params:t})=>(0,gs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,gs._)`{failingKeyword: ${t.ifClause}}`},wg={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Sg,code(t){let{gen:e,parentSchema:r,it:s}=t;r.then===void 0&&r.else===void 0&&(0,Kc.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let n=Zc(s,"then"),o=Zc(s,"else");if(!n&&!o)return;let a=e.let("valid",!0),i=e.name("_valid");if(c(),t.reset(),n&&o){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(i,u("then",l),u("else",l))}else n?e.if(i,u("then")):e.if((0,gs.not)(i),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);t.mergeEvaluated(l)}function u(l,d){return()=>{let h=t.subschema({keyword:l},i);e.assign(a,i),t.mergeValidEvaluated(h,a),d?e.assign(d,(0,gs._)`${l}`):t.setParams({ifClause:l})}}}};function Zc(t,e){let r=t.schema[e];return r!==void 0&&!(0,Kc.alwaysValidSchema)(t,r)}qo.default=wg});var Jc=v(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});var zg=j(),kg={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,zg.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Oo.default=kg});var Bc=v(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});var Pg=go(),Eg=kc(),xg=yo(),Tg=Ec(),Rg=xc(),Ig=Ic(),qg=Oc(),Og=zo(),Ng=Cc(),jg=Fc(),Cg=Lc(),Ag=Vc(),Mg=Uc(),Dg=Hc(),Fg=Gc(),Lg=Jc();function Vg(t=!1){let e=[Cg.default,Ag.default,Mg.default,Dg.default,Fg.default,Lg.default,qg.default,Og.default,Ig.default,Ng.default,jg.default];return t?e.push(Eg.default,Tg.default):e.push(Pg.default,xg.default),e.push(Rg.default),e}No.default=Vg});var Qc=v(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});var J=T(),Ug={message:({schemaCode:t})=>(0,J.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,J._)`{format: ${t}}`},Hg={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Ug,code(t,e){let{gen:r,data:s,$data:n,schema:o,schemaCode:a,it:i}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=i;if(!c.validateFormats)return;n?h():g();function h(){let p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,J._)`${p}[${a}]`),y=r.let("fType"),_=r.let("format");r.if((0,J._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,J._)`${m}.type || "string"`).assign(_,(0,J._)`${m}.validate`),()=>r.assign(y,(0,J._)`"string"`).assign(_,m)),t.fail$data((0,J.or)(b(),z()));function b(){return c.strictSchema===!1?J.nil:(0,J._)`${a} && !${_}`}function z(){let A=l.$async?(0,J._)`(${m}.async ? await ${_}(${s}) : ${_}(${s}))`:(0,J._)`${_}(${s})`,E=(0,J._)`(typeof ${_} == "function" ? ${A} : ${_}.test(${s}))`;return(0,J._)`${_} && ${_} !== true && ${y} === ${e} && !${E}`}}function g(){let p=d.formats[o];if(!p){b();return}if(p===!0)return;let[m,y,_]=z(p);m===e&&t.pass(A());function b(){if(c.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function z(E){let Ee=E instanceof RegExp?(0,J.regexpCode)(E):c.code.formats?(0,J._)`${c.code.formats}${(0,J.getProperty)(o)}`:void 0,Oe=r.scopeValue("formats",{key:o,ref:E,code:Ee});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,J._)`${Oe}.validate`]:["string",E,Oe]}function A(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw new Error("async format in sync schema");return(0,J._)`await ${_}(${s})`}return typeof y=="function"?(0,J._)`${_}(${s})`:(0,J._)`${_}.test(${s})`}}}};jo.default=Hg});var Wc=v(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});var Zg=Qc(),Kg=[Zg.default];Co.default=Kg});var Yc=v(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.contentVocabulary=wt.metadataVocabulary=void 0;wt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var el=v(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});var Gg=ic(),Jg=bc(),Bg=Bc(),Qg=Wc(),Xc=Yc(),Wg=[Gg.default,Jg.default,(0,Bg.default)(),Qg.default,Xc.metadataVocabulary,Xc.contentVocabulary];Ao.default=Wg});var rl=v(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.DiscrError=void 0;var tl;(function(t){t.Tag="tag",t.Mapping="mapping"})(tl||(ys.DiscrError=tl={}))});var nl=v(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});var zt=T(),Mo=rl(),sl=Qr(),Yg=tr(),Xg=j(),ey={message:({params:{discrError:t,tagName:e}})=>t===Mo.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,zt._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},ty={keyword:"discriminator",type:"object",schemaType:"object",error:ey,code(t){let{gen:e,data:r,schema:s,parentSchema:n,it:o}=t,{oneOf:a}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=s.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,zt._)`${r}${(0,zt.getProperty)(i)}`);e.if((0,zt._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Mo.DiscrError.Tag,tag:u,tagName:i})),t.ok(c);function l(){let g=h();e.if(!1);for(let p in g)e.elseIf((0,zt._)`${u} === ${p}`),e.assign(c,d(g[p]));e.else(),t.error(!1,{discrError:Mo.DiscrError.Mapping,tag:u,tagName:i}),e.endIf()}function d(g){let p=e.name("valid"),m=t.subschema({keyword:"oneOf",schemaProp:g},p);return t.mergeEvaluated(m,zt.Name),p}function h(){var g;let p={},m=_(n),y=!0;for(let A=0;A<a.length;A++){let E=a[A];if(E?.$ref&&!(0,Xg.schemaHasRulesButRef)(E,o.self.RULES)){let Oe=E.$ref;if(E=sl.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,Oe),E instanceof sl.SchemaEnv&&(E=E.schema),E===void 0)throw new Yg.default(o.opts.uriResolver,o.baseId,Oe)}let Ee=(g=E?.properties)===null||g===void 0?void 0:g[i];if(typeof Ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);y=y&&(m||_(E)),b(Ee,A)}if(!y)throw new Error(`discriminator: "${i}" must be required`);return p;function _({required:A}){return Array.isArray(A)&&A.includes(i)}function b(A,E){if(A.const)z(A.const,E);else if(A.enum)for(let Ee of A.enum)z(Ee,E);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function z(A,E){if(typeof A!="string"||A in p)throw new Error(`discriminator: "${i}" values must be unique strings`);p[A]=E}}}};Do.default=ty});var ol=v((Wb,ry)=>{ry.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 Lo=v((H,Fo)=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.MissingRefError=H.ValidationError=H.CodeGen=H.Name=H.nil=H.stringify=H.str=H._=H.KeywordCxt=H.Ajv=void 0;var sy=tc(),ny=el(),oy=nl(),al=ol(),ay=["/properties"],_s="http://json-schema.org/draft-07/schema",kt=class extends sy.default{_addVocabularies(){super._addVocabularies(),ny.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(oy.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(al,ay):al;this.addMetaSchema(e,_s,!1),this.refs["http://json-schema.org/schema"]=_s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_s)?_s:void 0)}};H.Ajv=kt;Fo.exports=H=kt;Fo.exports.Ajv=kt;Object.defineProperty(H,"__esModule",{value:!0});H.default=kt;var iy=er();Object.defineProperty(H,"KeywordCxt",{enumerable:!0,get:function(){return iy.KeywordCxt}});var Pt=T();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return Pt._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return Pt.str}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return Pt.stringify}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return Pt.nil}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return Pt.Name}});Object.defineProperty(H,"CodeGen",{enumerable:!0,get:function(){return Pt.CodeGen}});var cy=Jr();Object.defineProperty(H,"ValidationError",{enumerable:!0,get:function(){return cy.default}});var ly=tr();Object.defineProperty(H,"MissingRefError",{enumerable:!0,get:function(){return ly.default}})});var ml=v(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.formatNames=qe.fastFormats=qe.fullFormats=void 0;function Ie(t,e){return{validate:t,compare:e}}qe.fullFormats={date:Ie(ul,Zo),time:Ie(Uo(!0),Ko),"date-time":Ie(il(!0),fl),"iso-time":Ie(Uo(),dl),"iso-date-time":Ie(il(),pl),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hy,"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:Sy,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:gy,int32:{type:"number",validate:vy},int64:{type:"number",validate:$y},float:{type:"number",validate:ll},double:{type:"number",validate:ll},password:!0,binary:!0};qe.fastFormats={...qe.fullFormats,date:Ie(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Zo),time:Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ko),"date-time":Ie(/^\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,fl),"iso-time":Ie(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,dl),"iso-date-time":Ie(/^\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,pl),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};qe.formatNames=Object.keys(qe.fullFormats);function uy(t){return t%4===0&&(t%100!==0||t%400===0)}var dy=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fy=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ul(t){let e=dy.exec(t);if(!e)return!1;let r=+e[1],s=+e[2],n=+e[3];return s>=1&&s<=12&&n>=1&&n<=(s===2&&uy(r)?29:fy[s])}function Zo(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Vo=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Uo(t){return function(r){let s=Vo.exec(r);if(!s)return!1;let n=+s[1],o=+s[2],a=+s[3],i=s[4],c=s[5]==="-"?-1:1,u=+(s[6]||0),l=+(s[7]||0);if(u>23||l>59||t&&!i)return!1;if(n<=23&&o<=59&&a<60)return!0;let d=o-l*c,h=n-u*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&a<61}}function Ko(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),s=new Date("2020-01-01T"+e).valueOf();if(r&&s)return r-s}function dl(t,e){if(!(t&&e))return;let r=Vo.exec(t),s=Vo.exec(e);if(r&&s)return t=r[1]+r[2]+r[3],e=s[1]+s[2]+s[3],t>e?1:t<e?-1:0}var Ho=/t|\s/i;function il(t){let e=Uo(t);return function(s){let n=s.split(Ho);return n.length===2&&ul(n[0])&&e(n[1])}}function fl(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),s=new Date(e).valueOf();if(r&&s)return r-s}function pl(t,e){if(!(t&&e))return;let[r,s]=t.split(Ho),[n,o]=e.split(Ho),a=Zo(r,n);if(a!==void 0)return a||Ko(s,o)}var py=/\/|:/,my=/^(?:[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 hy(t){return py.test(t)&&my.test(t)}var cl=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function gy(t){return cl.lastIndex=0,cl.test(t)}var yy=-(2**31),_y=2**31-1;function vy(t){return Number.isInteger(t)&&t<=_y&&t>=yy}function $y(t){return Number.isInteger(t)}function ll(){return!0}var by=/[^\\]\\Z/;function Sy(t){if(by.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var hl=v(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatLimitDefinition=void 0;var wy=Lo(),Pe=T(),Be=Pe.operators,vs={formatMaximum:{okStr:"<=",ok:Be.LTE,fail:Be.GT},formatMinimum:{okStr:">=",ok:Be.GTE,fail:Be.LT},formatExclusiveMaximum:{okStr:"<",ok:Be.LT,fail:Be.GTE},formatExclusiveMinimum:{okStr:">",ok:Be.GT,fail:Be.LTE}},zy={message:({keyword:t,schemaCode:e})=>(0,Pe.str)`should be ${vs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Pe._)`{comparison: ${vs[t].okStr}, limit: ${e}}`};Et.formatLimitDefinition={keyword:Object.keys(vs),type:"string",schemaType:"string",$data:!0,error:zy,code(t){let{gen:e,data:r,schemaCode:s,keyword:n,it:o}=t,{opts:a,self:i}=o;if(!a.validateFormats)return;let c=new wy.KeywordCxt(o,i.RULES.all.format.definition,"format");c.$data?u():l();function u(){let h=e.scopeValue("formats",{ref:i.formats,code:a.code.formats}),g=e.const("fmt",(0,Pe._)`${h}[${c.schemaCode}]`);t.fail$data((0,Pe.or)((0,Pe._)`typeof ${g} != "object"`,(0,Pe._)`${g} instanceof RegExp`,(0,Pe._)`typeof ${g}.compare != "function"`,d(g)))}function l(){let h=c.schema,g=i.formats[h];if(!g||g===!0)return;if(typeof g!="object"||g instanceof RegExp||typeof g.compare!="function")throw new Error(`"${n}": format "${h}" does not define "compare" function`);let p=e.scopeValue("formats",{key:h,ref:g,code:a.code.formats?(0,Pe._)`${a.code.formats}${(0,Pe.getProperty)(h)}`:void 0});t.fail$data(d(p))}function d(h){return(0,Pe._)`${h}.compare(${r}, ${s}) ${vs[n].fail} 0`}},dependencies:["format"]};var ky=t=>(t.addKeyword(Et.formatLimitDefinition),t);Et.default=ky});var vl=v((gr,_l)=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});var xt=ml(),Py=hl(),Go=T(),gl=new Go.Name("fullFormats"),Ey=new Go.Name("fastFormats"),Jo=(t,e={keywords:!0})=>{if(Array.isArray(e))return yl(t,e,xt.fullFormats,gl),t;let[r,s]=e.mode==="fast"?[xt.fastFormats,Ey]:[xt.fullFormats,gl],n=e.formats||xt.formatNames;return yl(t,n,r,s),e.keywords&&(0,Py.default)(t),t};Jo.get=(t,e="full")=>{let s=(e==="fast"?xt.fastFormats:xt.fullFormats)[t];if(!s)throw new Error(`Unknown format "${t}"`);return s};function yl(t,e,r,s){var n,o;(n=(o=t.opts.code).formats)!==null&&n!==void 0||(o.formats=(0,Go._)`require("ajv-formats/dist/formats").${s}`);for(let a of e)t.addFormat(a,r[a])}_l.exports=gr=Jo;Object.defineProperty(gr,"__esModule",{value:!0});gr.default=Jo});var Is="2025-11-25",qy="2025-03-26",ta=[Is,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],De="io.modelcontextprotocol/related-task",_r="2.0",B=Xo(t=>t!==null&&(typeof t=="object"||typeof t=="function")),ra=Z([f(),D().int()]),sa=f(),Oy=ae({ttl:D().optional(),pollInterval:D().optional()}),Tl=$({ttl:D().optional()}),Rl=$({taskId:f()}),qs=ae({progressToken:ra.optional(),[De]:Rl.optional()}),he=$({_meta:qs.optional()}),Rt=he.extend({task:Tl.optional()}),na=t=>Rt.safeParse(t).success,W=$({method:f(),params:he.loose().optional()}),ge=$({_meta:qs.optional()}),ye=$({method:f(),params:ge.loose().optional()}),Y=ae({_meta:qs.optional()}),vr=Z([f(),D().int()]),oa=$({jsonrpc:S(_r),id:vr,...W.shape}).strict(),Os=t=>oa.safeParse(t).success,aa=$({jsonrpc:S(_r),...ye.shape}).strict(),ia=t=>aa.safeParse(t).success,Ns=$({jsonrpc:S(_r),id:vr,result:Y}).strict(),It=t=>Ns.safeParse(t).success;var R;(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"})(R||(R={}));var js=$({jsonrpc:S(_r),id:vr.optional(),error:$({code:D().int(),message:f(),data:G().optional()})}).strict();var ca=t=>js.safeParse(t).success;var la=Z([oa,aa,Ns,js]),Ny=Z([Ns,js]),$r=Y.strict(),Il=ge.extend({requestId:vr.optional(),reason:f().optional()}),br=ye.extend({method:S("notifications/cancelled"),params:Il}),ql=$({src:f(),mimeType:f().optional(),sizes:N(f()).optional(),theme:me(["light","dark"]).optional()}),qt=$({icons:N(ql).optional()}),ct=$({name:f(),title:f().optional()}),ua=ct.extend({...ct.shape,...qt.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),Ol=xs($({applyDefaults:Q().optional()}),V(f(),G())),Nl=Ts(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,xs($({form:Ol.optional(),url:B.optional()}),V(f(),G()).optional())),jl=ae({list:B.optional(),cancel:B.optional(),requests:ae({sampling:ae({createMessage:B.optional()}).optional(),elicitation:ae({create:B.optional()}).optional()}).optional()}),Cl=ae({list:B.optional(),cancel:B.optional(),requests:ae({tools:ae({call:B.optional()}).optional()}).optional()}),Al=$({experimental:V(f(),B).optional(),sampling:$({context:B.optional(),tools:B.optional()}).optional(),elicitation:Nl.optional(),roots:$({listChanged:Q().optional()}).optional(),tasks:jl.optional(),extensions:V(f(),B).optional()}),Ml=he.extend({protocolVersion:f(),capabilities:Al,clientInfo:ua}),Sr=W.extend({method:S("initialize"),params:Ml}),jy=t=>Sr.safeParse(t).success,Dl=$({experimental:V(f(),B).optional(),logging:B.optional(),completions:B.optional(),prompts:$({listChanged:Q().optional()}).optional(),resources:$({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:$({listChanged:Q().optional()}).optional(),tasks:Cl.optional(),extensions:V(f(),B).optional()}),Fl=Y.extend({protocolVersion:f(),capabilities:Dl,serverInfo:ua,instructions:f().optional()}),Cs=ye.extend({method:S("notifications/initialized"),params:ge.optional()});var wr=W.extend({method:S("ping"),params:he.optional()}),Ll=$({progress:D(),total:K(D()),message:K(f())}),Vl=$({...ge.shape,...Ll.shape,progressToken:ra}),zr=ye.extend({method:S("notifications/progress"),params:Vl}),Ul=he.extend({cursor:sa.optional()}),Ot=W.extend({params:Ul.optional()}),Nt=Y.extend({nextCursor:sa.optional()}),Hl=me(["working","input_required","completed","failed","cancelled"]),jt=$({taskId:f(),status:Hl,ttl:Z([D(),Yo()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:K(D()),statusMessage:K(f())}),lt=Y.extend({task:jt}),Zl=ge.merge(jt),Ct=ye.extend({method:S("notifications/tasks/status"),params:Zl}),kr=W.extend({method:S("tasks/get"),params:he.extend({taskId:f()})}),Pr=Y.merge(jt),Er=W.extend({method:S("tasks/result"),params:he.extend({taskId:f()})}),Cy=Y.loose(),xr=Ot.extend({method:S("tasks/list")}),Tr=Nt.extend({tasks:N(jt)}),Rr=W.extend({method:S("tasks/cancel"),params:he.extend({taskId:f()})}),da=Y.merge(jt),fa=$({uri:f(),mimeType:K(f()),_meta:V(f(),G()).optional()}),pa=fa.extend({text:f()}),As=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),ma=fa.extend({blob:As}),At=me(["user","assistant"]),ut=$({audience:N(At).optional(),priority:D().min(0).max(1).optional(),lastModified:ea.datetime({offset:!0}).optional()}),ha=$({...ct.shape,...qt.shape,uri:f(),description:K(f()),mimeType:K(f()),size:K(D()),annotations:ut.optional(),_meta:K(ae({}))}),Kl=$({...ct.shape,...qt.shape,uriTemplate:f(),description:K(f()),mimeType:K(f()),annotations:ut.optional(),_meta:K(ae({}))}),Gl=Ot.extend({method:S("resources/list")}),Jl=Nt.extend({resources:N(ha)}),Bl=Ot.extend({method:S("resources/templates/list")}),Ql=Nt.extend({resourceTemplates:N(Kl)}),Ms=he.extend({uri:f()}),Wl=Ms,Yl=W.extend({method:S("resources/read"),params:Wl}),Xl=Y.extend({contents:N(Z([pa,ma]))}),eu=ye.extend({method:S("notifications/resources/list_changed"),params:ge.optional()}),tu=Ms,ru=W.extend({method:S("resources/subscribe"),params:tu}),su=Ms,nu=W.extend({method:S("resources/unsubscribe"),params:su}),ou=ge.extend({uri:f()}),au=ye.extend({method:S("notifications/resources/updated"),params:ou}),iu=$({name:f(),description:K(f()),required:K(Q())}),cu=$({...ct.shape,...qt.shape,description:K(f()),arguments:K(N(iu)),_meta:K(ae({}))}),lu=Ot.extend({method:S("prompts/list")}),uu=Nt.extend({prompts:N(cu)}),du=he.extend({name:f(),arguments:V(f(),f()).optional()}),fu=W.extend({method:S("prompts/get"),params:du}),Ds=$({type:S("text"),text:f(),annotations:ut.optional(),_meta:V(f(),G()).optional()}),Fs=$({type:S("image"),data:As,mimeType:f(),annotations:ut.optional(),_meta:V(f(),G()).optional()}),Ls=$({type:S("audio"),data:As,mimeType:f(),annotations:ut.optional(),_meta:V(f(),G()).optional()}),pu=$({type:S("tool_use"),name:f(),id:f(),input:V(f(),G()),_meta:V(f(),G()).optional()}),mu=$({type:S("resource"),resource:Z([pa,ma]),annotations:ut.optional(),_meta:V(f(),G()).optional()}),hu=ha.extend({type:S("resource_link")}),Vs=Z([Ds,Fs,Ls,hu,mu]),gu=$({role:At,content:Vs}),yu=Y.extend({description:f().optional(),messages:N(gu)}),_u=ye.extend({method:S("notifications/prompts/list_changed"),params:ge.optional()}),vu=$({title:f().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),$u=$({taskSupport:me(["required","optional","forbidden"]).optional()}),ga=$({...ct.shape,...qt.shape,description:f().optional(),inputSchema:$({type:S("object"),properties:V(f(),B).optional(),required:N(f()).optional()}).catchall(G()),outputSchema:$({type:S("object"),properties:V(f(),B).optional(),required:N(f()).optional()}).catchall(G()).optional(),annotations:vu.optional(),execution:$u.optional(),_meta:V(f(),G()).optional()}),bu=Ot.extend({method:S("tools/list")}),Su=Nt.extend({tools:N(ga)}),Ir=Y.extend({content:N(Vs).default([]),structuredContent:V(f(),G()).optional(),isError:Q().optional()}),Ay=Ir.or(Y.extend({toolResult:G()})),wu=Rt.extend({name:f(),arguments:V(f(),G()).optional()}),Us=W.extend({method:S("tools/call"),params:wu}),zu=ye.extend({method:S("notifications/tools/list_changed"),params:ge.optional()}),My=$({autoRefresh:Q().default(!0),debounceMs:D().int().nonnegative().default(300)}),Mt=me(["debug","info","notice","warning","error","critical","alert","emergency"]),ku=he.extend({level:Mt}),Hs=W.extend({method:S("logging/setLevel"),params:ku}),Pu=ge.extend({level:Mt,logger:f().optional(),data:G()}),Eu=ye.extend({method:S("notifications/message"),params:Pu}),xu=$({name:f().optional()}),Tu=$({hints:N(xu).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),Ru=$({mode:me(["auto","required","none"]).optional()}),Iu=$({type:S("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:N(Vs).default([]),structuredContent:$({}).loose().optional(),isError:Q().optional(),_meta:V(f(),G()).optional()}),qu=Es("type",[Ds,Fs,Ls]),yr=Es("type",[Ds,Fs,Ls,pu,Iu]),Ou=$({role:At,content:Z([yr,N(yr)]),_meta:V(f(),G()).optional()}),Nu=Rt.extend({messages:N(Ou),modelPreferences:Tu.optional(),systemPrompt:f().optional(),includeContext:me(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:N(f()).optional(),metadata:B.optional(),tools:N(ga).optional(),toolChoice:Ru.optional()}),ju=W.extend({method:S("sampling/createMessage"),params:Nu}),Dt=Y.extend({model:f(),stopReason:K(me(["endTurn","stopSequence","maxTokens"]).or(f())),role:At,content:qu}),Zs=Y.extend({model:f(),stopReason:K(me(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:At,content:Z([yr,N(yr)])}),Cu=$({type:S("boolean"),title:f().optional(),description:f().optional(),default:Q().optional()}),Au=$({type:S("string"),title:f().optional(),description:f().optional(),minLength:D().optional(),maxLength:D().optional(),format:me(["email","uri","date","date-time"]).optional(),default:f().optional()}),Mu=$({type:me(["number","integer"]),title:f().optional(),description:f().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),Du=$({type:S("string"),title:f().optional(),description:f().optional(),enum:N(f()),default:f().optional()}),Fu=$({type:S("string"),title:f().optional(),description:f().optional(),oneOf:N($({const:f(),title:f()})),default:f().optional()}),Lu=$({type:S("string"),title:f().optional(),description:f().optional(),enum:N(f()),enumNames:N(f()).optional(),default:f().optional()}),Vu=Z([Du,Fu]),Uu=$({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:$({type:S("string"),enum:N(f())}),default:N(f()).optional()}),Hu=$({type:S("array"),title:f().optional(),description:f().optional(),minItems:D().optional(),maxItems:D().optional(),items:$({anyOf:N($({const:f(),title:f()}))}),default:N(f()).optional()}),Zu=Z([Uu,Hu]),Ku=Z([Lu,Vu,Zu]),Gu=Z([Ku,Cu,Au,Mu]),Ju=Rt.extend({mode:S("form").optional(),message:f(),requestedSchema:$({type:S("object"),properties:V(f(),Gu),required:N(f()).optional()})}),Bu=Rt.extend({mode:S("url"),message:f(),elicitationId:f(),url:f().url()}),Qu=Z([Ju,Bu]),Wu=W.extend({method:S("elicitation/create"),params:Qu}),Yu=ge.extend({elicitationId:f()}),Xu=ye.extend({method:S("notifications/elicitation/complete"),params:Yu}),dt=Y.extend({action:me(["accept","decline","cancel"]),content:Ts(t=>t===null?void 0:t,V(f(),Z([f(),D(),Q(),N(f())])).optional())}),ed=$({type:S("ref/resource"),uri:f()});var td=$({type:S("ref/prompt"),name:f()}),rd=he.extend({ref:Z([td,ed]),argument:$({name:f(),value:f()}),context:$({arguments:V(f(),f()).optional()}).optional()}),sd=W.extend({method:S("completion/complete"),params:rd});var nd=Y.extend({completion:ae({values:N(f()).max(100),total:K(D().int()),hasMore:K(Q())})}),od=$({uri:f().startsWith("file://"),name:f().optional(),_meta:V(f(),G()).optional()}),ad=W.extend({method:S("roots/list"),params:he.optional()}),Ks=Y.extend({roots:N(od)}),id=ye.extend({method:S("notifications/roots/list_changed"),params:ge.optional()}),Dy=Z([wr,Sr,sd,Hs,fu,lu,Gl,Bl,Yl,ru,nu,Us,bu,kr,Er,xr,Rr]),Fy=Z([br,zr,Cs,id,Ct]),Ly=Z([$r,Dt,Zs,dt,Ks,Pr,Tr,lt]),Vy=Z([wr,ju,Wu,ad,kr,Er,xr,Rr]),Uy=Z([br,zr,Eu,au,eu,zu,_u,Ct,Xu]),Hy=Z([$r,Fl,nd,yu,uu,Jl,Ql,Xl,Ir,Su,Pr,Tr,lt]),P=class t extends Error{constructor(e,r,s){super(`MCP error ${e}: ${r}`),this.code=e,this.data=s,this.name="McpError"}static fromError(e,r,s){if(e===R.UrlElicitationRequired&&s){let n=s;if(n.elicitations)return new Rs(n.elicitations,r)}return new t(e,r,s)}},Rs=class extends P{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(R.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function qr(t){return!!t._zod}function Fe(t,e){return qr(t)?Ps(t,e):t.safeParse(e)}function Or(t){if(!t)return;let e;if(qr(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Nr(t){if(qr(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let s=t.value;if(s!==void 0)return s}function Le(t){return t==="completed"||t==="failed"||t==="cancelled"}var F0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gs(t){let r=Or(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let s=Nr(r);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function Js(t,e){let r=Fe(t,e);if(!r.success)throw r.error;return r.data}var md=6e4,jr=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(br,r=>{this._oncancel(r)}),this.setNotificationHandler(zr,r=>{this._onprogress(r)}),this.setRequestHandler(wr,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(kr,async(r,s)=>{let n=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!n)throw new P(R.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Er,async(r,s)=>{let n=async()=>{let o=r.params.taskId;if(!await this._taskStore.getTask(o,s.sessionId))throw new P(R.InvalidParams,`Task not found: ${o}`);if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(o,s.sessionId);){if(i.type==="response"||i.type==="error"){let c=i.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),i.type==="response")l(c);else{let d=c,h=new P(d.error.code,d.error.message,d.error.data);l(h)}else{let d=i.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}let a=await this._taskStore.getTask(o,s.sessionId);if(!a)throw new P(R.InvalidParams,`Task not found: ${o}`);if(!Le(a.status))return await this._waitForTaskUpdate(o,s.signal,s.sessionId),await n();if(Le(a.status)){let i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o,s.sessionId),{...i,_meta:{...i._meta,[De]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(xr,async(r,s)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,s.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new P(R.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Rr,async(r,s)=>{try{let n=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!n)throw new P(R.InvalidParams,`Task not found: ${r.params.taskId}`);if(Le(n.status))throw new P(R.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(r.params.taskId,s.sessionId);let o=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!o)throw new P(R.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(n){throw n instanceof P?n:new P(R.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,s,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:s,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let s=Date.now()-r.startTime;if(r.maxTotalTimeout&&s>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),P.fromError(R.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:s});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 s=this.transport?.onerror;this._transport.onerror=o=>{s?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{n?.(o,a),It(o)||ca(o)?this._onresponse(o):Os(o)?this._onrequest(o,a):ia(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(let s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();let r=P.fromError(R.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let s of e.values())s(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(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){let s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[De]?.taskId,a=n?.sessionId,i=this._taskStore,c=!0,u;if(o&&i&&this._taskMessageQueue&&a!==void 0&&(c=!1,u=(async()=>{if(!await i.getTask(o,a))throw new P(R.InvalidParams,`Task not found: ${o}`);c=!0})()),s===void 0){let p={jsonrpc:"2.0",id:e.id,error:{code:R.MethodNotFound,message:"Method not found"}};if(o&&u){let m={type:"error",message:p,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(o,m,a),()=>n?.send(p)).catch(y=>this._onerror(new Error(`Failed to send an error response: ${y}`)))}else o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):n?.send(p).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let d=na(e.params)?e.params.task:void 0,h=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,g={signal:l.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async p=>{if(l.signal.aborted)return;let m={relatedRequestId:e.id};o&&(m.relatedTask={taskId:o}),await this.notification(p,m)},sendRequest:async(p,m,y)=>{if(l.signal.aborted)throw new P(R.ConnectionClosed,"Request was cancelled");let _={...y,relatedRequestId:e.id};o&&!_.relatedTask&&(_.relatedTask={taskId:o});let b=_.relatedTask?.taskId??o;return b&&h&&await h.updateTaskStatus(b,"input_required"),await this.request(p,m,_)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:h,taskRequestedTtl:d?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&l.signal.aborted)throw new P(R.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,g)).then(async p=>{if(l.signal.aborted)return;let m={result:p,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:m,timestamp:Date.now()},n?.sessionId):await n?.send(m)},async p=>{if(l.signal.aborted)return;let m={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(p.code)?p.code:R.InternalError,message:p.message??"Internal error",...p.data!==void 0&&{data:p.data}}};o&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(o,{type:"error",message:m,timestamp:Date.now()},n?.sessionId):await n?.send(m)}).catch(p=>this._onerror(new Error(`Failed to send response: ${p}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===l&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...s}=e.params,n=Number(r),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&a&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),a(c);return}o(s)}_onresponse(e){let r=Number(e.id),s=this._requestResolvers.get(r);if(s){if(this._requestResolvers.delete(r),It(e))s(e);else{let a=new P(e.error.code,e.error.message,e.error.data);s(a)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(It(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let i=a.task;typeof i.taskId=="string"&&(o=!0,this._taskProgressTokens.set(i.taskId,r))}}if(o||this._progressHandlers.delete(r),It(e))n(e);else{let a=P.fromError(e.error.code,e.error.message,e.error.data);n(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,s){let{task:n}=s??{};if(!n){try{yield{type:"result",result:await this.request(e,r,s)}}catch(a){yield{type:"error",error:a instanceof P?a:new P(R.InternalError,String(a))}}return}let o;try{let a=await this.request(e,lt,s);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new P(R.InternalError,"Task creation did not return a task");for(;;){let i=await this.getTask({taskId:o},s);if(yield{type:"taskStatus",task:i},Le(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,s)}:i.status==="failed"?yield{type:"error",error:new P(R.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new P(R.InternalError,`Task ${o} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,s)};return}let c=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),s?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof P?a:new P(R.InternalError,String(a))}}}request(e,r,s){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:a,task:i,relatedTask:c}=s??{};return new Promise((u,l)=>{let d=b=>{l(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(b){d(b);return}s?.signal?.throwIfAborted();let h=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:h};s?.onprogress&&(this._progressHandlers.set(h,s.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:h}}),i&&(g.params={...g.params,task:i}),c&&(g.params={...g.params,_meta:{...g.params?._meta||{},[De]:c}});let p=b=>{this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(b)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let z=b instanceof P?b:new P(R.RequestTimeout,String(b));l(z)};this._responseHandlers.set(h,b=>{if(!s?.signal?.aborted){if(b instanceof Error)return l(b);try{let z=Fe(r,b.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),s?.signal?.addEventListener("abort",()=>{p(s?.signal?.reason)});let m=s?.timeout??md,y=()=>p(P.fromError(R.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(h,m,s?.maxTotalTimeout,y,s?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let b=z=>{let A=this._responseHandlers.get(h);A?A(z):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,b),this._enqueueTaskMessage(_,{type:"request",message:g,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(h),l(z)})}else this._transport.send(g,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:a}).catch(b=>{this._cleanupTimeout(h),l(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Pr,r)}async getTaskResult(e,r,s){return this.request({method:"tasks/result",params:e},r,s)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Tr,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},da,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let s=r?.relatedTask?.taskId;if(s){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[De]:r.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,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 i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[De]:r.relatedTask}}}),this._transport?.send(i,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[De]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let s=Gs(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(n,o)=>{let a=Js(e,n);return Promise.resolve(r(a,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let s=Gs(e);this._notificationHandlers.set(s,n=>{let o=Js(e,n);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,s){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,s??this._transport?.sessionId,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let s=await this._taskMessageQueue.dequeueAll(e,r);for(let n of s)if(n.type==="request"&&Os(n.message)){let o=n.message.id,a=this._requestResolvers.get(o);a?(a(new P(R.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r,s){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e,s);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,a)=>{if(r.aborted){a(new P(R.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),a(new P(R.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await s.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let o=await s.getTask(n,r);if(!o)throw new P(R.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,a)=>{await s.storeTaskResult(n,o,a,r);let i=await s.getTask(n,r);if(i){let c=Ct.parse({method:"notifications/tasks/status",params:i});await this.notification(c),Le(i.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>s.getTaskResult(n,r),updateTaskStatus:async(n,o,a)=>{let i=await s.getTask(n,r);if(!i)throw new P(R.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Le(i.status))throw new P(R.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(n,o,a,r);let c=await s.getTask(n,r);if(c){let u=Ct.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Le(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>s.listTasks(n,r)}}};function ya(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function _a(t,e){let r={...t};for(let s in e){let n=s,o=e[n];if(o===void 0)continue;let a=r[n];ya(a)&&ya(o)?r[n]={...a,...o}:r[n]=o}return r}var $l=Wo(Lo(),1),bl=Wo(vl(),1);function xy(){let t=new $l.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bl.default)(t),t}var $s=class{constructor(e){this._ajv=e??xy()}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 s=>r(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var bs=class{constructor(e){this._server=e}requestStream(e,r,s){return this._server.requestStream(e,r,s)}createMessageStream(e,r){let s=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!s?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],a=o.some(l=>l.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=i?Array.isArray(i.content)?i.content:[i.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(o.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(h=>h.type==="tool_use").map(h=>h.id)),d=new Set(o.filter(h=>h.type==="tool_result").map(h=>h.toolUseId));if(l.size!==d.size||![...l].every(h=>d.has(h)))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},Dt,r)}elicitInputStream(e,r){let s=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!s?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!s?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},dt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,s){return this._server.getTaskResult({taskId:e},r,s)}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 Sl(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 wl(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 zl=class extends jr{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Mt.options.map((s,n)=>[s,n])),this.isMessageIgnored=(s,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new $s,this.setRequestHandler(Sr,s=>this._oninitialize(s)),this.setNotificationHandler(Cs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Hs,async(s,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=s.params,i=Mt.safeParse(a);return i.success&&this._loggingLevels.set(o,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new bs(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_a(this._capabilities,e)}setRequestHandler(e,r){let n=Or(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let o=Nr(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(c,u)=>{let l=Fe(Us,c);if(!l.success){let p=l.error instanceof Error?l.error.message:String(l.error);throw new P(R.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:d}=l.data,h=await Promise.resolve(r(c,u));if(d.task){let p=Fe(lt,h);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new P(R.InvalidParams,`Invalid task creation result: ${m}`)}return p.data}let g=Fe(Ir,h);if(!g.success){let p=g.error instanceof Error?g.error.message:String(g.error);throw new P(R.InvalidParams,`Invalid tools/call result: ${p}`)}return g.data};return super.setRequestHandler(e,i)}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){wl(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Sl(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:ta.includes(r)?r:Is,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"},$r)}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 s=e.messages[e.messages.length-1],n=Array.isArray(s.content)?s.content:[s.content],o=n.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=a?Array.isArray(a.content)?a.content:[a.content]:[],c=i.some(u=>u.type==="tool_use");if(o){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(i.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},Zs,r):this.request({method:"sampling/createMessage",params:e},Dt,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},dt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},dt,r);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new P(R.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(a){throw a instanceof P?a:new P(R.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ks,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"})}};import Pl from"node:process";var Ty=10*1024*1024,Ss=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??Ty}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(`
11
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ry(r)}clear(){this._buffer=void 0}};function Ry(t){return la.parse(JSON.parse(t))}function kl(t){return JSON.stringify(t)+`
12
+ `}var El=class{constructor(e=Pl.stdin,r=Pl.stdout,s){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new Ss({maxBufferSize:s?.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 s=kl(e);this._stdout.write(s)?r():this._stdout.once("drain",r)})}};export{qy as a,ta as b,Os as c,It as d,ca as e,la as f,jy as g,bu as h,Us as i,zl as j,El as k};