@cosmic-chimps/speckit-atlas 0.0.0-stage → 0.1.2

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 (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -2
  3. package/cli.js +36 -0
  4. package/mcp.js +75 -0
  5. package/package.json +30 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpecKit Atlas contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,53 @@
1
- # Temporary Holding Version
1
+ # @cosmic-chimps/speckit-atlas
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Headless queries over the relationship graph of a [GitHub Spec Kit](https://github.com/github/spec-kit)
4
+ repository (dependencies, cross-references, shared entities, implementation status), for AI agents
5
+ and CI. Ships two commands: a CLI (`speckit-atlas`) and a local MCP server (`speckit-atlas-mcp`).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i -g @cosmic-chimps/speckit-atlas
11
+ ```
12
+
13
+ Requires Node 18 or newer. No runtime dependencies.
14
+
15
+ ## CLI
16
+
17
+ ```bash
18
+ speckit-atlas graph --root . # the whole graph (JSON envelope)
19
+ speckit-atlas spec 001-foo --root . # a spec's dependsOn / dependedOnBy
20
+ speckit-atlas specs-for-file src/foo.ts # which specs reference a source file
21
+ speckit-atlas status --root . --format text # implementation-status summary
22
+ speckit-atlas orphans --root . # isolated specs
23
+ speckit-atlas check --rule no-orphans # exit 1 if any spec is orphaned (CI gate)
24
+ ```
25
+
26
+ - `--root <dir>` is the workspace root (default: current directory); `--project <id>` scopes to one project.
27
+ - Output is JSON by default; `--format text` gives a human-readable form.
28
+ - `--bare-numbers` is **opt-in**: it adds the risky tier that links specs mentioning a bare feature number.
29
+
30
+ ## MCP server
31
+
32
+ Claude Code:
33
+
34
+ ```bash
35
+ claude mcp add -s user speckit-atlas -- speckit-atlas-mcp --root .
36
+ ```
37
+
38
+ Without a global install, pinned to this version:
39
+
40
+ ```bash
41
+ npx -y -p @cosmic-chimps/speckit-atlas@0.1.2 speckit-atlas-mcp --root .
42
+ ```
43
+
44
+ Tools: `atlas_graph`, `atlas_spec_relationships`, `atlas_specs_for_file`, `atlas_status_summary`,
45
+ `atlas_orphans`, `atlas_check`.
46
+
47
+ ## Guarantees
48
+
49
+ Read-only (never writes to your repository), offline (no network), and no telemetry.
50
+
51
+ ## License
52
+
53
+ MIT
package/cli.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var ue=Object.create;var $=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ge=(e,r)=>{for(var t in r)$(e,t,{get:r[t],enumerable:!0})},Z=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of de(r))!me.call(e,n)&&n!==t&&$(e,n,{get:()=>r[n],enumerable:!(s=le(r,n))||s.enumerable});return e};var X=(e,r,t)=>(t=e!=null?ue(fe(e)):{},Z(r||!e||!e.__esModule?$(t,"default",{value:e,enumerable:!0}):t,e)),he=e=>Z($({},"__esModule",{value:!0}),e);var Be={};ge(Be,{run:()=>pe});module.exports=he(Be);var ce=require("node:util");function R(e){return(e??"").trim().replace(/\\/g,"/").replace(/^(?:\.\.?\/)+/,"")}var ye=/\]\((\.{1,2}\/[^)\s]*)\)/g,ke=/(?<![\w:.\-/])([0-9]{3})(?![\w-])/g;function Se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var J="ts|tsx|js|jsx|mjs|cjs|cs|py|go",be=new RegExp(`\\]\\(((?:\\.{1,2}/)+[^)\\s]*\\.(?:${J}))\\)`,"g"),Re=/`([^`\r\n]+)`/g,je=new RegExp(`^\\.{0,2}/?(?:[^\\s/]+/)+[^\\s/]+\\.(?:${J})$`);function we(e){return R(e)}var xe=/^#{2,4}\s+([A-Z][A-Za-z0-9]+)\b[^\n]*\(([^)]*(?:\.[a-z]{2,4}|:\d+|db\.types)[^)]*)\)/gm;function Ee(e){return e.trim().slice(0,100)}function Q(e){let r=new Map;for(let t of e.matchAll(ye)){let s=t[0];for(let n of t[1].split("/")){if(!n||n==="."||n==="..")continue;let o=r.get(n);r.set(n,{kind:"link",targetHint:n,evidence:o?.evidence??s,count:(o?.count??0)+1})}}return[...r.values()]}function L(e,r,t){let s=[...new Set(r)].filter(c=>c&&c!==t);if(s.length===0||!e)return[];s.sort((c,i)=>i.length-c.length);let n=s.map(Se).join("|"),o=new RegExp(`(?<![A-Za-z0-9-])(?:${n})(?![A-Za-z0-9-])`,"g"),a=new Map;for(let c of e.matchAll(o))a.set(c[0],(a.get(c[0])??0)+1);return[...a.entries()].map(([c,i])=>({id:c,count:i}))}function D(e){let r=new Map,t=new Map;for(let s of e.split(/\r?\n/))if(!/\bT\d{3}\b/.test(s))for(let n of s.matchAll(ke)){let o=n[1];t.set(o,(t.get(o)??0)+1),r.has(o)||r.set(o,Ee(s))}return[...t.entries()].map(([s,n])=>({kind:"number",targetHint:s,evidence:r.get(s)??s,count:n}))}function H(e){let r=new Map;for(let t of e.matchAll(xe)){let s=t[1];r.has(s)||r.set(s,{kind:"entity",targetHint:s,evidence:t[0].trim().slice(0,100),count:1})}return[...r.values()]}function q(e){let r=new Map,t=s=>{let n=we(s);if(!n)return;let o=r.get(n);r.set(n,{kind:"code",targetHint:n,evidence:n,count:(o?.count??0)+1})};for(let s of e.matchAll(be))t(s[1]);for(let s of e.matchAll(Re)){let n=s[1].trim();je.test(n)&&t(n)}return[...r.values()]}function G(e){let r=typeof e?.id=="string"?e.id:"",t=typeof e?.number=="string"?e.number:null,s=[],n=e&&typeof e.files=="object"&&e.files?e.files:{},o=Array.isArray(e?.artifacts)?e.artifacts.filter(u=>typeof u=="string"):[],a=Ge(o),c=r,i=null,p=null,d=[],h="";try{let u=z(n,"spec.md"),l=z(n,"tasks.md"),f=z(n,"data-model.md"),y=Object.values(n).join(`
3
+ `);h=y,c=Ie(u)??r,i=Ce(u),p=Fe(l),d=[...Q(y),...D(y),...q(y),...f?H(f):[]]}catch{s.push({code:"parse-error",message:`Could not fully parse feature "${r}"; using partial data.`,featureId:r})}return{id:r,number:t,title:c,status:i,taskCompletion:p,completeness:a,references:d,warnings:s,mentionText:h}}var $e={spec:["spec"],plan:["plan"],tasks:["tasks"],research:["research"],dataModel:["data-model","datamodel","dataModel"],quickstart:["quickstart"],contracts:["contracts"],checklists:["checklists"]};function Ge(e){let r=new Set(e.map(s=>s.toLowerCase().replace(/\.md$/,""))),t=s=>$e[s].some(n=>r.has(n.toLowerCase()));return{spec:t("spec"),plan:t("plan"),tasks:t("tasks"),research:t("research"),dataModel:t("dataModel"),quickstart:t("quickstart"),contracts:t("contracts"),checklists:t("checklists")}}function z(e,r){if(typeof e[r]=="string")return e[r];for(let[t,s]of Object.entries(e))if(t.replace(/\\/g,"/").split("/").pop()===r&&typeof s=="string")return s;return""}function Ie(e){let r=e.match(/^#\s+(?:Feature Specification:\s*)?(.+?)\s*$/m);return r?r[1].trim():null}function Ce(e){let r=e.match(/^\s*\*\*Status\*\*:\s*(.+?)\s*$/m);return r?r[1].trim():null}function Fe(e){if(!e)return null;let r=(e.match(/^\s*-\s*\[[xX]\]/gm)??[]).length,t=(e.match(/^\s*-\s*\[ \]/gm)??[]).length,s=r+t;return s===0?null:{done:r,total:s}}var U={links:!0,slugMentions:!0,sharedEntities:!0,bareNumbers:!0,specToCode:!0};function B(e){return{...U,...e??{},links:!0}}var ee={definitive:4,strong:3,medium:2,risky:1};function C(e,r,t,s){let n=B(s),o=Array.isArray(t)?t.filter(u=>!!u):[],a=[],c=o.map(u=>Me(e,u,n)),i=new Set(o.map(u=>u.id)),p=Oe(o,a),d=new Map,h=new Map;for(let u of o)try{for(let l of u.references??[])switch(l.kind){case"link":We(l.targetHint,i,u.id)&&I(d,u.id,l.targetHint,"link","definitive",1,l.evidence);break;case"slug":break;case"number":if(n.bareNumbers){let f=p.get(l.targetHint);f&&f!==u.id&&I(d,u.id,f,"bare-number","risky",l.count,l.evidence)}break;case"entity":if(n.sharedEntities){let f=h.get(l.targetHint)??new Set;f.add(u.id),h.set(l.targetHint,f)}break;case"code":break}}catch{a.push({code:"assemble-error",message:`Skipped some edges for "${u.id}".`,featureId:u.id})}if(n.slugMentions)for(let u of o)try{for(let{id:l,count:f}of L(u.mentionText,i,u.id))I(d,u.id,l,"slug-mention","strong",f,l)}catch{a.push({code:"assemble-error",message:`Skipped some mention edges for "${u.id}".`,featureId:u.id})}if(n.sharedEntities)for(let[u,l]of h){if(l.size<2)continue;let f=[...l].sort();for(let y=0;y<f.length;y++)for(let K=y+1;K<f.length;K++)I(d,f[y],f[K],"shared-entity","medium",1,u,!0)}for(let u of o)for(let l of u.warnings??[])a.push(l);return{projectId:e,name:r,nodes:c,edges:[...d.values()].map(Pe),warnings:a}}function We(e,r,t){return r.has(e)&&e!==t}function Oe(e,r){let t=new Map;for(let n of e)if(n.number){let o=t.get(n.number)??[];o.push(n.id),t.set(n.number,o)}let s=new Map;for(let[n,o]of t)o.length===1?s.set(n,o[0]):r.push({code:"ambiguous-number",message:`Feature number ${n} maps to multiple features (${o.join(", ")}); no edge inferred.`,featureIds:[...o].sort((a,c)=>a.localeCompare(c))});return s}function I(e,r,t,s,n,o,a,c=!1){if(r===t)return;let i=`${r}\0${t}`,p=e.get(i);if(!p){e.set(i,{source:r,target:t,heuristic:s,tier:n,weight:o,evidence:[a],symmetric:c});return}p.evidence.includes(a)||p.evidence.push(a),ee[n]>ee[p.tier]?(p.tier=n,p.heuristic=s,p.weight=o,p.symmetric=c):n===p.tier&&(p.weight=Math.max(p.weight,o),p.symmetric=p.symmetric&&c)}function Pe(e){let r={source:e.source,target:e.target,heuristic:e.heuristic,tier:e.tier,weight:e.weight,evidence:e.evidence};return e.symmetric?{...r,symmetric:!0}:r}function Me(e,r,t){let s={id:r.id,projectId:e,title:r.title,status:r.status,taskCompletion:r.taskCompletion,completeness:r.completeness,warnings:r.warnings??[]};if(!t.specToCode)return s;let n=[...new Set((r.references??[]).filter(o=>o.kind==="code").map(o=>o.targetHint))];return{...s,codeReferences:n}}function F(e,r){return{projects:(Array.isArray(e)?e:[]).filter(n=>!!n).map(n=>{let o=(n.features??[]).map(a=>G(a));return C(n.projectId,n.name,o,r)})}}function V(e){return[...e].sort((r,t)=>r.id.localeCompare(t.id))}function W(e){return[...e].sort((r,t)=>r.source.localeCompare(t.source)||r.target.localeCompare(t.target)||r.heuristic.localeCompare(t.heuristic))}function O(e){return{...e,nodes:V(e.nodes),edges:W(e.edges)}}function Y(e){return{projects:[...e.projects].map(O).sort((t,s)=>t.projectId.localeCompare(s.projectId))}}function m(e,r,t){return{schemaVersion:1,kind:e,data:r,warnings:[...t]}}function j(e,r){let t=new Set(r);return e.filter(s=>{let n=s.featureId!==void 0,o=s.featureIds!==void 0;return!n&&!o?!0:n&&t.has(s.featureId)||(s.featureIds??[]).some(a=>t.has(a))})}var Ae=/^(in)[\s-]+(progress|review)\b|^(on)[\s-]+(hold)\b|^(not)[\s-]+(started)\b/i;function te(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function P(e){if(e===null)return"(none)";let r=e.trim().replace(/^[*_`\s]+/,"");if(r==="")return"(none)";let t=Ae.exec(r);if(t)return t.slice(1).filter(o=>o!==void 0).map(te).join(" ");let s=/^[^\s(—–\-,;:.*_`]+/.exec(r);return s?te(s[0]):"(none)"}function M(e,r){let t=e?.projects??[],s=r?.projectId??null;return s?t.filter(n=>n.projectId===s):[...t]}function w(e,r){let t=r?.projectId??null;if(t){let s=(e?.projects??[]).find(n=>n.projectId===t);return s?O(s):{projectId:t,name:t,nodes:[],edges:[],warnings:[]}}return Y(e??{projects:[]})}function A(e,r,t){let s=M(e,t),n=null,o=[],a=[];for(let c of s){let i=c.nodes.find(p=>p.id===r);if(i){n=i;for(let p of c.edges)p.source===r&&o.push(p),p.target===r&&a.push(p)}}return{spec:n,found:n!==null,dependsOn:W(o),dependedOnBy:W(a)}}function N(e,r,t){let s=R(r);if(s==="")return{path:"",matches:[]};let n=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",o=n===""?null:n+"/",a=[],c=[];for(let p of M(e,t))for(let d of p.nodes){let h=d.codeReferences??[];h.includes(s)?a.push(re(d,"exact")):o&&h.some(u=>u.startsWith(o))&&c.push(re(d,"folder"))}let i=(a.length>0?a:c).sort(Ne);return{path:s,matches:i}}function re(e,r){return{specId:e.id,projectId:e.projectId,title:e.title,status:e.status,matchKind:r}}var se={exact:0,folder:1};function Ne(e,r){return se[e.matchKind]-se[r.matchKind]||e.projectId.localeCompare(r.projectId)||e.specId.localeCompare(r.specId)}function v(e,r){let t=V(M(e,r).flatMap(i=>i.nodes)),s=new Map,n=0,o=0,a=t.map(i=>{let p=P(i.status);return s.set(p,(s.get(p)??0)+1),i.taskCompletion&&(n+=i.taskCompletion.done,o+=i.taskCompletion.total),{id:i.id,projectId:i.projectId,status:i.status,done:i.taskCompletion?.done??null,total:i.taskCompletion?.total??null}}),c={};for(let i of[...s.keys()].sort((p,d)=>p.localeCompare(d)))c[i]=s.get(i)??0;return{perSpec:a,aggregate:{specs:t.length,byStatus:c,tasksDone:n,tasksTotal:o}}}function x(e,r){let t=[];for(let s of M(e,r)){let n=new Set;for(let o of s.edges)n.add(o.source),n.add(o.target);for(let o of s.nodes)n.has(o.id)||t.push(o.id)}return{orphans:[...t].sort((s,n)=>s.localeCompare(n))}}var S=["no-orphans"];function T(e,r,t){if(r==="no-orphans"){let s=x(e,t).orphans;return{rule:r,ok:s.length===0,violations:s}}return{rule:r,ok:!1,violations:[],error:E(r)}}function E(e){return`Unknown rule "${e}". Known rules: ${S.join(", ")}`}function _(e){let r=[];switch(e.kind){case"graph":{let t=ve(e.data)?e.data.projects:[e.data];for(let s of t){r.push(`# ${s.name} (${s.nodes.length} specs, ${s.edges.length} edges)`);for(let n of s.nodes)r.push(` ${n.id} [${n.status??"\u2014"}]`);for(let n of s.edges){let o=n.symmetric?"\u2014":"\u2192";r.push(` ${n.source} ${o} ${n.target} (${n.heuristic}, ${n.tier}, w${n.weight})`)}}break}case"spec":{let t=e.data;if(!t.found){r.push("spec not found");break}r.push(`# ${t.spec?.id} [${t.spec?.status??"\u2014"}]`),r.push(`depends on (${t.dependsOn.length}):`);for(let s of t.dependsOn)r.push(` \u2192 ${s.target} (${s.heuristic}, ${s.tier})`);r.push(`depended on by (${t.dependedOnBy.length}):`);for(let s of t.dependedOnBy)r.push(` \u2190 ${s.source} (${s.heuristic}, ${s.tier})`);break}case"status":{let t=e.data;r.push(`# ${t.aggregate.specs} specs \u2014 tasks ${t.aggregate.tasksDone}/${t.aggregate.tasksTotal}`);for(let[s,n]of Object.entries(t.aggregate.byStatus))r.push(` ${s}: ${n}`);for(let s of t.perSpec){let n=s.total?`${s.done}/${s.total}`:"\u2014";r.push(` ${s.id} [${s.status??"\u2014"}] ${n}`)}break}case"orphans":{let t=e.data;r.push(`# ${t.orphans.length} orphaned spec(s)`);for(let s of t.orphans)r.push(` ${s}`);break}case"file":{let t=e.data,s=t.matches.length===0?"":` ${t.matches[0].matchKind}`;r.push(`# specs for ${t.path} (${t.matches.length}${s})`);for(let n of t.matches)r.push(` ${n.specId} [${n.status??"\u2014"}] (${n.matchKind})`);break}case"check":{let t=e.data;r.push(`check "${t.rule}": ${t.ok?"PASS":"FAIL"}`),t.error&&r.push(` error: ${t.error}`);for(let s of t.violations)r.push(` violation: ${s}`);break}}for(let t of e.warnings){let s=t.featureId??(t.featureIds?.length?t.featureIds.join(", "):"");r.push(`! warning [${t.code}]${s?` (${s})`:""}: ${t.message}`)}return r.join(`
4
+ `)}function ve(e){return typeof e=="object"&&e!==null&&Array.isArray(e.projects)}var k=X(require("node:fs")),g=X(require("node:path")),ne=require("node:url"),_e=["spec.md","plan.md","tasks.md","data-model.md","research.md","quickstart.md"],Ke=["spec","plan","tasks","research","data-model","quickstart"],Qe=["contracts","checklists"];function oe(e){let r=[],t=g.resolve(e),s=o=>{let a=Le(g.join(o,"specs"));a.length>0&&r.push({projectId:(0,ne.pathToFileURL)(o).toString(),name:g.basename(o),features:a})};s(t);for(let o of ae(t))o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules"&&s(g.join(t,o.name));let n=new Set;return r.filter(o=>n.has(o.projectId)?!1:(n.add(o.projectId),!0))}function Le(e){let r=[];for(let t of ae(e))t.isDirectory()&&r.push(De(g.join(e,t.name),t.name));return r}function De(e,r){let t=r.match(/^(\d{3})-/),s=t?t[1]:null,n=[];for(let a of Ke)He(g.join(e,`${a}.md`))&&n.push(a);for(let a of Qe)qe(g.join(e,a))&&n.push(a);let o={};for(let a of _e){let c=ze(g.join(e,a));c!==null&&(o[a]=c)}return{id:r,number:s,artifacts:n,files:o}}function ae(e){try{return k.readdirSync(e,{withFileTypes:!0})}catch{return[]}}function He(e){try{return k.statSync(e).isFile()}catch{return!1}}function qe(e){try{return k.statSync(e).isDirectory()}catch{return!1}}function ze(e){try{return k.readFileSync(e,"utf8")}catch{return null}}function ie(e){let r=oe(e.root),t=F(r,{bareNumbers:!1,...e.options}),s={projectId:e.projectId??null},n=t.projects.flatMap(o=>[...o.warnings]);switch(e.kind){case"graph":return m("graph",w(t,s),n);case"spec":{let o=e.specId??"";return m("spec",A(t,o,s),j(n,[o]))}case"file":{let o=N(t,e.path??"",s);return m("file",o,j(n,o.matches.map(a=>a.specId)))}case"status":return m("status",v(t,s),n);case"orphans":return m("orphans",x(t,s),n);case"check":return m("check",T(t,e.rule??"no-orphans",s),n);default:return m("graph",w(t,s),n)}}var Ue=S.join(", "),b=`speckit-atlas <command> [options]
5
+
6
+ commands:
7
+ graph the whole graph (all projects, or --project)
8
+ spec <spec-id> a spec's dependsOn / dependedOnBy
9
+ specs-for-file <path> which spec(s) reference a source file (reverse traceability)
10
+ status implementation-status / completeness summary
11
+ orphans isolated specs
12
+ check [--rule no-orphans] evaluate a rule; exit 1 on failure, exit 2 on an unknown rule
13
+
14
+ options:
15
+ --root <dir> workspace root (default: cwd)
16
+ --project <id> scope to one project
17
+ --format json|text output format (default: json)
18
+ --rule <name> check rule (default: no-orphans; known rules: ${Ue})
19
+ heuristics, on by default (turn off): --no-slug-mentions --no-shared-entities --no-spec-to-code
20
+ heuristics, off by default (opt in): --bare-numbers
21
+ --bare-numbers is the risky tier that links specs mentioning a bare feature number.
22
+ --no-spec-to-code drops the spec -> code layer, so specs-for-file finds no matches.
23
+ --slug-mentions, --shared-entities and --spec-to-code are accepted for compatibility
24
+ (they are already on).
25
+ `;function pe(e){let r;try{r=(0,ce.parseArgs)({args:[...e],allowPositionals:!0,options:{root:{type:"string"},project:{type:"string"},format:{type:"string",default:"json"},rule:{type:"string",default:"no-orphans"},"slug-mentions":{type:"boolean"},"no-slug-mentions":{type:"boolean"},"shared-entities":{type:"boolean"},"no-shared-entities":{type:"boolean"},"bare-numbers":{type:"boolean"},"spec-to-code":{type:"boolean"},"no-spec-to-code":{type:"boolean"},help:{type:"boolean",short:"h"}}})}catch(d){return process.stderr.write(`${d.message}
26
+
27
+ ${b}`),2}let{values:t,positionals:s}=r;if(t.help||s.length===0)return process.stdout.write(b),t.help?0:2;let n=s[0],a={graph:"graph",spec:"spec","specs-for-file":"file",status:"status",orphans:"orphans",check:"check"}[n];if(!a)return process.stderr.write(`Unknown command "${n}"
28
+
29
+ ${b}`),2;if(a==="spec"&&!s[1])return process.stderr.write(`"spec" requires a <spec-id>
30
+
31
+ ${b}`),2;if(a==="file"&&!s[1])return process.stderr.write(`"specs-for-file" requires a <path>
32
+
33
+ ${b}`),2;if(a==="check"&&!S.includes(t.rule??""))return process.stderr.write(`${E(t.rule??"")}
34
+
35
+ ${b}`),2;let c={...t["no-slug-mentions"]?{slugMentions:!1}:{},...t["slug-mentions"]?{slugMentions:!0}:{},...t["no-shared-entities"]?{sharedEntities:!1}:{},...t["shared-entities"]?{sharedEntities:!0}:{},...t["bare-numbers"]?{bareNumbers:!0}:{},...t["spec-to-code"]?{specToCode:!0}:{},...t["no-spec-to-code"]?{specToCode:!1}:{}},i=ie({root:t.root??process.cwd(),kind:a,specId:s[1],path:s[1],rule:t.rule,projectId:t.project??null,options:c}),p=t.format==="text"?_(i):JSON.stringify(i,null,2);return process.stdout.write(p+`
36
+ `),i.kind==="check"&&i.data&&i.data.ok===!1?1:0}process.exitCode=pe(process.argv.slice(2));0&&(module.exports={run});
package/mcp.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var Kh=Object.create;var os=Object.defineProperty;var Hh=Object.getOwnPropertyDescriptor;var Wh=Object.getOwnPropertyNames;var Bh=Object.getPrototypeOf,Qh=Object.prototype.hasOwnProperty;var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wc=(e,t)=>{for(var r in t)os(e,r,{get:t[r],enumerable:!0})},Yh=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Wh(t))!Qh.call(e,n)&&n!==r&&os(e,n,{get:()=>t[n],enumerable:!(o=Hh(t,n))||o.enumerable});return e};var dr=(e,t,r)=>(r=e!=null?Kh(Bh(e)):{},Yh(t||!e||!e.__esModule?os(r,"default",{value:e,enumerable:!0}):r,e));var Fr=$(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Dr=class{};L._CodeOrName=Dr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var bt=class extends Dr{constructor(t){if(super(),!L.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=bt;var Oe=class extends Dr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof bt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Oe;L.nil=new Oe("");function Md(e,...t){let r=[e[0]],o=0;for(;o<t.length;)gi(r,t[o]),r.push(e[++o]);return new Oe(r)}L._=Md;var hi=new Oe("+");function qd(e,...t){let r=[Lr(e[0])],o=0;for(;o<t.length;)r.push(hi),gi(r,t[o]),r.push(hi,Lr(e[++o]));return $v(r),new Oe(r)}L.str=qd;function gi(e,t){t instanceof Oe?e.push(...t._items):t instanceof bt?e.push(t):e.push(zv(t))}L.addCodeArg=gi;function $v(e){let t=1;for(;t<e.length-1;){if(e[t]===hi){let r=bv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof bt||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof bt))return`"${e}${t.slice(1)}`}function wv(e,t){return t.emptyStr()?e:e.emptyStr()?t:qd`${e}${t}`}L.strConcat=wv;function zv(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Lr(Array.isArray(e)?e.join(","):e)}function xv(e){return new Oe(Lr(e))}L.stringify=xv;function Lr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Lr;function Sv(e){return typeof e=="string"&&L.IDENTIFIER.test(e)?new Oe(`.${e}`):Md`[${e}]`}L.getProperty=Sv;function kv(e){if(typeof e=="string"&&L.IDENTIFIER.test(e))return new Oe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}L.getEsmExportName=kv;function Pv(e){return new Oe(e.toString())}L.regexpCode=Pv});var vi=$(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.ValueScope=be.ValueScopeName=be.Scope=be.varKinds=be.UsedValueState=void 0;var $e=Fr(),_i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},on;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(on||(be.UsedValueState=on={}));be.varKinds={const:new $e.Name("const"),let:new $e.Name("let"),var:new $e.Name("var")};var nn=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof $e.Name?t:this.name(t)}name(t){return new $e.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};be.Scope=nn;var sn=class extends $e.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,$e._)`.${new $e.Name(r)}[${o}]`}};be.ValueScopeName=sn;var Ev=(0,$e._)`\n`,yi=class extends nn{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Ev:$e.nil}}get(){return this._scope}name(t){return new sn(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,$e._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=$e.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,on.Started);let l=r(u);if(l){let p=this.opts.es5?be.varKinds.var:be.varKinds.const;s=(0,$e._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,$e._)`${s}${l}${this.opts._n}`;else throw new _i(u);c.set(u,on.Completed)})}return s}};be.ValueScope=yi});var O=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.or=j.and=j.not=j.CodeGen=j.operators=j.varKinds=j.ValueScopeName=j.ValueScope=j.Scope=j.Name=j.regexpCode=j.stringify=j.getProperty=j.nil=j.strConcat=j.str=j._=void 0;var Z=Fr(),Ze=vi(),pt=Fr();Object.defineProperty(j,"_",{enumerable:!0,get:function(){return pt._}});Object.defineProperty(j,"str",{enumerable:!0,get:function(){return pt.str}});Object.defineProperty(j,"strConcat",{enumerable:!0,get:function(){return pt.strConcat}});Object.defineProperty(j,"nil",{enumerable:!0,get:function(){return pt.nil}});Object.defineProperty(j,"getProperty",{enumerable:!0,get:function(){return pt.getProperty}});Object.defineProperty(j,"stringify",{enumerable:!0,get:function(){return pt.stringify}});Object.defineProperty(j,"regexpCode",{enumerable:!0,get:function(){return pt.regexpCode}});Object.defineProperty(j,"Name",{enumerable:!0,get:function(){return pt.Name}});var ln=vi();Object.defineProperty(j,"Scope",{enumerable:!0,get:function(){return ln.Scope}});Object.defineProperty(j,"ValueScope",{enumerable:!0,get:function(){return ln.ValueScope}});Object.defineProperty(j,"ValueScopeName",{enumerable:!0,get:function(){return ln.ValueScopeName}});Object.defineProperty(j,"varKinds",{enumerable:!0,get:function(){return ln.varKinds}});j.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var et=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},$i=class extends et{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Ze.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Jt(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},an=class extends et{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Jt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return un(t,this.rhs)}},bi=class extends an{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},wi=class extends et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},zi=class extends et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xi=class extends et{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Si=class extends et{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Jt(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Ur=class extends et{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(Tv(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>xt(t,r.names),{})}},tt=class extends Ur{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},ki=class extends Ur{},Vt=class extends tt{};Vt.kind="else";var wt=class e extends tt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Vt(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Dd(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Jt(this.condition,t,r),this}get names(){let t=super.names;return un(t,this.condition),this.else&&xt(t,this.else.names),t}};wt.kind="if";var zt=class extends tt{};zt.kind="for";var Pi=class extends zt{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Jt(this.iteration,t,r),this}get names(){return xt(super.names,this.iteration.names)}},Ei=class extends zt{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Ze.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=un(super.names,this.from);return un(t,this.to)}},cn=class extends zt{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Jt(this.iterable,t,r),this}get names(){return xt(super.names,this.iterable.names)}},Vr=class extends tt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Vr.kind="func";var Jr=class extends Ur{render(t){return"return "+super.render(t)}};Jr.kind="return";var Ti=class extends tt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&xt(t,this.catch.names),this.finally&&xt(t,this.finally.names),t}},Gr=class extends tt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Gr.kind="catch";var Kr=class extends tt{render(t){return"finally"+super.render(t)}};Kr.kind="finally";var Ri=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new Ze.Scope({parent:t}),this._nodes=[new ki]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new $i(t,s,o)),s}const(t,r,o){return this._def(Ze.varKinds.const,t,r,o)}let(t,r,o){return this._def(Ze.varKinds.let,t,r,o)}var(t,r,o){return this._def(Ze.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new an(t,r,o))}add(t,r){return this._leafNode(new bi(t,j.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Si(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(t,r,o){if(this._blockNode(new wt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new wt(t))}else(){return this._elseNode(new Vt)}endIf(){return this._endBlockNode(wt,Vt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Pi(t),r)}forRange(t,r,o,n,s=this.opts.es5?Ze.varKinds.var:Ze.varKinds.let){let i=this._scope.toName(t);return this._for(new Ei(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Ze.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new cn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new cn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(zt)}label(t){return this._leafNode(new wi(t))}break(t){return this._leafNode(new zi(t))}return(t){let r=new Jr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Ti;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Gr(s),r(s)}return o&&(this._currNode=n.finally=new Kr,this.code(o)),this._endBlockNode(Gr,Kr)}throw(t){return this._leafNode(new xi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,o,n){return this._blockNode(new Vr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Vr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof wt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};j.CodeGen=Ri;function xt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function un(e,t){return t instanceof Z._CodeOrName?xt(e,t.names):e}function Jt(e,t,r){if(e instanceof Z.Name)return o(e);if(!n(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Tv(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Dd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${Ii(e)}`}j.not=Dd;var Rv=Ld(j.operators.AND);function Iv(...e){return e.reduce(Rv)}j.and=Iv;var Ov=Ld(j.operators.OR);function jv(...e){return e.reduce(Ov)}j.or=jv;function Ld(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${Ii(t)} ${e} ${Ii(r)}`}function Ii(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var q=$(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.checkStrictMode=N.getErrorPath=N.Type=N.useFunc=N.setEvaluated=N.evaluatedPropsToName=N.mergeEvaluated=N.eachItem=N.unescapeJsonPointer=N.escapeJsonPointer=N.escapeFragment=N.unescapeFragment=N.schemaRefOrVal=N.schemaHasRulesButRef=N.schemaHasRules=N.checkUnknownRules=N.alwaysValidSchema=N.toHash=void 0;var J=O(),Nv=Fr();function Av(e){let t={};for(let r of e)t[r]=!0;return t}N.toHash=Av;function Cv(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Vd(e,t),!Jd(t,e.self.RULES.all))}N.alwaysValidSchema=Cv;function Vd(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||Hd(e,`unknown keyword: "${s}"`)}N.checkUnknownRules=Vd;function Jd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}N.schemaHasRules=Jd;function Zv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}N.schemaHasRulesButRef=Zv;function Mv({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${e}${t}${(0,J.getProperty)(o)}`}N.schemaRefOrVal=Mv;function qv(e){return Gd(decodeURIComponent(e))}N.unescapeFragment=qv;function Dv(e){return encodeURIComponent(ji(e))}N.escapeFragment=Dv;function ji(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}N.escapeJsonPointer=ji;function Gd(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}N.unescapeJsonPointer=Gd;function Lv(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}N.eachItem=Lv;function Fd({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?e(n,s,i):t(n,s,i),i):s instanceof J.Name?(t(n,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?o(n,c):c}}N.mergeEvaluated={props:Fd({mergeNames:(e,t,r)=>e.if((0,J._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,J._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,J._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,J._)`${r} || {}`),Ni(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Kd}),items:Fd({mergeNames:(e,t,r)=>e.if((0,J._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,J._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,J._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,J._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Kd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,J._)`{}`);return t!==void 0&&Ni(e,r,t),r}N.evaluatedPropsToName=Kd;function Ni(e,t,r){Object.keys(r).forEach(o=>e.assign((0,J._)`${t}${(0,J.getProperty)(o)}`,!0))}N.setEvaluated=Ni;var Ud={};function Fv(e,t){return e.scopeValue("func",{ref:t,code:Ud[t.code]||(Ud[t.code]=new Nv._Code(t.code))})}N.useFunc=Fv;var Oi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Oi||(N.Type=Oi={}));function Uv(e,t,r){if(e instanceof J.Name){let o=t===Oi.Num;return r?o?(0,J._)`"[" + ${e} + "]"`:(0,J._)`"['" + ${e} + "']"`:o?(0,J._)`"/" + ${e}`:(0,J._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(e).toString():"/"+ji(e)}N.getErrorPath=Uv;function Hd(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}N.checkStrictMode=Hd});var rt=$(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var de=O(),Vv={data:new de.Name("data"),valCxt:new de.Name("valCxt"),instancePath:new de.Name("instancePath"),parentData:new de.Name("parentData"),parentDataProperty:new de.Name("parentDataProperty"),rootData:new de.Name("rootData"),dynamicAnchors:new de.Name("dynamicAnchors"),vErrors:new de.Name("vErrors"),errors:new de.Name("errors"),this:new de.Name("this"),self:new de.Name("self"),scope:new de.Name("scope"),json:new de.Name("json"),jsonPos:new de.Name("jsonPos"),jsonLen:new de.Name("jsonLen"),jsonPart:new de.Name("jsonPart")};Ai.default=Vv});var Hr=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.extendErrors=fe.resetErrorsCount=fe.reportExtraError=fe.reportError=fe.keyword$DataError=fe.keywordError=void 0;var D=O(),pn=q(),_e=rt();fe.keywordError={message:({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`};fe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,D.str)`"${e}" keyword must be ${t} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`};function Jv(e,t=fe.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=Qd(e,t,r);o??(i||a)?Wd(s,c):Bd(n,(0,D._)`[${c}]`)}fe.reportError=Jv;function Gv(e,t=fe.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Qd(e,t,r);Wd(n,a),s||i||Bd(o,_e.default.vErrors)}fe.reportExtraError=Gv;function Kv(e,t){e.assign(_e.default.errors,t),e.if((0,D._)`${_e.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,D._)`${_e.default.vErrors}.length`,t),()=>e.assign(_e.default.vErrors,null)))}fe.resetErrorsCount=Kv;function Hv({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,_e.default.errors,a=>{e.const(i,(0,D._)`${_e.default.vErrors}[${a}]`),e.if((0,D._)`${i}.instancePath === undefined`,()=>e.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(_e.default.instancePath,s.errorPath))),e.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,D._)`${i}.schema`,r),e.assign((0,D._)`${i}.data`,o))})}fe.extendErrors=Hv;function Wd(e,t){let r=e.const("err",t);e.if((0,D._)`${_e.default.vErrors} === null`,()=>e.assign(_e.default.vErrors,(0,D._)`[${r}]`),(0,D._)`${_e.default.vErrors}.push(${r})`),e.code((0,D._)`${_e.default.errors}++`)}function Bd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,D._)`new ${e.ValidationError}(${t})`):(r.assign((0,D._)`${o}.errors`,t),r.return(!1))}var St={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function Qd(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,D._)`{}`:Wv(e,t,r)}function Wv(e,t,r={}){let{gen:o,it:n}=e,s=[Bv(n,r),Qv(e,r)];return Yv(e,t,s),o.object(...s)}function Bv({errorPath:e},{instancePath:t}){let r=t?(0,D.str)`${e}${(0,pn.getErrorPath)(t,pn.Type.Str)}`:e;return[_e.default.instancePath,(0,D.strConcat)(_e.default.instancePath,r)]}function Qv({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,D.str)`${t}/${e}`;return r&&(n=(0,D.str)`${n}${(0,pn.getErrorPath)(r,pn.Type.Str)}`),[St.schemaPath,n]}function Yv(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([St.keyword,n],[St.params,typeof t=="function"?t(e):t||(0,D._)`{}`]),c.messages&&o.push([St.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([St.schema,i],[St.parentSchema,(0,D._)`${l}${p}`],[_e.default.data,s]),u&&o.push([St.propertyName,u])}});var Xd=$(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.boolOrEmptySchema=Gt.topBoolOrEmptySchema=void 0;var Xv=Hr(),e$=O(),t$=rt(),r$={message:"boolean schema is false"};function o$(e){let{gen:t,schema:r,validateName:o}=e;r===!1?Yd(e,!1):typeof r=="object"&&r.$async===!0?t.return(t$.default.data):(t.assign((0,e$._)`${o}.errors`,null),t.return(!0))}Gt.topBoolOrEmptySchema=o$;function n$(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),Yd(e)):r.var(t,!0)}Gt.boolOrEmptySchema=n$;function Yd(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Xv.reportError)(n,r$,void 0,t)}});var Ci=$(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.getRules=Kt.isJSONType=void 0;var s$=["string","number","integer","boolean","null","object","array"],i$=new Set(s$);function a$(e){return typeof e=="string"&&i$.has(e)}Kt.isJSONType=a$;function c$(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Kt.getRules=c$});var Zi=$(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function u$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&ef(e,o)}dt.schemaHasRulesForType=u$;function ef(e,t){return t.rules.some(r=>tf(e,r))}dt.shouldUseGroup=ef;function tf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}dt.shouldUseRule=tf});var Wr=$(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var l$=Ci(),p$=Zi(),d$=Hr(),I=O(),rf=q(),Ht;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ht||(me.DataType=Ht={}));function f$(e){let t=of(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}me.getSchemaTypes=f$;function of(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(l$.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}me.getJSONTypes=of;function m$(e,t){let{gen:r,data:o,opts:n}=e,s=h$(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,p$.schemaHasRulesForType)(e,t[0]));if(i){let a=qi(t,o,n.strictNumbers,Ht.Wrong);r.if(a,()=>{s.length?g$(e,t,s):Di(e)})}return i}me.coerceAndCheckDataType=m$;var nf=new Set(["string","number","integer","boolean","null"]);function h$(e,t){return t?e.filter(r=>nf.has(r)||t==="array"&&r==="array"):[]}function g$(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(qi(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(nf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Di(e),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),_$(e,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
4
+ || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,I._)`+${n}`);return;case"integer":o.elseIf((0,I._)`${i} === "boolean" || ${n} === null
5
+ || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,I._)`+${n}`);return;case"boolean":o.elseIf((0,I._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,I._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,I._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,I._)`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function _$({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,I._)`${t} !== undefined`,()=>e.assign((0,I._)`${t}[${r}]`,o))}function Mi(e,t,r,o=Ht.Correct){let n=o===Ht.Correct?I.operators.EQ:I.operators.NEQ,s;switch(e){case"null":return(0,I._)`${t} ${n} null`;case"array":s=(0,I._)`Array.isArray(${t})`;break;case"object":s=(0,I._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,I._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${t} ${n} ${e}`}return o===Ht.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${t} == "number"`,a,r?(0,I._)`isFinite(${t})`:I.nil)}}me.checkDataType=Mi;function qi(e,t,r,o){if(e.length===1)return Mi(e[0],t,r,o);let n,s=(0,rf.toHash)(e);if(s.array&&s.object){let i=(0,I._)`typeof ${t} != "object"`;n=s.null?i:(0,I._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Mi(i,t,r,o));return n}me.checkDataTypes=qi;var y$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,I._)`{type: ${e}}`:(0,I._)`{type: ${t}}`};function Di(e){let t=v$(e);(0,d$.reportError)(t,y$)}me.reportTypeError=Di;function v$(e){let{gen:t,data:r,schema:o}=e,n=(0,rf.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var af=$(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.assignDefaults=void 0;var Wt=O(),$$=q();function b$(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)sf(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>sf(e,s,n.default))}dn.assignDefaults=b$;function sf(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,Wt._)`${s}${(0,Wt.getProperty)(t)}`;if(n){(0,$$.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Wt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Wt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Wt._)`${a} = ${(0,Wt.stringify)(r)}`)}});var je=$(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var B=O(),Li=q(),ft=rt(),w$=q();function z$(e,t){let{gen:r,data:o,it:n}=e;r.if(Ui(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,B._)`${t}`},!0),e.error()})}V.checkReportMissingProp=z$;function x$({gen:e,data:t,it:{opts:r}},o,n){return(0,B.or)(...o.map(s=>(0,B.and)(Ui(e,t,s,r.ownProperties),(0,B._)`${n} = ${s}`)))}V.checkMissingProp=x$;function S$(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=S$;function cf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,B._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=cf;function Fi(e,t,r){return(0,B._)`${cf(e)}.call(${t}, ${r})`}V.isOwnProperty=Fi;function k$(e,t,r,o){let n=(0,B._)`${t}${(0,B.getProperty)(r)} !== undefined`;return o?(0,B._)`${n} && ${Fi(e,t,r)}`:n}V.propertyInData=k$;function Ui(e,t,r,o){let n=(0,B._)`${t}${(0,B.getProperty)(r)} === undefined`;return o?(0,B.or)(n,(0,B.not)(Fi(e,t,r))):n}V.noPropertyInData=Ui;function uf(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=uf;function P$(e,t){return uf(t).filter(r=>!(0,Li.alwaysValidSchema)(e,t[r]))}V.schemaProperties=P$;function E$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,B._)`${e}, ${t}, ${o}${n}`:t,p=[[ft.default.instancePath,(0,B.strConcat)(ft.default.instancePath,s)],[ft.default.parentData,i.parentData],[ft.default.parentDataProperty,i.parentDataProperty],[ft.default.rootData,ft.default.rootData]];i.opts.dynamicRef&&p.push([ft.default.dynamicAnchors,ft.default.dynamicAnchors]);let d=(0,B._)`${l}, ${r.object(...p)}`;return c!==B.nil?(0,B._)`${a}.call(${c}, ${d})`:(0,B._)`${a}(${d})`}V.callValidateCode=E$;var T$=(0,B._)`new RegExp`;function R$({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,B._)`${n.code==="new RegExp"?T$:(0,w$.useFunc)(e,n)}(${r}, ${o})`})}V.usePattern=R$;function I$(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,B._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:Li.Type.Num},s),t.if((0,B.not)(s),a)})}}V.validateArray=I$;function O$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Li.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,B._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,B.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=O$});var df=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateKeywordUsage=Je.validSchemaType=Je.funcKeywordCode=Je.macroKeywordCode=void 0;var ye=O(),kt=rt(),j$=je(),N$=Hr();function A$(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=pf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ye.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Je.macroKeywordCode=A$;function C$(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;M$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=pf(o,n,u),p=o.let("valid");e.block$data(p,d),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function d(){if(t.errors===!1)_(),t.modifying&&lf(e),y(()=>e.error());else{let v=t.async?f():m();t.modifying&&lf(e),y(()=>Z$(e,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ye._)`await `),P=>o.assign(p,!1).if((0,ye._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,ye._)`${P}.errors`),()=>o.throw(P))),v}function m(){let v=(0,ye._)`${l}.errors`;return o.assign(v,null),_(ye.nil),v}function _(v=t.async?(0,ye._)`await `:ye.nil){let P=c.opts.passContext?kt.default.this:kt.default.self,z=!("compile"in t&&!a||t.schema===!1);o.assign(p,(0,ye._)`${v}${(0,j$.callValidateCode)(e,l,P,z)}`,t.modifying)}function y(v){var P;o.if((0,ye.not)((P=t.valid)!==null&&P!==void 0?P:p),v)}}Je.funcKeywordCode=C$;function lf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ye._)`${o.parentData}[${o.parentDataProperty}]`))}function Z$(e,t){let{gen:r}=e;r.if((0,ye._)`Array.isArray(${t})`,()=>{r.assign(kt.default.vErrors,(0,ye._)`${kt.default.vErrors} === null ? ${t} : ${kt.default.vErrors}.concat(${t})`).assign(kt.default.errors,(0,ye._)`${kt.default.vErrors}.length`),(0,N$.extendErrors)(e)},()=>e.error())}function M$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function pf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ye.stringify)(r)})}function q$(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Je.validSchemaType=q$;function D$({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Je.validateKeywordUsage=D$});var mf=$(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendSubschemaMode=mt.extendSubschemaData=mt.getSubschema=void 0;var Ge=O(),ff=q();function L$(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Ge._)`${e.schemaPath}${(0,Ge.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Ge._)`${e.schemaPath}${(0,Ge.getProperty)(t)}${(0,Ge.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,ff.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}mt.getSubschema=L$;function F$(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,d=a.let("data",(0,Ge._)`${t.data}${(0,Ge.getProperty)(r)}`,!0);c(d),e.errorPath=(0,Ge.str)`${u}${(0,ff.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Ge._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Ge.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}mt.extendSubschemaData=F$;function U$(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}mt.extendSubschemaMode=U$});var Vi=$((TI,hf)=>{"use strict";hf.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var _f=$((RI,gf)=>{"use strict";var ht=gf.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};fn(t,o,n,e,"",e)};ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ht.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 fn(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in ht.arrayKeywords)for(var d=0;d<p.length;d++)fn(e,t,r,p[d],n+"/"+l+"/"+d,s,n,l,o,d)}else if(l in ht.propsKeywords){if(p&&typeof p=="object")for(var f in p)fn(e,t,r,p[f],n+"/"+l+"/"+V$(f),s,n,l,o,f)}else(l in ht.keywords||e.allKeys&&!(l in ht.skipKeywords))&&fn(e,t,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function V$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Br=$(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;var J$=q(),G$=Vi(),K$=_f(),H$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function W$(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ji(e):t?yf(e)<=t:!1}we.inlineRef=W$;var B$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ji(e){for(let t in e){if(B$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ji)||typeof r=="object"&&Ji(r))return!0}return!1}function yf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!H$.has(r)&&(typeof e[r]=="object"&&(0,J$.eachItem)(e[r],o=>t+=yf(o)),t===1/0))return 1/0}return t}function vf(e,t="",r){r!==!1&&(t=Bt(t));let o=e.parse(t);return $f(e,o)}we.getFullPath=vf;function $f(e,t){return e.serialize(t).split("#")[0]+"#"}we._getFullPath=$f;var Q$=/#\/?$/;function Bt(e){return e?e.replace(Q$,""):""}we.normalizeId=Bt;function Y$(e,t,r){return r=Bt(r),e.resolve(t,r)}we.resolveUrl=Y$;var X$=/^[a-z_][-a-z0-9._]*$/i;function eb(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Bt(e[r]||t),s={"":n},i=vf(o,n,!1),a={},c=new Set;return K$(e,{allKeys:!0},(p,d,f,m)=>{if(m===void 0)return;let _=i+d,y=s[m];typeof p[r]=="string"&&(y=v.call(this,p[r])),P.call(this,p.$anchor),P.call(this,p.$dynamicAnchor),s[d]=y;function v(z){let k=this.opts.uriResolver.resolve;if(z=Bt(y?k(y,z):z),c.has(z))throw l(z);c.add(z);let w=this.refs[z];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(p,w.schema,z):z!==Bt(_)&&(z[0]==="#"?(u(p,a[z],z),a[z]=p):this.refs[z]=_),z}function P(z){if(typeof z=="string"){if(!X$.test(z))throw new Error(`invalid anchor "${z}"`);v.call(this,`#${z}`)}}}),a;function u(p,d,f){if(d!==void 0&&!G$(p,d))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}we.getSchemaRefs=eb});var Xr=$(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.getData=gt.KeywordCxt=gt.validateFunctionCode=void 0;var Sf=Xd(),bf=Wr(),Ki=Zi(),mn=Wr(),tb=af(),Yr=df(),Gi=mf(),S=O(),T=rt(),rb=Br(),ot=q(),Qr=Hr();function ob(e){if(Ef(e)&&(Tf(e),Pf(e))){ib(e);return}kf(e,()=>(0,Sf.topBoolOrEmptySchema)(e))}gt.validateFunctionCode=ob;function kf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,S._)`${T.default.data}, ${T.default.valCxt}`,o.$async,()=>{e.code((0,S._)`"use strict"; ${wf(r,n)}`),sb(e,n),e.code(s)}):e.func(t,(0,S._)`${T.default.data}, ${nb(n)}`,o.$async,()=>e.code(wf(r,n)).code(s))}function nb(e){return(0,S._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${e.dynamicRef?(0,S._)`, ${T.default.dynamicAnchors}={}`:S.nil}}={}`}function sb(e,t){e.if(T.default.valCxt,()=>{e.var(T.default.instancePath,(0,S._)`${T.default.valCxt}.${T.default.instancePath}`),e.var(T.default.parentData,(0,S._)`${T.default.valCxt}.${T.default.parentData}`),e.var(T.default.parentDataProperty,(0,S._)`${T.default.valCxt}.${T.default.parentDataProperty}`),e.var(T.default.rootData,(0,S._)`${T.default.valCxt}.${T.default.rootData}`),t.dynamicRef&&e.var(T.default.dynamicAnchors,(0,S._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{e.var(T.default.instancePath,(0,S._)`""`),e.var(T.default.parentData,(0,S._)`undefined`),e.var(T.default.parentDataProperty,(0,S._)`undefined`),e.var(T.default.rootData,T.default.data),t.dynamicRef&&e.var(T.default.dynamicAnchors,(0,S._)`{}`)})}function ib(e){let{schema:t,opts:r,gen:o}=e;kf(e,()=>{r.$comment&&t.$comment&&If(e),pb(e),o.let(T.default.vErrors,null),o.let(T.default.errors,0),r.unevaluated&&ab(e),Rf(e),mb(e)})}function ab(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,S._)`${r}.evaluated`),t.if((0,S._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,S._)`${e.evaluated}.props`,(0,S._)`undefined`)),t.if((0,S._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,S._)`${e.evaluated}.items`,(0,S._)`undefined`))}function wf(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,S._)`/*# sourceURL=${r} */`:S.nil}function cb(e,t){if(Ef(e)&&(Tf(e),Pf(e))){ub(e,t);return}(0,Sf.boolOrEmptySchema)(e,t)}function Pf({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Ef(e){return typeof e.schema!="boolean"}function ub(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&If(e),db(e),fb(e);let s=o.const("_errs",T.default.errors);Rf(e,s),o.var(t,(0,S._)`${s} === ${T.default.errors}`)}function Tf(e){(0,ot.checkUnknownRules)(e),lb(e)}function Rf(e,t){if(e.opts.jtd)return zf(e,[],!1,t);let r=(0,bf.getSchemaTypes)(e.schema),o=(0,bf.coerceAndCheckDataType)(e,r);zf(e,r,!o,t)}function lb(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function pb(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(e,"default is ignored in the schema root")}function db(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function fb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function If({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,S._)`${T.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,S.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,S._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function mb(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,S._)`${T.default.errors} === 0`,()=>t.return(T.default.data),()=>t.throw((0,S._)`new ${n}(${T.default.vErrors})`)):(t.assign((0,S._)`${o}.errors`,T.default.vErrors),s.unevaluated&&hb(e),t.return((0,S._)`${T.default.errors} === 0`))}function hb({gen:e,evaluated:t,props:r,items:o}){r instanceof S.Name&&e.assign((0,S._)`${t}.props`,r),o instanceof S.Name&&e.assign((0,S._)`${t}.items`,o)}function zf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){n.block(()=>jf(e,"$ref",l.all.$ref.definition));return}c.jtd||gb(e,t),n.block(()=>{for(let d of l.rules)p(d);p(l.post)});function p(d){(0,Ki.shouldUseGroup)(s,d)&&(d.type?(n.if((0,mn.checkDataType)(d.type,i,c.strictNumbers)),xf(e,d),t.length===1&&t[0]===d.type&&r&&(n.else(),(0,mn.reportTypeError)(e)),n.endIf()):xf(e,d),a||n.if((0,S._)`${T.default.errors} === ${o||0}`))}}function xf(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,tb.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Ki.shouldUseRule)(o,s)&&jf(e,s.keyword,s.definition,t.type)})}function gb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(_b(e,t),e.opts.allowUnionTypes||yb(e,t),vb(e,e.dataTypes))}function _b(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Of(e.dataTypes,r)||Hi(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bb(e,t)}}function yb(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Hi(e,"use allowUnionTypes to allow union type keyword")}function vb(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ki.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>$b(t,i))&&Hi(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function $b(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Of(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bb(e,t){let r=[];for(let o of e.dataTypes)Of(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Hi(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(e,t,e.opts.strictTypes)}var hn=class{constructor(t,r,o){if((0,Yr.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Nf(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Yr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",T.default.errors))}result(t,r,o){this.failResult((0,S.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,S.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,S._)`${r} !== undefined && (${(0,S.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?Qr.reportExtraError:Qr.reportError)(this,this.def.error,r)}$dataError(){(0,Qr.reportError)(this,this.def.$dataError||Qr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Qr.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=S.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=S.nil,r=S.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,S.or)((0,S._)`${n} === undefined`,r)),t!==S.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==S.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,S.or)(i(),a());function i(){if(o.length){if(!(r instanceof S.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,S._)`${(0,mn.checkDataTypes)(c,r,s.opts.strictNumbers,mn.DataType.Wrong)}`}return S.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,S._)`!${c}(${r})`}return S.nil}}subschema(t,r){let o=(0,Gi.getSubschema)(this.it,t);(0,Gi.extendSubschemaData)(o,this.it,t),(0,Gi.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return cb(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=ot.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=ot.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,S.Name)),!0}};gt.KeywordCxt=hn;function jf(e,t,r,o){let n=new hn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Yr.funcKeywordCode)(n,r):"macro"in r?(0,Yr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Yr.funcKeywordCode)(n,r)}var wb=/^\/(?:[^~]|~0|~1)*$/,zb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Nf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return T.default.rootData;if(e[0]==="/"){if(!wb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=T.default.rootData}else{let u=zb.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,S._)`${s}${(0,S.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,S._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}gt.getData=Nf});var gn=$(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Wi=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Bi.default=Wi});var eo=$(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Qi=Br(),Yi=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Qi.resolveUrl)(t,r,o),this.missingSchema=(0,Qi.normalizeId)((0,Qi.getFullPath)(t,this.missingRef))}};Xi.default=Yi});var yn=$(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.resolveSchema=Ne.getCompilingSchema=Ne.resolveRef=Ne.compileSchema=Ne.SchemaEnv=void 0;var Me=O(),xb=gn(),Pt=rt(),qe=Br(),Af=q(),Sb=Xr(),Qt=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,qe.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Ne.SchemaEnv=Qt;function ta(e){let t=Cf.call(this,e);if(t)return t;let r=(0,qe.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Me.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xb.default,code:(0,Me._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Pt.default.data,parentData:Pt.default.parentData,parentDataProperty:Pt.default.parentDataProperty,dataNames:[Pt.default.data],dataPathArr:[Me.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Me.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Me.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Me._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Sb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Pt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Pt.default.self}`,`${Pt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof Me.Name?void 0:m,items:_ instanceof Me.Name?void 0:_,dynamicProps:m instanceof Me.Name,dynamicItems:_ instanceof Me.Name},f.source&&(f.source.evaluated=(0,Me.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Ne.compileSchema=ta;function kb(e,t,r){var o;r=(0,qe.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Tb.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Qt({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Pb.call(this,s)}Ne.resolveRef=kb;function Pb(e){return(0,qe.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ta.call(this,e)}function Cf(e){for(let t of this._compilations)if(Eb(t,e))return t}Ne.getCompilingSchema=Cf;function Eb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||_n.call(this,e,t)}function _n(e,t){let r=this.opts.uriResolver.parse(t),o=(0,qe._getFullPath)(this.opts.uriResolver,r),n=(0,qe.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return ea.call(this,r,e);let s=(0,qe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=_n.call(this,e,i);return typeof a?.schema!="object"?void 0:ea.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ta.call(this,i),s===(0,qe.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,qe.resolveUrl)(this.opts.uriResolver,n,u)),new Qt({schema:a,schemaId:c,root:e,baseId:n})}return ea.call(this,r,i)}}Ne.resolveSchema=_n;var Rb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ea(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Af.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Rb.has(a)&&u&&(t=(0,qe.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Af.schemaHasRulesButRef)(r,this.RULES)){let a=(0,qe.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=_n.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Qt({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Zf=$((CI,Ib)=>{Ib.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 na=$((ZI,Uf)=>{"use strict";var Ob=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),qf=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),ra=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Df=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),jb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function oa(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Nb=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Mf(e){return e.length=0,!0}function Ab(e,t,r){if(e.length){let o=oa(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Cb(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Ab;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=Mf}else{n.push(u);continue}}return n.length&&(a===Mf?r.zone=n.join(""):i?o.push(n.join("")):o.push(oa(n))),r.address=o.join(""),r}function Lf(e){if(Zb(e,":")<2)return{host:e,isIPV6:!1};let t=Cb(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Zb(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function Mb(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var qb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Db=/[@/?#:]/g,Lb=/[@/?#]/g;function Ff(e,t){let r=t?Lb:Db;return r.lastIndex=0,e.replace(r,o=>qb[o])}function Fb(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(ra(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Df(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function Ub(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ra(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&Df(s)?t+=s:t+="%"+n,r+=2;continue}}jb(e[r])?t+=e[r]:t+=escape(e[r])}return t}function Vb(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ra(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Jb(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!qf(r)){let o=Lf(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=Ff(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Uf.exports={nonSimpleDomain:Nb,recomposeAuthority:Jb,reescapeHostDelimiters:Ff,normalizePercentEncoding:Fb,normalizePathEncoding:Ub,escapePreservingEscapes:Vb,removeDotSegments:Mb,isIPv4:qf,isUUID:Ob,normalizeIPv6:Lf,stringArrayToHexStripped:oa}});var Hf=$((MI,Kf)=>{"use strict";var{isUUID:Gb}=na(),Kb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Hb=["http","https","ws","wss","urn","urn:uuid"];function Wb(e){return Hb.indexOf(e)!==-1}function sa(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Vf(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Jf(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Bb(e){return e.secure=sa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Qb(e){if((e.port===(sa(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Yb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Kb);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=ia(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Xb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=ia(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function e0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Gb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function t0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Gf={scheme:"http",domainHost:!0,parse:Vf,serialize:Jf},r0={scheme:"https",domainHost:Gf.domainHost,parse:Vf,serialize:Jf},vn={scheme:"ws",domainHost:!0,parse:Bb,serialize:Qb},o0={scheme:"wss",domainHost:vn.domainHost,parse:vn.parse,serialize:vn.serialize},n0={scheme:"urn",parse:Yb,serialize:Xb,skipNormalize:!0},s0={scheme:"urn:uuid",parse:e0,serialize:t0,skipNormalize:!0},$n={http:Gf,https:r0,ws:vn,wss:o0,urn:n0,"urn:uuid":s0};Object.setPrototypeOf($n,null);function ia(e){return e&&($n[e]||$n[e.toLowerCase()])||void 0}Kf.exports={wsIsSecure:sa,SCHEMES:$n,isValidSchemeName:Wb,getSchemeHandler:ia}});var em=$((qI,bn)=>{"use strict";var{normalizeIPv6:i0,removeDotSegments:to,recomposeAuthority:a0,normalizePercentEncoding:c0,normalizePathEncoding:u0,escapePreservingEscapes:l0,reescapeHostDelimiters:p0,isIPv4:d0,nonSimpleDomain:f0}=na(),{SCHEMES:m0,getSchemeHandler:Bf}=Hf();function h0(e,t){return typeof e=="string"?e=$0(e,t):typeof e=="object"&&(e=Yt(Et(e,t),t)),e}function g0(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Qf(Yt(e,o),Yt(t,o),o,!0);return o.skipEscape=!0,Et(n,o)}function Qf(e,t,r,o){let n={};return o||(e=Yt(Et(e,r),r),t=Yt(Et(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=to(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=to(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=to(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=to(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function _0(e,t,r){let o=Wf(e,r),n=Wf(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Et(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=Bf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=c0(r.path):(r.path=l0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=a0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=to(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var y0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v0(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Yf(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(y0);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=v0(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(d0(o.host)===!1){let l=i0(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=Bf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&f0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=p0(unescape(o.host),s))),o.path&&(o.path=u0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Yt(e,t){return Yf(e,t).parsed}function $0(e,t){return Xf(e,t).normalized}function Xf(e,t){let{parsed:r,malformedAuthorityOrPort:o}=Yf(e,t);return{normalized:o?e:Et(r,t),malformedAuthorityOrPort:o}}function Wf(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:o}=Xf(e,t);return o?void 0:r}if(typeof e=="object")return Et(e,t)}var aa={SCHEMES:m0,normalize:h0,resolve:g0,resolveComponent:Qf,equal:_0,serialize:Et,parse:Yt};bn.exports=aa;bn.exports.default=aa;bn.exports.fastUri=aa});var rm=$(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var tm=em();tm.code='require("ajv/dist/runtime/uri").default';ca.default=tm});var lm=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var b0=Xr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return b0.KeywordCxt}});var Xt=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Xt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Xt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Xt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Xt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Xt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Xt.CodeGen}});var w0=gn(),am=eo(),z0=Ci(),ro=yn(),x0=O(),oo=Br(),wn=Wr(),la=q(),om=Zf(),S0=rm(),cm=(e,t)=>new RegExp(e,t);cm.code="new RegExp";var k0=["removeAdditional","useDefaults","coerceTypes"],P0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),E0={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."},T0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nm=200;function R0(e){var t,r,o,n,s,i,a,c,u,l,p,d,f,m,_,y,v,P,z,k,w,xe,Ee,lr,ts;let pr=e.strict,rs=(t=e.code)===null||t===void 0?void 0:t.optimize,$c=rs===!0||rs===void 0?1:rs||0,bc=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:cm,Gh=(n=e.uriResolver)!==null&&n!==void 0?n:S0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:pr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:pr)!==null&&l!==void 0?l:"log",strictTuples:(d=(p=e.strictTuples)!==null&&p!==void 0?p:pr)!==null&&d!==void 0?d:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:pr)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:$c,regExp:bc}:{optimize:$c,regExp:bc},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:nm,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:nm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(xe=e.validateSchema)!==null&&xe!==void 0?xe:!0,validateFormats:(Ee=e.validateFormats)!==null&&Ee!==void 0?Ee:!0,unicodeRegExp:(lr=e.unicodeRegExp)!==null&&lr!==void 0?lr:!0,int32range:(ts=e.int32range)!==null&&ts!==void 0?ts:!0,uriResolver:Gh}}var no=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...R0(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new x0.ValueScope({scope:{},prefixes:P0,es5:r,lines:o}),this.logger=C0(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,z0.getRules)(),sm.call(this,E0,t,"NOT SUPPORTED"),sm.call(this,T0,t,"DEPRECATED","warn"),this._metaOpts=N0.call(this),t.formats&&O0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&j0.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),I0.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=om;o==="id"&&(n={...om},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,p){await s.call(this,l.$schema);let d=this._addSchema(l,p);return d.validate||i.call(this,d)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof am.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,oo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=im.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new ro.SchemaEnv({schema:{},schemaId:o});if(r=ro.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=im.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,oo.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M0.call(this,o,r),!r)return(0,la.eachItem)(o,s=>ua.call(this,s)),this;D0.call(this,r);let n={...r,type:(0,wn.getJSONTypes)(r.type),schemaType:(0,wn.getJSONTypes)(r.schemaType)};return(0,la.eachItem)(o,n.type.length===0?s=>ua.call(this,s,n):s=>n.type.forEach(i=>ua.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=um(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,oo.normalizeId)(i||o);let u=oo.getSchemaRefs.call(this,t,o);return c=new ro.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):ro.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{ro.compileSchema.call(this,t)}finally{this.opts=r}}};no.ValidationError=w0.default;no.MissingRefError=am.default;le.default=no;function sm(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function im(e){return e=(0,oo.normalizeId)(e),this.schemas[e]||this.refs[e]}function I0(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function O0(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function j0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function N0(){let e={...this.opts};for(let t of k0)delete e[t];return e}var A0={log(){},warn(){},error(){}};function C0(e){if(e===!1)return A0;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Z0=/^[a-z_$][a-z0-9_$:-]*$/i;function M0(e,t){let{RULES:r}=this;if((0,la.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Z0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ua(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,wn.getJSONTypes)(t.type),schemaType:(0,wn.getJSONTypes)(t.schemaType)}};t.before?q0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function q0(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function D0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=um(t)),e.validateSchema=this.compile(t,!0))}var L0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function um(e){return{anyOf:[e,L0]}}});var pm=$(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var F0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pa.default=F0});var hm=$(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var U0=eo(),dm=je(),ze=O(),er=rt(),fm=yn(),zn=q(),V0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=fm.resolveRef.call(c,u,n,r);if(l===void 0)throw new U0.default(o.opts.uriResolver,n,r);if(l instanceof fm.SchemaEnv)return d(l);return f(l);function p(){if(s===u)return xn(e,i,s,s.$async);let m=t.scopeValue("root",{ref:u});return xn(e,(0,ze._)`${m}.validate`,u,u.$async)}function d(m){let _=mm(e,m);xn(e,_,m,m.$async)}function f(m){let _=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,ze.stringify)(m)}:{ref:m}),y=t.name("valid"),v=e.subschema({schema:m,dataTypes:[],schemaPath:ze.nil,topSchemaRef:_,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function mm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ze._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tt.getValidate=mm;function xn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?er.default.this:ze.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,ze._)`await ${(0,dm.callValidateCode)(e,t,u)}`),f(t),i||n.assign(m,!0)},_=>{n.if((0,ze._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),d(_),i||n.assign(m,!1)}),e.ok(m)}function p(){e.result((0,dm.callValidateCode)(e,t,u),()=>f(t),()=>d(t))}function d(m){let _=(0,ze._)`${m}.errors`;n.assign(er.default.vErrors,(0,ze._)`${er.default.vErrors} === null ? ${_} : ${er.default.vErrors}.concat(${_})`),n.assign(er.default.errors,(0,ze._)`${er.default.vErrors}.length`)}function f(m){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=zn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,ze._)`${m}.evaluated.props`);s.props=zn.mergeEvaluated.props(n,v,s.props,ze.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=zn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,ze._)`${m}.evaluated.items`);s.items=zn.mergeEvaluated.items(n,v,s.items,ze.Name)}}}Tt.callRef=xn;Tt.default=V0});var gm=$(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var J0=pm(),G0=hm(),K0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",J0.default,G0.default];da.default=K0});var _m=$(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var Sn=O(),_t=Sn.operators,kn={maximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},minimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},exclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},exclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},H0={message:({keyword:e,schemaCode:t})=>(0,Sn.str)`must be ${kn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Sn._)`{comparison: ${kn[e].okStr}, limit: ${t}}`},W0={keyword:Object.keys(kn),type:"number",schemaType:"number",$data:!0,error:H0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,Sn._)`${r} ${kn[t].fail} ${o} || isNaN(${r})`)}};fa.default=W0});var ym=$(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var so=O(),B0={message:({schemaCode:e})=>(0,so.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,so._)`{multipleOf: ${e}}`},Q0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:B0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,so._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,so._)`${i} !== parseInt(${i})`;e.fail$data((0,so._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ma.default=Q0});var $m=$(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});function vm(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}ha.default=vm;vm.code='require("ajv/dist/runtime/ucs2length").default'});var bm=$(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Rt=O(),Y0=q(),X0=$m(),ew={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Rt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Rt._)`{limit: ${e}}`},tw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ew,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Rt.operators.GT:Rt.operators.LT,i=n.opts.unicode===!1?(0,Rt._)`${r}.length`:(0,Rt._)`${(0,Y0.useFunc)(e.gen,X0.default)}(${r})`;e.fail$data((0,Rt._)`${i} ${s} ${o}`)}};ga.default=tw});var wm=$(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var rw=je(),ow=q(),tr=O(),nw={message:({schemaCode:e})=>(0,tr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,tr._)`{pattern: ${e}}`},sw={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nw,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,tr._)`new RegExp`:(0,ow.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,tr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,tr._)`!${l}`)}else{let c=(0,rw.usePattern)(e,n);e.fail$data((0,tr._)`!${c}.test(${r})`)}}};_a.default=sw});var zm=$(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var io=O(),iw={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,io.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,io._)`{limit: ${e}}`},aw={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iw,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?io.operators.GT:io.operators.LT;e.fail$data((0,io._)`Object.keys(${r}).length ${n} ${o}`)}};ya.default=aw});var xm=$(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var ao=je(),co=O(),cw=q(),uw={message:({params:{missingProperty:e}})=>(0,co.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,co._)`{missingProperty: ${e}}`},lw={keyword:"required",type:"object",schemaType:"array",$data:!0,error:uw,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let _ of r)if(f?.[_]===void 0&&!m.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,cw.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(co.nil,p);else for(let f of r)(0,ao.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let m=t.let("valid",!0);e.block$data(m,()=>d(f,m)),e.ok(m)}else t.if((0,ao.checkMissingProp)(e,r,f)),(0,ao.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,ao.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function d(f,m){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(m,(0,ao.propertyInData)(t,n,f,a.ownProperties)),t.if((0,co.not)(m),()=>{e.error(),t.break()})},co.nil)}}};va.default=lw});var Sm=$($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var uo=O(),pw={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,uo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,uo._)`{limit: ${e}}`},dw={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:pw,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?uo.operators.GT:uo.operators.LT;e.fail$data((0,uo._)`${r}.length ${n} ${o}`)}};$a.default=dw});var Pn=$(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var km=Vi();km.code='require("ajv/dist/runtime/equal").default';ba.default=km});var Pm=$(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var wa=Wr(),pe=O(),fw=q(),mw=Pn(),hw={message:({params:{i:e,j:t}})=>(0,pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,pe._)`{i: ${e}, j: ${t}}`},gw={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hw,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,wa.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,pe._)`${i} === false`),e.ok(c);function l(){let m=t.let("i",(0,pe._)`${r}.length`),_=t.let("j");e.setParams({i:m,j:_}),t.assign(c,!0),t.if((0,pe._)`${m} > 1`,()=>(p()?d:f)(m,_))}function p(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function d(m,_){let y=t.name("item"),v=(0,wa.checkDataTypes)(u,y,a.opts.strictNumbers,wa.DataType.Wrong),P=t.const("indices",(0,pe._)`{}`);t.for((0,pe._)`;${m}--;`,()=>{t.let(y,(0,pe._)`${r}[${m}]`),t.if(v,(0,pe._)`continue`),u.length>1&&t.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),t.if((0,pe._)`typeof ${P}[${y}] == "number"`,()=>{t.assign(_,(0,pe._)`${P}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,pe._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,fw.useFunc)(t,mw.default),v=t.name("outer");t.label(v).for((0,pe._)`;${m}--;`,()=>t.for((0,pe._)`${_} = ${m}; ${_}--;`,()=>t.if((0,pe._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};za.default=gw});var Em=$(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var xa=O(),_w=q(),yw=Pn(),vw={message:"must be equal to constant",params:({schemaCode:e})=>(0,xa._)`{allowedValue: ${e}}`},$w={keyword:"const",$data:!0,error:vw,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,xa._)`!${(0,_w.useFunc)(t,yw.default)}(${r}, ${n})`):e.fail((0,xa._)`${s} !== ${r}`)}};Sa.default=$w});var Tm=$(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var lo=O(),bw=q(),ww=Pn(),zw={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,lo._)`{allowedValues: ${e}}`},xw={keyword:"enum",schemaType:"array",$data:!0,error:zw,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,bw.useFunc)(t,ww.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,lo.or)(...n.map((m,_)=>d(f,_)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,lo._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function d(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,lo._)`${u()}(${r}, ${f}[${m}])`:(0,lo._)`${r} === ${_}`}}};ka.default=xw});var Rm=$(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Sw=_m(),kw=ym(),Pw=bm(),Ew=wm(),Tw=zm(),Rw=xm(),Iw=Sm(),Ow=Pm(),jw=Em(),Nw=Tm(),Aw=[Sw.default,kw.default,Pw.default,Ew.default,Tw.default,Rw.default,Iw.default,Ow.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},jw.default,Nw.default];Pa.default=Aw});var Ta=$(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.validateAdditionalItems=void 0;var It=O(),Ea=q(),Cw={message:({params:{len:e}})=>(0,It.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,It._)`{limit: ${e}}`},Zw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Cw,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,Ea.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Im(e,o)}};function Im(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,It._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,It._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,Ea.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,It._)`${a} <= ${t.length}`);r.if((0,It.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Ea.Type.Num},u),i.allErrors||r.if((0,It.not)(u),()=>r.break())})}}po.validateAdditionalItems=Im;po.default=Zw});var Ra=$(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.validateTuple=void 0;var Om=O(),En=q(),Mw=je(),qw={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return jm(e,"additionalItems",t);r.items=!0,!(0,En.alwaysValidSchema)(r,t)&&e.ok((0,Mw.validateArray)(e))}};function jm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=En.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Om._)`${s}.length`);r.forEach((p,d)=>{(0,En.alwaysValidSchema)(a,p)||(o.if((0,Om._)`${u} > ${d}`,()=>e.subschema({keyword:i,schemaProp:d,dataProp:d},c)),e.ok(c))});function l(p){let{opts:d,errSchemaPath:f}=a,m=r.length,_=m===p.minItems&&(m===p.maxItems||p[t]===!1);if(d.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,En.checkStrictMode)(a,y,d.strictTuples)}}}fo.validateTuple=jm;fo.default=qw});var Nm=$(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Dw=Ra(),Lw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Dw.validateTuple)(e,"items")};Ia.default=Lw});var Cm=$(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Am=O(),Fw=q(),Uw=je(),Vw=Ta(),Jw={message:({params:{len:e}})=>(0,Am.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Am._)`{limit: ${e}}`},Gw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Jw,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,Fw.alwaysValidSchema)(o,t)&&(n?(0,Vw.validateAdditionalItems)(e,n):e.ok((0,Uw.validateArray)(e)))}};Oa.default=Gw});var Zm=$(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Ae=O(),Tn=q(),Kw={message:({params:{min:e,max:t}})=>t===void 0?(0,Ae.str)`must contain at least ${e} valid item(s)`:(0,Ae.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ae._)`{minContains: ${e}}`:(0,Ae._)`{minContains: ${e}, maxContains: ${t}}`},Hw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Kw,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Ae._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Tn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Tn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Tn.alwaysValidSchema)(s,r)){let _=(0,Ae._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ae._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,Ae._)`${n}.length > 0`,d)):(t.let(p,!1),d()),e.result(p,()=>e.reset());function d(){let _=t.name("_valid"),y=t.let("count",0);f(_,()=>t.if(_,()=>m(y)))}function f(_,y){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Tn.Type.Num,compositeRule:!0},_),y()})}function m(_){t.code((0,Ae._)`${_}++`),a===void 0?t.if((0,Ae._)`${_} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,Ae._)`${_} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,Ae._)`${_} >= ${i}`,()=>t.assign(p,!0)))}}};ja.default=Hw});var Dm=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var Na=O(),Ww=q(),mo=je();Ke.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Na.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Na._)`{property: ${e},
7
+ missingProperty: ${o},
8
+ depsCount: ${t},
9
+ deps: ${r}}`};var Bw={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(e){let[t,r]=Qw(e);Mm(e,t),qm(e,r)}};function Qw({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Mm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,mo.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,mo.checkReportMissingProp)(e,u)}):(r.if((0,Na._)`${c} && (${(0,mo.checkMissingProp)(e,a,s)})`),(0,mo.reportMissingProp)(e,s),r.else())}}Ke.validatePropertyDeps=Mm;function qm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,Ww.alwaysValidSchema)(s,t[a])||(r.if((0,mo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Ke.validateSchemaDeps=qm;Ke.default=Bw});var Fm=$(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Lm=O(),Yw=q(),Xw={message:"property name must be valid",params:({params:e})=>(0,Lm._)`{propertyName: ${e.propertyName}}`},ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Xw,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Yw.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Lm.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};Aa.default=ez});var Za=$(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Rn=je(),De=O(),tz=rt(),In=q(),rz={message:"must NOT have additional properties",params:({params:e})=>(0,De._)`{additionalProperty: ${e.additionalProperty}}`},oz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:rz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,In.alwaysValidSchema)(i,r))return;let u=(0,Rn.allSchemaProperties)(o.properties),l=(0,Rn.allSchemaProperties)(o.patternProperties);p(),e.ok((0,De._)`${s} === ${tz.default.errors}`);function p(){t.forIn("key",n,y=>{!u.length&&!l.length?m(y):t.if(d(y),()=>m(y))})}function d(y){let v;if(u.length>8){let P=(0,In.schemaRefOrVal)(i,o.properties,"properties");v=(0,Rn.isOwnProperty)(t,P,y)}else u.length?v=(0,De.or)(...u.map(P=>(0,De._)`${y} === ${P}`)):v=De.nil;return l.length&&(v=(0,De.or)(v,...l.map(P=>(0,De._)`${(0,Rn.usePattern)(e,P)}.test(${y})`))),(0,De.not)(v)}function f(y){t.code((0,De._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,In.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),t.if((0,De.not)(v),()=>{e.reset(),f(y)})):(_(y,v),a||t.if((0,De.not)(v),()=>t.break()))}}function _(y,v,P){let z={keyword:"additionalProperties",dataProp:y,dataPropType:In.Type.Str};P===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,v)}}};Ca.default=oz});var Jm=$(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var nz=Xr(),Um=je(),Ma=q(),Vm=Za(),sz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Vm.default.code(new nz.KeywordCxt(s,Vm.default,"additionalProperties"));let i=(0,Um.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ma.mergeEvaluated.props(t,(0,Ma.toHash)(i),s.props));let a=i.filter(p=>!(0,Ma.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,Um.propertyInData)(t,n,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};qa.default=sz});var Wm=$(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Gm=je(),On=O(),Km=q(),Hm=q(),iz={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,Gm.allSchemaProperties)(r),c=a.filter(_=>(0,Km.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof On.Name)&&(s.props=(0,Hm.evaluatedPropsToName)(t,s.props));let{props:p}=s;d();function d(){for(let _ of a)u&&f(_),s.allErrors?m(_):(t.var(l,!0),m(_),t.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,Km.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){t.forIn("key",o,y=>{t.if((0,On._)`${(0,Gm.usePattern)(e,_)}.test(${y})`,()=>{let v=c.includes(_);v||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:Hm.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,On._)`${p}[${y}]`,!0):!v&&!s.allErrors&&t.if((0,On.not)(l),()=>t.break())})})}}};Da.default=iz});var Bm=$(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var az=q(),cz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,az.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};La.default=cz});var Qm=$(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var uz=je(),lz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uz.validateUnion,error:{message:"must match a schema in anyOf"}};Fa.default=lz});var Ym=$(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var jn=O(),pz=q(),dz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,jn._)`{passingSchemas: ${e.passing}}`},fz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:dz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let d;(0,pz.alwaysValidSchema)(n,l)?t.var(c,!0):d=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,jn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,jn._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),d&&e.mergeEvaluated(d,jn.Name)})})}}};Ua.default=fz});var Xm=$(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var mz=q(),hz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,mz.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Va.default=hz});var rh=$(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Nn=O(),th=q(),gz={message:({params:e})=>(0,Nn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Nn._)`{failingKeyword: ${e.ifClause}}`},_z={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:gz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,th.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=eh(o,"then"),s=eh(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,Nn.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,p){return()=>{let d=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(d,i),p?t.assign(p,(0,Nn._)`${l}`):e.setParams({ifClause:l})}}}};function eh(e,t){let r=e.schema[t];return r!==void 0&&!(0,th.alwaysValidSchema)(e,r)}Ja.default=_z});var oh=$(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var yz=q(),vz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,yz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Ga.default=vz});var nh=$(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var $z=Ta(),bz=Nm(),wz=Ra(),zz=Cm(),xz=Zm(),Sz=Dm(),kz=Fm(),Pz=Za(),Ez=Jm(),Tz=Wm(),Rz=Bm(),Iz=Qm(),Oz=Ym(),jz=Xm(),Nz=rh(),Az=oh();function Cz(e=!1){let t=[Rz.default,Iz.default,Oz.default,jz.default,Nz.default,Az.default,kz.default,Pz.default,Sz.default,Ez.default,Tz.default];return e?t.push(bz.default,zz.default):t.push($z.default,wz.default),t.push(xz.default),t}Ka.default=Cz});var sh=$(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var oe=O(),Zz={message:({schemaCode:e})=>(0,oe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,oe._)`{format: ${e}}`},Mz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Zz,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?d():f();function d(){let m=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(v,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,_)),e.fail$data((0,oe.or)(P(),z()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function z(){let k=l.$async?(0,oe._)`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,w=(0,oe._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${t} && !${w}`}}function f(){let m=p.formats[s];if(!m){P();return}if(m===!0)return;let[_,y,v]=z(m);_===t&&e.pass(k());function P(){if(c.strictSchema===!1){p.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(w){let xe=w instanceof RegExp?(0,oe.regexpCode)(w):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Ee=r.scopeValue("formats",{key:s,ref:w,code:xe});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,oe._)`${Ee}.validate`]:["string",w,Ee]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};Ha.default=Mz});var ih=$(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var qz=sh(),Dz=[qz.default];Wa.default=Dz});var ah=$(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.contentVocabulary=rr.metadataVocabulary=void 0;rr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];rr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var uh=$(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var Lz=gm(),Fz=Rm(),Uz=nh(),Vz=ih(),ch=ah(),Jz=[Lz.default,Fz.default,(0,Uz.default)(),Vz.default,ch.metadataVocabulary,ch.contentVocabulary];Ba.default=Jz});var ph=$(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.DiscrError=void 0;var lh;(function(e){e.Tag="tag",e.Mapping="mapping"})(lh||(An.DiscrError=lh={}))});var fh=$(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var or=O(),Qa=ph(),dh=yn(),Gz=eo(),Kz=q(),Hz={message:({params:{discrError:e,tagName:t}})=>e===Qa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,or._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Wz={keyword:"discriminator",type:"object",schemaType:"object",error:Hz,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,or._)`${r}${(0,or.getProperty)(a)}`);t.if((0,or._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Qa.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=d();t.if(!1);for(let m in f)t.elseIf((0,or._)`${u} === ${m}`),t.assign(c,p(f[m]));t.else(),e.error(!1,{discrError:Qa.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let m=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(_,or.Name),m}function d(){var f;let m={},_=v(n),y=!0;for(let k=0;k<i.length;k++){let w=i[k];if(w?.$ref&&!(0,Kz.schemaHasRulesButRef)(w,s.self.RULES)){let Ee=w.$ref;if(w=dh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ee),w instanceof dh.SchemaEnv&&(w=w.schema),w===void 0)throw new Gz.default(s.opts.uriResolver,s.baseId,Ee)}let xe=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof xe!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(w)),P(xe,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function v({required:k}){return Array.isArray(k)&&k.includes(a)}function P(k,w){if(k.const)z(k.const,w);else if(k.enum)for(let xe of k.enum)z(xe,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(k,w){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=w}}}};Ya.default=Wz});var mh=$((PO,Bz)=>{Bz.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 ec=$((Q,Xa)=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.MissingRefError=Q.ValidationError=Q.CodeGen=Q.Name=Q.nil=Q.stringify=Q.str=Q._=Q.KeywordCxt=Q.Ajv=void 0;var Qz=lm(),Yz=uh(),Xz=fh(),hh=mh(),ex=["/properties"],Cn="http://json-schema.org/draft-07/schema",nr=class extends Qz.default{_addVocabularies(){super._addVocabularies(),Yz.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Xz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(hh,ex):hh;this.addMetaSchema(t,Cn,!1),this.refs["http://json-schema.org/schema"]=Cn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Cn)?Cn:void 0)}};Q.Ajv=nr;Xa.exports=Q=nr;Xa.exports.Ajv=nr;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=nr;var tx=Xr();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return tx.KeywordCxt}});var sr=O();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return sr._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return sr.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return sr.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return sr.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return sr.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return sr.CodeGen}});var rx=gn();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return rx.default}});var ox=eo();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return ox.default}})});var zh=$(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatNames=We.fastFormats=We.fullFormats=void 0;function He(e,t){return{validate:e,compare:t}}We.fullFormats={date:He(vh,nc),time:He(rc(!0),sc),"date-time":He(gh(!0),bh),"iso-time":He(rc(),$h),"iso-date-time":He(gh(),wh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ux,"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:gx,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:lx,int32:{type:"number",validate:fx},int64:{type:"number",validate:mx},float:{type:"number",validate:yh},double:{type:"number",validate:yh},password:!0,binary:!0};We.fastFormats={...We.fullFormats,date:He(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,nc),time:He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,sc),"date-time":He(/^\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,bh),"iso-time":He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$h),"iso-date-time":He(/^\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,wh),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};We.formatNames=Object.keys(We.fullFormats);function nx(e){return e%4===0&&(e%100!==0||e%400===0)}var sx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ix=[0,31,28,31,30,31,30,31,31,30,31,30,31];function vh(e){let t=sx.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&nx(r)?29:ix[o])}function nc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var tc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function rc(e){return function(r){let o=tc.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,d=n-u*c-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function sc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function $h(e,t){if(!(e&&t))return;let r=tc.exec(e),o=tc.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var oc=/t|\s/i;function gh(e){let t=rc(e);return function(o){let n=o.split(oc);return n.length===2&&vh(n[0])&&t(n[1])}}function bh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function wh(e,t){if(!(e&&t))return;let[r,o]=e.split(oc),[n,s]=t.split(oc),i=nc(r,n);if(i!==void 0)return i||sc(o,s)}var ax=/\/|:/,cx=/^(?:[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 ux(e){return ax.test(e)&&cx.test(e)}var _h=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function lx(e){return _h.lastIndex=0,_h.test(e)}var px=-(2**31),dx=2**31-1;function fx(e){return Number.isInteger(e)&&e<=dx&&e>=px}function mx(e){return Number.isInteger(e)}function yh(){return!0}var hx=/[^\\]\\Z/;function gx(e){if(hx.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var xh=$(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.formatLimitDefinition=void 0;var _x=ec(),Le=O(),yt=Le.operators,Zn={formatMaximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},formatMinimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},formatExclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},formatExclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},yx={message:({keyword:e,schemaCode:t})=>(0,Le.str)`should be ${Zn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Le._)`{comparison: ${Zn[e].okStr}, limit: ${t}}`};ir.formatLimitDefinition={keyword:Object.keys(Zn),type:"string",schemaType:"string",$data:!0,error:yx,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new _x.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let d=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Le._)`${d}[${c.schemaCode}]`);e.fail$data((0,Le.or)((0,Le._)`typeof ${f} != "object"`,(0,Le._)`${f} instanceof RegExp`,(0,Le._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let d=c.schema,f=a.formats[d];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${d}" does not define "compare" function`);let m=t.scopeValue("formats",{key:d,ref:f,code:i.code.formats?(0,Le._)`${i.code.formats}${(0,Le.getProperty)(d)}`:void 0});e.fail$data(p(m))}function p(d){return(0,Le._)`${d}.compare(${r}, ${o}) ${Zn[n].fail} 0`}},dependencies:["format"]};var vx=e=>(e.addKeyword(ir.formatLimitDefinition),e);ir.default=vx});var Eh=$((ho,Ph)=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});var ar=zh(),$x=xh(),ic=O(),Sh=new ic.Name("fullFormats"),bx=new ic.Name("fastFormats"),ac=(e,t={keywords:!0})=>{if(Array.isArray(t))return kh(e,t,ar.fullFormats,Sh),e;let[r,o]=t.mode==="fast"?[ar.fastFormats,bx]:[ar.fullFormats,Sh],n=t.formats||ar.formatNames;return kh(e,n,r,o),t.keywords&&(0,$x.default)(e),e};ac.get=(e,t="full")=>{let o=(t==="fast"?ar.fastFormats:ar.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function kh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,ic._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Ph.exports=ho=ac;Object.defineProperty(ho,"__esModule",{value:!0});ho.default=ac});var Vh=require("node:util");var zc;function g(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];d in a||(a[d]=u[d].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var iS=Symbol("zod_brand"),Ve=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},jt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(zc=globalThis).__zod_globalConfig??(zc.__zod_globalConfig={});var Nt=globalThis.__zod_globalConfig;function Se(e){return e&&Object.assign(Nt,e),Nt}var M={};wc(M,{BIGINT_FORMAT_RANGES:()=>Pc,Class:()=>ss,NUMBER_FORMAT_RANGES:()=>ps,aborted:()=>it,allowsEval:()=>cs,assert:()=>og,assertEqual:()=>Xh,assertIs:()=>tg,assertNever:()=>rg,assertNotEqual:()=>eg,assignProp:()=>nt,base64ToUint8Array:()=>Tc,base64urlToUint8Array:()=>$g,cached:()=>Ct,captureStackTrace:()=>zo,cleanEnum:()=>vg,cleanRegex:()=>gr,clone:()=>Ce,cloneDef:()=>sg,createTransparentProxy:()=>pg,defineLazy:()=>F,esc:()=>wo,escapeRegex:()=>Qe,explicitlyAborted:()=>ds,extend:()=>mg,finalizeIssue:()=>Te,floatSafeRemainder:()=>is,getElementAtPath:()=>ig,getEnumValues:()=>mr,getLengthableOrigin:()=>_r,getParsedType:()=>lg,getSizableOrigin:()=>Ec,hexToUint8Array:()=>wg,isObject:()=>vt,isPlainObject:()=>st,issue:()=>Zt,joinValues:()=>bo,jsonStringifyReplacer:()=>At,merge:()=>gg,mergeDefs:()=>Be,normalizeParams:()=>E,nullish:()=>hr,numKeys:()=>ug,objectClone:()=>ng,omit:()=>fg,optionalKeys:()=>ls,parsedType:()=>fs,partial:()=>_g,pick:()=>dg,prefixIssues:()=>Ye,primitiveTypes:()=>kc,promiseAllObject:()=>ag,propertyKeyTypes:()=>us,randomString:()=>cg,required:()=>yg,safeExtend:()=>hg,shallowClone:()=>Sc,slugify:()=>as,stringifyPrimitive:()=>xo,uint8ArrayToBase64:()=>Rc,uint8ArrayToBase64url:()=>bg,uint8ArrayToHex:()=>zg,unwrapMessage:()=>fr});function Xh(e){return e}function eg(e){return e}function tg(e){}function rg(e){throw new Error("Unexpected value in exhaustive check")}function og(e){}function mr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function bo(e,t="|"){return e.map(r=>xo(r)).join(t)}function At(e,t){return typeof t=="bigint"?t.toString():t}function Ct(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function hr(e){return e==null}function gr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function is(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var xc=Symbol("evaluating");function F(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==xc)return o===void 0&&(o=xc,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ng(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function nt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Be(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function sg(e){return Be(e._zod.def)}function ig(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function ag(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function cg(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function wo(e){return JSON.stringify(e)}function as(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var zo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var cs=Ct(()=>{if(Nt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function st(e){if(vt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(vt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sc(e){return st(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ug(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var lg=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},us=new Set(["string","number","symbol"]),kc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function E(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function pg(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function xo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ls(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ps={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function dg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Be(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return nt(this,"shape",i),i},checks:[]});return Ce(e,s)}function fg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Be(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return nt(this,"shape",i),i},checks:[]});return Ce(e,s)}function mg(e,t){if(!st(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Be(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return nt(this,"shape",s),s}});return Ce(e,n)}function hg(e,t){if(!st(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Be(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return nt(this,"shape",o),o}});return Ce(e,r)}function gg(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Be(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return nt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ce(e,r)}function _g(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Be(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return nt(this,"shape",c),c},checks:[]});return Ce(t,i)}function yg(e,t,r){let o=Be(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return nt(this,"shape",s),s}});return Ce(t,o)}function it(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ds(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ye(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function fr(e){return typeof e=="string"?e:e?.message}function Te(e,t,r){let o=e.message?e.message:fr(e.inst?._zod.def?.error?.(e))??fr(t?.error?.(e))??fr(r.customError?.(e))??fr(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function Ec(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function _r(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fs(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Zt(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function vg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Tc(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Rc(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function $g(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Tc(t+r)}function bg(e){return Rc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function zg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ss=class{constructor(...t){}};var Ic=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,At,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},So=g("$ZodError",Ic),ms=g("$ZodError",Ic,{Parent:Error});function Oc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function jc(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var ko=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ve;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Te(c,s,Se())));throw zo(a,n?.callee),a}return i.value};var Po=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Te(c,s,Se())));throw zo(a,n?.callee),a}return i.value};var yr=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Ve;return s.issues.length?{success:!1,error:new(e??So)(s.issues.map(i=>Te(i,n,Se())))}:{success:!0,data:s.value}},vr=yr(ms),$r=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Te(i,n,Se())))}:{success:!0,data:s.value}},Eo=$r(ms),Nc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ko(e)(t,r,n)};var Ac=e=>(t,r,o)=>ko(e)(t,r,o);var Cc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Po(e)(t,r,n)};var Zc=e=>async(t,r,o)=>Po(e)(t,r,o);var Mc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yr(e)(t,r,n)};var qc=e=>(t,r,o)=>yr(e)(t,r,o);var Dc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return $r(e)(t,r,n)};var Lc=e=>async(t,r,o)=>$r(e)(t,r,o);var Fc=/^[cC][0-9a-z]{6,}$/,Uc=/^[0-9a-z]+$/,Vc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Jc=/^[0-9a-vA-V]{20}$/,Gc=/^[A-Za-z0-9]{27}$/,Kc=/^[a-zA-Z0-9_-]{21}$/,Hc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Wc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hs=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Bc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Sg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qc(){return new RegExp(Sg,"u")}var Yc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var eu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ru=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^[A-Za-z0-9_-]*$/;var ou=/^https?$/,nu=/^\+[1-9]\d{6,14}$/,su="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",iu=new RegExp(`^${su}$`);function au(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cu(e){return new RegExp(`^${au(e)}$`)}function uu(e){let t=au({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${su}T(?:${o})$`)}var lu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var pu=/^-?\d+$/,_s=/^-?\d+(?:\.\d+)?$/,du=/^(?:true|false)$/i,fu=/^null$/i;var mu=/^[^A-Z]*$/,hu=/^[^a-z]*$/;var ie=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gu={number:"number",bigint:"bigint",object:"date"},ys=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);let r=gu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vs=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);let r=gu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_u=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):is(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),yu=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=ps[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=pu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var vu=g("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=_r(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$u=g("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=_r(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bu=g("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=_r(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),br=g("$ZodCheckStringFormat",(e,t)=>{var r,o;ie.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),wu=g("$ZodCheckRegex",(e,t)=>{br.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zu=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=mu),br.init(e,t)}),xu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hu),br.init(e,t)}),Su=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);let r=Qe(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ku=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`^${Qe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Pu=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`.*${Qe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Eu=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ro=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
10
+ `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
11
+ `))}};var Ru={major:4,minor:4,patch:3};var K=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ru;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=it(i),l;for(let p of a){if(p._zod.def.when){if(ds(i)||!p._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Ve;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=it(i,d)))});else{if(i.issues.length===d)continue;u||(u=it(i,d))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(it(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Ve;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ve;return c.then(u=>n(u,o,a))}return n(c,o,a)}}F(e,"~standard",()=>({validate:n=>{try{let s=vr(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Eo(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),jo=g("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lu(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),H=g("$ZodStringFormat",(e,t)=>{br.init(e,t),jo.init(e,t)}),qu=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wc),H.init(e,t)}),Du=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=hs(o))}else t.pattern??(t.pattern=hs());H.init(e,t)}),Lu=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bc),H.init(e,t)}),Fu=g("$ZodURL",(e,t)=>{H.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===ou.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Uu=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qc()),H.init(e,t)}),Vu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Kc),H.init(e,t)}),Ju=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fc),H.init(e,t)}),Gu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Uc),H.init(e,t)}),Ku=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Vc),H.init(e,t)}),Hu=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Jc),H.init(e,t)}),Wu=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gc),H.init(e,t)}),Bu=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uu(t)),H.init(e,t)}),Qu=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=iu),H.init(e,t)}),Yu=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cu(t)),H.init(e,t)}),Xu=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hc),H.init(e,t)}),el=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Yc),H.init(e,t),e._zod.bag.format="ipv4"}),tl=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xc),H.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var rl=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eu),H.init(e,t)}),ol=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tu),H.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function nl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var sl=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ru),H.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{nl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Eg(e){if(!gs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return nl(r)}var il=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gs),H.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Eg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),al=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nu),H.init(e,t)});function Tg(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var cl=g("$ZodJWT",(e,t)=>{H.init(e,t),e._zod.check=r=>{Tg(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var bs=g("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??_s,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),ul=g("$ZodNumberFormat",(e,t)=>{yu.init(e,t),bs.init(e,t)}),ll=g("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=du,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var pl=g("$ZodNull",(e,t)=>{K.init(e,t),e._zod.pattern=fu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var dl=g("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),fl=g("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Iu(e,t,r){e.issues.length&&t.issues.push(...Ye(r,e.issues)),t.value[r]=e.value}var ml=g("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Iu(u,r,i))):Iu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Oo(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...Ye(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function hl(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ls(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function gl(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let d in t){if(d==="__proto__"||a.has(d))continue;if(u==="never"){i.push(d);continue}let f=c.run({value:t[d],issues:[]},o);f instanceof Promise?e.push(f.then(m=>Oo(m,r,d,t,l,p))):Oo(f,r,d,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Rg=g("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Ct(()=>hl(t));F(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=vt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let d of i.keys){let f=p[d],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[d],issues:[]},c);y instanceof Promise?l.push(y.then(v=>Oo(v,a,d,u,m,_))):Oo(y,a,d,u,m,_)}return s?gl(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),_l=g("$ZodObjectJIT",(e,t)=>{Rg.init(e,t);let r=e._zod.parse,o=Ct(()=>hl(t)),n=d=>{let f=new Ro(["shape","payload","ctx"]),m=o.value,_=z=>{let k=wo(z);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let z of m.keys)y[z]=`key_${v++}`;f.write("const newResult = {};");for(let z of m.keys){let k=y[z],w=wo(z),xe=d[z],Ee=xe?._zod?.optin==="optional",lr=xe?._zod?.optout==="optional";f.write(`const ${k} = ${_(z)};`),Ee&&lr?f.write(`
12
+ if (${k}.issues.length) {
13
+ if (${w} in input) {
14
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
15
+ ...iss,
16
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
17
+ })));
18
+ }
19
+ }
20
+
21
+ if (${k}.value === undefined) {
22
+ if (${w} in input) {
23
+ newResult[${w}] = undefined;
24
+ }
25
+ } else {
26
+ newResult[${w}] = ${k}.value;
27
+ }
28
+
29
+ `):Ee?f.write(`
30
+ if (${k}.issues.length) {
31
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
32
+ ...iss,
33
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
34
+ })));
35
+ }
36
+
37
+ if (${k}.value === undefined) {
38
+ if (${w} in input) {
39
+ newResult[${w}] = undefined;
40
+ }
41
+ } else {
42
+ newResult[${w}] = ${k}.value;
43
+ }
44
+
45
+ `):f.write(`
46
+ const ${k}_present = ${w} in input;
47
+ if (${k}.issues.length) {
48
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
49
+ ...iss,
50
+ path: iss.path ? [${w}, ...iss.path] : [${w}]
51
+ })));
52
+ }
53
+ if (!${k}_present && !${k}.issues.length) {
54
+ payload.issues.push({
55
+ code: "invalid_type",
56
+ expected: "nonoptional",
57
+ input: undefined,
58
+ path: [${w}]
59
+ });
60
+ }
61
+
62
+ if (${k}_present) {
63
+ if (${k}.value === undefined) {
64
+ newResult[${w}] = undefined;
65
+ } else {
66
+ newResult[${w}] = ${k}.value;
67
+ }
68
+ }
69
+
70
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(z,k)=>P(d,z,k)},s,i=vt,a=!Nt.jitless,u=a&&cs.value,l=t.catchall,p;e._zod.parse=(d,f)=>{p??(p=o.value);let m=d.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(t.shape)),d=s(d,f),l?gl([],m,d,f,p,e):d):r(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d)}});function Ou(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!it(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Te(i,o,Se())))}),t)}var ws=g("$ZodUnion",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),F(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),F(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),F(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>gr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Ou(a,o,e,n)):Ou(i,o,e,n)}});var yl=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ws.init(e,t);let r=e._zod.parse;F(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Ct(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!vt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),vl=g("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ju(r,c,u)):ju(r,s,i)}});function $s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(st(e)&&st(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=$s(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=$s(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ju(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),it(e))return e;let i=$s(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var $l=g("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!st(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Te(f,o,Se())),input:u,path:[u],inst:e});continue}let p=l.value,d=t.valueType._zod.run({value:n[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[p]=f.value})):(d.issues.length&&r.issues.push(...Ye(u,d.issues)),r.value[p]=d.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&_s.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Te(p,o,Se())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...Ye(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...Ye(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var bl=g("$ZodEnum",(e,t)=>{K.init(e,t);let r=mr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>us.has(typeof n)).map(n=>typeof n=="string"?Qe(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),wl=g("$ZodLiteral",(e,t)=>{if(K.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Qe(o):o?Qe(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var zl=g("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jt(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Ve;return r.value=n,r.fallback=!0,r}});function Nu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var zs=g("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),F(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Nu(i,n)):Nu(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),xl=g("$ZodExactOptional",(e,t)=>{zs.init(e,t),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Sl=g("$ZodNullable",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.innerType._zod.optin),F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)}|null)$`):void 0}),F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),kl=g("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Au(s,t)):Au(n,t)}});function Au(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Pl=g("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),El=g("$ZodNonOptional",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Cu(s,e)):Cu(n,e)}});function Cu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Tl=g("$ZodCatch",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Te(i,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Te(s,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var xs=g("$ZodPipe",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>t.in._zod.values),F(e._zod,"optin",()=>t.in._zod.optin),F(e._zod,"optout",()=>t.out._zod.optout),F(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Io(i,t.in,o)):Io(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Io(s,t.out,o)):Io(n,t.out,o)}});function Io(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Rl=g("$ZodPreprocess",(e,t)=>{xs.init(e,t)}),Il=g("$ZodReadonly",(e,t)=>{K.init(e,t),F(e._zod,"propValues",()=>t.innerType._zod.propValues),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"optin",()=>t.innerType?._zod?.optin),F(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Zu):Zu(n)}});function Zu(e){return e.value=Object.freeze(e.value),e}var Ol=g("$ZodCustom",(e,t)=>{ie.init(e,t),K.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Mu(s,r,o,e));Mu(n,r,o,e)}});function Mu(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Zt(n))}}var Ig=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=fs(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${xo(n.values[0])}`:`Invalid option: expected one of ${bo(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${bo(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function jl(){return{localeError:Ig()}}var Nl,wS=Symbol("ZodOutput"),zS=Symbol("ZodInput"),Ss=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Og(){return new Ss}(Nl=globalThis).__zod_globalRegistry??(Nl.__zod_globalRegistry=Og());var $t=globalThis.__zod_globalRegistry;function Al(e,t){return new e({type:"string",...E(t)})}function Cl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function ks(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function Zl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function Ml(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function Dl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function Ll(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function Fl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function Ul(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function Vl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function Jl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function Gl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function Kl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function Hl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function Wl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function Bl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Ql(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Yl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Xl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function ep(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function tp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function rp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function op(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function np(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function sp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function ip(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function ap(e,t){return new e({type:"number",checks:[],...E(t)})}function cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function up(e,t){return new e({type:"boolean",...E(t)})}function lp(e,t){return new e({type:"null",...E(t)})}function pp(e){return new e({type:"unknown"})}function dp(e,t){return new e({type:"never",...E(t)})}function No(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!1})}function wr(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!0})}function Ao(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!1})}function zr(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!0})}function Co(e,t){return new _u({check:"multiple_of",...E(t),value:e})}function Zo(e,t){return new vu({check:"max_length",...E(t),maximum:e})}function Mt(e,t){return new $u({check:"min_length",...E(t),minimum:e})}function Mo(e,t){return new bu({check:"length_equals",...E(t),length:e})}function Ps(e,t){return new wu({check:"string_format",format:"regex",...E(t),pattern:e})}function Es(e){return new zu({check:"string_format",format:"lowercase",...E(e)})}function Ts(e){return new xu({check:"string_format",format:"uppercase",...E(e)})}function Rs(e,t){return new Su({check:"string_format",format:"includes",...E(t),includes:e})}function Is(e,t){return new ku({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Os(e,t){return new Pu({check:"string_format",format:"ends_with",...E(t),suffix:e})}function at(e){return new Eu({check:"overwrite",tx:e})}function js(e){return at(t=>t.normalize(e))}function Ns(){return at(e=>e.trim())}function As(){return at(e=>e.toLowerCase())}function Cs(){return at(e=>e.toUpperCase())}function Zs(){return at(e=>as(e))}function fp(e,t,r){return new e({type:"array",element:t,...E(r)})}function mp(e,t,r){let o=E(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function hp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function gp(e,t){let r=jg(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Zt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Zt(s))}},e(o.value,o)),t);return r}function jg(e,t){let r=new ie({check:"custom",...E(t)});return r._zod.check=e,r}function Ms(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$t,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let d=i.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,d,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&he(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function qs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,d=e.external.uri??(m=>m);if(p)return{ref:d(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
71
+
72
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ds(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let d=a._zod.parent;if(d&&d!==p){o(d);let f=e.seen.get(d);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:xr(t,"input",e.processors),output:xr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return he(o.element,r);if(o.type==="set")return he(o.valueType,r);if(o.type==="lazy")return he(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return he(o.innerType,r);if(o.type==="intersection")return he(o.left,r)||he(o.right,r);if(o.type==="record"||o.type==="map")return he(o.keyType,r)||he(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:he(o.in,r)||he(o.out,r);if(o.type==="object"){for(let n in o.shape)if(he(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(he(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(he(n,r))return!0;return!!(o.rest&&he(o.rest,r))}return!1}var _p=(e,t={})=>r=>{let o=Ms({...r,processors:t});return re(e,o),qs(o,e),Ds(o,e)},xr=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Ms({...n??{},target:s,io:t,processors:r});return re(e,i),qs(i,e),Ds(i,e)};var Ng={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Ng[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},vp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),d?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},$p=(e,t,r,o)=>{r.type="boolean"};var bp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var wp=(e,t,r,o)=>{r.not={}};var zp=(e,t,r,o)=>{};var xp=(e,t,r,o)=>{let n=e._zod.def,s=mr(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Sp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var kp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Pp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ep=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,t,{...o,path:[...o.path,"items"]})},Tp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Rp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Ip=(e,t,r,o)=>{let n=e._zod.def,s=re(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Op=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},jp=(e,t,r,o)=>{let n=e._zod.def,s=re(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Np=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ap=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Cp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Zp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Mp=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;re(i,t,o);let a=t.seen.get(e);a.ref=i},qp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var Ls=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};function qt(e){return!!e._zod}function ct(e,t){return qt(e)?vr(e,t):e.safeParse(t)}function qo(e){if(!e)return;let t;if(qt(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Dp(e){if(qt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o}var kr={};wc(kr,{ZodISODate:()=>Fp,ZodISODateTime:()=>Lp,ZodISODuration:()=>Vp,ZodISOTime:()=>Up,date:()=>Us,datetime:()=>Fs,duration:()=>Js,time:()=>Vs});var Lp=g("ZodISODateTime",(e,t)=>{Bu.init(e,t),Y.init(e,t)});function Fs(e){return op(Lp,e)}var Fp=g("ZodISODate",(e,t)=>{Qu.init(e,t),Y.init(e,t)});function Us(e){return np(Fp,e)}var Up=g("ZodISOTime",(e,t)=>{Yu.init(e,t),Y.init(e,t)});function Vs(e){return sp(Up,e)}var Vp=g("ZodISODuration",(e,t)=>{Xu.init(e,t),Y.init(e,t)});function Js(e){return ip(Vp,e)}var Ug=(e,t)=>{So.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>jc(e,r)},flatten:{value:r=>Oc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,At,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,At,2)}},isEmpty:{get(){return e.issues.length===0}}})};var ke=g("ZodError",Ug,{Parent:Error});var Jp=ko(ke),Gp=Po(ke),Kp=yr(ke),Hp=$r(ke),Wp=Nc(ke),Bp=Ac(ke),Qp=Cc(ke),Yp=Zc(ke),Xp=Mc(ke),ed=qc(ke),td=Dc(ke),rd=Lc(ke);var od=new WeakMap;function Pr(e,t,r){let o=Object.getPrototypeOf(e),n=od.get(o);if(n||(n=new Set,od.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(e,t)=>(K.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:xr(e,"input"),output:xr(e,"output")}}),e.toJSONSchema=_p(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Jp(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Kp(e,r,o),e.parseAsync=async(r,o)=>Gp(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Hp(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Wp(e,r,o),e.decode=(r,o)=>Bp(e,r,o),e.encodeAsync=async(r,o)=>Qp(e,r,o),e.decodeAsync=async(r,o)=>Yp(e,r,o),e.safeEncode=(r,o)=>Xp(e,r,o),e.safeDecode=(r,o)=>ed(e,r,o),e.safeEncodeAsync=async(r,o)=>td(e,r,o),e.safeDecodeAsync=async(r,o)=>rd(e,r,o),Pr(e,"ZodType",{check(...r){let o=this.def;return this.clone(M.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ce(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(j_(r,o))},superRefine(r,o){return this.check(N_(r,o))},overwrite(r){return this.check(at(r))},optional(){return ee(this)},exactOptional(){return b_(this)},nullable(){return ad(this)},nullish(){return ee(ad(this))},nonoptional(r){return P_(this,r)},array(){return C(this)},or(r){return W([this,r])},and(r){return Lo(this,r)},transform(r){return cd(this,md(r))},default(r){return x_(this,r)},prefault(r){return k_(this,r)},catch(r){return T_(this,r)},pipe(r){return cd(this,r)},readonly(){return O_(this)},describe(r){let o=this.clone();return $t.add(o,{description:r}),o},meta(...r){if(r.length===0)return $t.get(this);let o=this.clone();return $t.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return $t.get(e)?.description},configurable:!0}),e)),ud=g("_ZodString",(e,t)=>{jo.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>yp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Pr(e,"_ZodString",{regex(...o){return this.check(Ps(...o))},includes(...o){return this.check(Rs(...o))},startsWith(...o){return this.check(Is(...o))},endsWith(...o){return this.check(Os(...o))},min(...o){return this.check(Mt(...o))},max(...o){return this.check(Zo(...o))},length(...o){return this.check(Mo(...o))},nonempty(...o){return this.check(Mt(1,...o))},lowercase(o){return this.check(Es(o))},uppercase(o){return this.check(Ts(o))},trim(){return this.check(Ns())},normalize(...o){return this.check(js(...o))},toLowerCase(){return this.check(As())},toUpperCase(){return this.check(Cs())},slugify(){return this.check(Zs())}})}),Jg=g("ZodString",(e,t)=>{jo.init(e,t),ud.init(e,t),e.email=r=>e.check(Cl(Gg,r)),e.url=r=>e.check(Ll(Kg,r)),e.jwt=r=>e.check(rp(c_,r)),e.emoji=r=>e.check(Fl(Hg,r)),e.guid=r=>e.check(ks(nd,r)),e.uuid=r=>e.check(Zl(Do,r)),e.uuidv4=r=>e.check(Ml(Do,r)),e.uuidv6=r=>e.check(ql(Do,r)),e.uuidv7=r=>e.check(Dl(Do,r)),e.nanoid=r=>e.check(Ul(Wg,r)),e.guid=r=>e.check(ks(nd,r)),e.cuid=r=>e.check(Vl(Bg,r)),e.cuid2=r=>e.check(Jl(Qg,r)),e.ulid=r=>e.check(Gl(Yg,r)),e.base64=r=>e.check(Xl(s_,r)),e.base64url=r=>e.check(ep(i_,r)),e.xid=r=>e.check(Kl(Xg,r)),e.ksuid=r=>e.check(Hl(e_,r)),e.ipv4=r=>e.check(Wl(t_,r)),e.ipv6=r=>e.check(Bl(r_,r)),e.cidrv4=r=>e.check(Ql(o_,r)),e.cidrv6=r=>e.check(Yl(n_,r)),e.e164=r=>e.check(tp(a_,r)),e.datetime=r=>e.check(Fs(r)),e.date=r=>e.check(Us(r)),e.time=r=>e.check(Vs(r)),e.duration=r=>e.check(Js(r))});function h(e){return Al(Jg,e)}var Y=g("ZodStringFormat",(e,t)=>{H.init(e,t),ud.init(e,t)}),Gg=g("ZodEmail",(e,t)=>{Lu.init(e,t),Y.init(e,t)});var nd=g("ZodGUID",(e,t)=>{qu.init(e,t),Y.init(e,t)});var Do=g("ZodUUID",(e,t)=>{Du.init(e,t),Y.init(e,t)});var Kg=g("ZodURL",(e,t)=>{Fu.init(e,t),Y.init(e,t)});var Hg=g("ZodEmoji",(e,t)=>{Uu.init(e,t),Y.init(e,t)});var Wg=g("ZodNanoID",(e,t)=>{Vu.init(e,t),Y.init(e,t)});var Bg=g("ZodCUID",(e,t)=>{Ju.init(e,t),Y.init(e,t)});var Qg=g("ZodCUID2",(e,t)=>{Gu.init(e,t),Y.init(e,t)});var Yg=g("ZodULID",(e,t)=>{Ku.init(e,t),Y.init(e,t)});var Xg=g("ZodXID",(e,t)=>{Hu.init(e,t),Y.init(e,t)});var e_=g("ZodKSUID",(e,t)=>{Wu.init(e,t),Y.init(e,t)});var t_=g("ZodIPv4",(e,t)=>{el.init(e,t),Y.init(e,t)});var r_=g("ZodIPv6",(e,t)=>{tl.init(e,t),Y.init(e,t)});var o_=g("ZodCIDRv4",(e,t)=>{rl.init(e,t),Y.init(e,t)});var n_=g("ZodCIDRv6",(e,t)=>{ol.init(e,t),Y.init(e,t)});var s_=g("ZodBase64",(e,t)=>{sl.init(e,t),Y.init(e,t)});var i_=g("ZodBase64URL",(e,t)=>{il.init(e,t),Y.init(e,t)});var a_=g("ZodE164",(e,t)=>{al.init(e,t),Y.init(e,t)});var c_=g("ZodJWT",(e,t)=>{cl.init(e,t),Y.init(e,t)});var ld=g("ZodNumber",(e,t)=>{bs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>vp(e,o,n,s),Pr(e,"ZodNumber",{gt(o,n){return this.check(Ao(o,n))},gte(o,n){return this.check(zr(o,n))},min(o,n){return this.check(zr(o,n))},lt(o,n){return this.check(No(o,n))},lte(o,n){return this.check(wr(o,n))},max(o,n){return this.check(wr(o,n))},int(o){return this.check(sd(o))},safe(o){return this.check(sd(o))},positive(o){return this.check(Ao(0,o))},nonnegative(o){return this.check(zr(0,o))},negative(o){return this.check(No(0,o))},nonpositive(o){return this.check(wr(0,o))},multipleOf(o,n){return this.check(Co(o,n))},step(o,n){return this.check(Co(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return ap(ld,e)}var u_=g("ZodNumberFormat",(e,t)=>{ul.init(e,t),ld.init(e,t)});function sd(e){return cp(u_,e)}var l_=g("ZodBoolean",(e,t)=>{ll.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$p(e,r,o,n)});function se(e){return up(l_,e)}var p_=g("ZodNull",(e,t)=>{pl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bp(e,r,o,n)});function pd(e){return lp(p_,e)}var d_=g("ZodUnknown",(e,t)=>{dl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zp(e,r,o,n)});function X(){return pp(d_)}var f_=g("ZodNever",(e,t)=>{fl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wp(e,r,o,n)});function m_(e){return dp(f_,e)}var h_=g("ZodArray",(e,t)=>{ml.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ep(e,r,o,n),e.element=t.element,Pr(e,"ZodArray",{min(r,o){return this.check(Mt(r,o))},nonempty(r){return this.check(Mt(1,r))},max(r,o){return this.check(Zo(r,o))},length(r,o){return this.check(Mo(r,o))},unwrap(){return this.element}})});function C(e,t){return fp(h_,e,t)}var dd=g("ZodObject",(e,t)=>{_l.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),M.defineLazy(e,"shape",()=>t.shape),Pr(e,"ZodObject",{keyof(){return ve(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:m_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(hd,this,r[0])},required(...r){return M.required(gd,this,r[0])}})});function b(e,t){let r={type:"object",shape:e??{},...M.normalizeParams(t)};return new dd(r)}function ge(e,t){return new dd({type:"object",shape:e,catchall:X(),...M.normalizeParams(t)})}var fd=g("ZodUnion",(e,t)=>{ws.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n),e.options=t.options});function W(e,t){return new fd({type:"union",options:e,...M.normalizeParams(t)})}var g_=g("ZodDiscriminatedUnion",(e,t)=>{fd.init(e,t),yl.init(e,t)});function Ks(e,t,r){return new g_({type:"union",options:t,discriminator:e,...M.normalizeParams(r)})}var __=g("ZodIntersection",(e,t)=>{vl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n)});function Lo(e,t){return new __({type:"intersection",left:e,right:t})}var id=g("ZodRecord",(e,t)=>{$l.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,r){return!t||!t._zod?new id({type:"record",keyType:h(),valueType:e,...M.normalizeParams(t)}):new id({type:"record",keyType:e,valueType:t,...M.normalizeParams(r)})}var Gs=g("ZodEnum",(e,t)=>{bl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>xp(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Gs({...t,checks:[],...M.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Gs({...t,checks:[],...M.normalizeParams(n),entries:s})}});function ve(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Gs({type:"enum",entries:r,...M.normalizeParams(t)})}var y_=g("ZodLiteral",(e,t)=>{wl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function x(e,t){return new y_({type:"literal",values:Array.isArray(e)?e:[e],...M.normalizeParams(t)})}var v_=g("ZodTransform",(e,t)=>{zl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(M.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(M.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function md(e){return new v_({type:"transform",transform:e})}var hd=g("ZodOptional",(e,t)=>{zs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ee(e){return new hd({type:"optional",innerType:e})}var $_=g("ZodExactOptional",(e,t)=>{xl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function b_(e){return new $_({type:"optional",innerType:e})}var w_=g("ZodNullable",(e,t)=>{Sl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ad(e){return new w_({type:"nullable",innerType:e})}var z_=g("ZodDefault",(e,t)=>{kl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function x_(e,t){return new z_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var S_=g("ZodPrefault",(e,t)=>{Pl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function k_(e,t){return new S_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var gd=g("ZodNonOptional",(e,t)=>{El.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function P_(e,t){return new gd({type:"nonoptional",innerType:e,...M.normalizeParams(t)})}var E_=g("ZodCatch",(e,t)=>{Tl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function T_(e,t){return new E_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var _d=g("ZodPipe",(e,t)=>{xs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mp(e,r,o,n),e.in=t.in,e.out=t.out});function cd(e,t){return new _d({type:"pipe",in:e,out:t})}var R_=g("ZodPreprocess",(e,t)=>{_d.init(e,t),Rl.init(e,t)}),I_=g("ZodReadonly",(e,t)=>{Il.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function O_(e){return new I_({type:"readonly",innerType:e})}var yd=g("ZodCustom",(e,t)=>{Ol.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n)});function vd(e,t){return mp(yd,e??(()=>!0),t)}function j_(e,t={}){return hp(yd,e,t)}function N_(e,t){return gp(e,t)}function Hs(e,t){return new R_({type:"pipe",in:md(e),out:t})}Se(jl());var Bs="2025-11-25";var $d=[Bs,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ut="io.modelcontextprotocol/related-task",Uo="2.0",ne=vd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),bd=W([h(),U().int()]),wd=h(),EP=ge({ttl:U().optional(),pollInterval:U().optional()}),A_=b({ttl:U().optional()}),C_=b({taskId:h()}),Qs=ge({progressToken:bd.optional(),[ut]:C_.optional()}),Pe=b({_meta:Qs.optional()}),Er=Pe.extend({task:A_.optional()}),zd=e=>Er.safeParse(e).success,ae=b({method:h(),params:Pe.loose().optional()}),Re=b({_meta:Qs.optional()}),Ie=b({method:h(),params:Re.loose().optional()}),ce=ge({_meta:Qs.optional()}),Vo=W([h(),U().int()]),xd=b({jsonrpc:x(Uo),id:Vo,...ae.shape}).strict(),Ys=e=>xd.safeParse(e).success,Sd=b({jsonrpc:x(Uo),...Ie.shape}).strict(),kd=e=>Sd.safeParse(e).success,Xs=b({jsonrpc:x(Uo),id:Vo,result:ce}).strict(),Tr=e=>Xs.safeParse(e).success;var A;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(A||(A={}));var ei=b({jsonrpc:x(Uo),id:Vo.optional(),error:b({code:U().int(),message:h(),data:X().optional()})}).strict();var Pd=e=>ei.safeParse(e).success;var Ed=W([xd,Sd,Xs,ei]),TP=W([Xs,ei]),Jo=ce.strict(),Z_=Re.extend({requestId:Vo.optional(),reason:h().optional()}),Go=Ie.extend({method:x("notifications/cancelled"),params:Z_}),M_=b({src:h(),mimeType:h().optional(),sizes:C(h()).optional(),theme:ve(["light","dark"]).optional()}),Rr=b({icons:C(M_).optional()}),Dt=b({name:h(),title:h().optional()}),Td=Dt.extend({...Dt.shape,...Rr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),q_=Lo(b({applyDefaults:se().optional()}),G(h(),X())),D_=Hs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Lo(b({form:q_.optional(),url:ne.optional()}),G(h(),X()).optional())),L_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),F_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),U_=b({experimental:G(h(),ne).optional(),sampling:b({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:D_.optional(),roots:b({listChanged:se().optional()}).optional(),tasks:L_.optional(),extensions:G(h(),ne).optional()}),V_=Pe.extend({protocolVersion:h(),capabilities:U_,clientInfo:Td}),ti=ae.extend({method:x("initialize"),params:V_});var J_=b({experimental:G(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:b({listChanged:se().optional()}).optional(),resources:b({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:b({listChanged:se().optional()}).optional(),tasks:F_.optional(),extensions:G(h(),ne).optional()}),G_=ce.extend({protocolVersion:h(),capabilities:J_,serverInfo:Td,instructions:h().optional()}),ri=Ie.extend({method:x("notifications/initialized"),params:Re.optional()});var Ko=ae.extend({method:x("ping"),params:Pe.optional()}),K_=b({progress:U(),total:ee(U()),message:ee(h())}),H_=b({...Re.shape,...K_.shape,progressToken:bd}),Ho=Ie.extend({method:x("notifications/progress"),params:H_}),W_=Pe.extend({cursor:wd.optional()}),Ir=ae.extend({params:W_.optional()}),Or=ce.extend({nextCursor:wd.optional()}),B_=ve(["working","input_required","completed","failed","cancelled"]),jr=b({taskId:h(),status:B_,ttl:W([U(),pd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(U()),statusMessage:ee(h())}),Lt=ce.extend({task:jr}),Q_=Re.merge(jr),Nr=Ie.extend({method:x("notifications/tasks/status"),params:Q_}),Wo=ae.extend({method:x("tasks/get"),params:Pe.extend({taskId:h()})}),Bo=ce.merge(jr),Qo=ae.extend({method:x("tasks/result"),params:Pe.extend({taskId:h()})}),RP=ce.loose(),Yo=Ir.extend({method:x("tasks/list")}),Xo=Or.extend({tasks:C(jr)}),en=ae.extend({method:x("tasks/cancel"),params:Pe.extend({taskId:h()})}),Rd=ce.merge(jr),Id=b({uri:h(),mimeType:ee(h()),_meta:G(h(),X()).optional()}),Od=Id.extend({text:h()}),oi=h().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jd=Id.extend({blob:oi}),Ar=ve(["user","assistant"]),Ft=b({audience:C(Ar).optional(),priority:U().min(0).max(1).optional(),lastModified:kr.datetime({offset:!0}).optional()}),Nd=b({...Dt.shape,...Rr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(U()),annotations:Ft.optional(),_meta:ee(ge({}))}),Y_=b({...Dt.shape,...Rr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Ft.optional(),_meta:ee(ge({}))}),X_=Ir.extend({method:x("resources/list")}),ey=Or.extend({resources:C(Nd)}),ty=Ir.extend({method:x("resources/templates/list")}),ry=Or.extend({resourceTemplates:C(Y_)}),ni=Pe.extend({uri:h()}),oy=ni,ny=ae.extend({method:x("resources/read"),params:oy}),sy=ce.extend({contents:C(W([Od,jd]))}),iy=Ie.extend({method:x("notifications/resources/list_changed"),params:Re.optional()}),ay=ni,cy=ae.extend({method:x("resources/subscribe"),params:ay}),uy=ni,ly=ae.extend({method:x("resources/unsubscribe"),params:uy}),py=Re.extend({uri:h()}),dy=Ie.extend({method:x("notifications/resources/updated"),params:py}),fy=b({name:h(),description:ee(h()),required:ee(se())}),my=b({...Dt.shape,...Rr.shape,description:ee(h()),arguments:ee(C(fy)),_meta:ee(ge({}))}),hy=Ir.extend({method:x("prompts/list")}),gy=Or.extend({prompts:C(my)}),_y=Pe.extend({name:h(),arguments:G(h(),h()).optional()}),yy=ae.extend({method:x("prompts/get"),params:_y}),si=b({type:x("text"),text:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),ii=b({type:x("image"),data:oi,mimeType:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),ai=b({type:x("audio"),data:oi,mimeType:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),vy=b({type:x("tool_use"),name:h(),id:h(),input:G(h(),X()),_meta:G(h(),X()).optional()}),$y=b({type:x("resource"),resource:W([Od,jd]),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),by=Nd.extend({type:x("resource_link")}),ci=W([si,ii,ai,by,$y]),wy=b({role:Ar,content:ci}),zy=ce.extend({description:h().optional(),messages:C(wy)}),xy=Ie.extend({method:x("notifications/prompts/list_changed"),params:Re.optional()}),Sy=b({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),ky=b({taskSupport:ve(["required","optional","forbidden"]).optional()}),Ad=b({...Dt.shape,...Rr.shape,description:h().optional(),inputSchema:b({type:x("object"),properties:G(h(),ne).optional(),required:C(h()).optional()}).catchall(X()),outputSchema:b({type:x("object"),properties:G(h(),ne).optional(),required:C(h()).optional()}).catchall(X()).optional(),annotations:Sy.optional(),execution:ky.optional(),_meta:G(h(),X()).optional()}),ui=Ir.extend({method:x("tools/list")}),Py=Or.extend({tools:C(Ad)}),tn=ce.extend({content:C(ci).default([]),structuredContent:G(h(),X()).optional(),isError:se().optional()}),IP=tn.or(ce.extend({toolResult:X()})),Ey=Er.extend({name:h(),arguments:G(h(),X()).optional()}),Cr=ae.extend({method:x("tools/call"),params:Ey}),Ty=Ie.extend({method:x("notifications/tools/list_changed"),params:Re.optional()}),OP=b({autoRefresh:se().default(!0),debounceMs:U().int().nonnegative().default(300)}),Zr=ve(["debug","info","notice","warning","error","critical","alert","emergency"]),Ry=Pe.extend({level:Zr}),li=ae.extend({method:x("logging/setLevel"),params:Ry}),Iy=Re.extend({level:Zr,logger:h().optional(),data:X()}),Oy=Ie.extend({method:x("notifications/message"),params:Iy}),jy=b({name:h().optional()}),Ny=b({hints:C(jy).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Ay=b({mode:ve(["auto","required","none"]).optional()}),Cy=b({type:x("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:C(ci).default([]),structuredContent:b({}).loose().optional(),isError:se().optional(),_meta:G(h(),X()).optional()}),Zy=Ks("type",[si,ii,ai]),Fo=Ks("type",[si,ii,ai,vy,Cy]),My=b({role:Ar,content:W([Fo,C(Fo)]),_meta:G(h(),X()).optional()}),qy=Er.extend({messages:C(My),modelPreferences:Ny.optional(),systemPrompt:h().optional(),includeContext:ve(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:C(h()).optional(),metadata:ne.optional(),tools:C(Ad).optional(),toolChoice:Ay.optional()}),Dy=ae.extend({method:x("sampling/createMessage"),params:qy}),Mr=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens"]).or(h())),role:Ar,content:Zy}),pi=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Ar,content:W([Fo,C(Fo)])}),Ly=b({type:x("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),Fy=b({type:x("string"),title:h().optional(),description:h().optional(),minLength:U().optional(),maxLength:U().optional(),format:ve(["email","uri","date","date-time"]).optional(),default:h().optional()}),Uy=b({type:ve(["number","integer"]),title:h().optional(),description:h().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Vy=b({type:x("string"),title:h().optional(),description:h().optional(),enum:C(h()),default:h().optional()}),Jy=b({type:x("string"),title:h().optional(),description:h().optional(),oneOf:C(b({const:h(),title:h()})),default:h().optional()}),Gy=b({type:x("string"),title:h().optional(),description:h().optional(),enum:C(h()),enumNames:C(h()).optional(),default:h().optional()}),Ky=W([Vy,Jy]),Hy=b({type:x("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({type:x("string"),enum:C(h())}),default:C(h()).optional()}),Wy=b({type:x("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({anyOf:C(b({const:h(),title:h()}))}),default:C(h()).optional()}),By=W([Hy,Wy]),Qy=W([Gy,Ky,By]),Yy=W([Qy,Ly,Fy,Uy]),Xy=Er.extend({mode:x("form").optional(),message:h(),requestedSchema:b({type:x("object"),properties:G(h(),Yy),required:C(h()).optional()})}),ev=Er.extend({mode:x("url"),message:h(),elicitationId:h(),url:h().url()}),tv=W([Xy,ev]),rv=ae.extend({method:x("elicitation/create"),params:tv}),ov=Re.extend({elicitationId:h()}),nv=Ie.extend({method:x("notifications/elicitation/complete"),params:ov}),Ut=ce.extend({action:ve(["accept","decline","cancel"]),content:Hs(e=>e===null?void 0:e,G(h(),W([h(),U(),se(),C(h())])).optional())}),sv=b({type:x("ref/resource"),uri:h()});var iv=b({type:x("ref/prompt"),name:h()}),av=Pe.extend({ref:W([iv,sv]),argument:b({name:h(),value:h()}),context:b({arguments:G(h(),h()).optional()}).optional()}),cv=ae.extend({method:x("completion/complete"),params:av});var uv=ce.extend({completion:ge({values:C(h()).max(100),total:ee(U().int()),hasMore:ee(se())})}),lv=b({uri:h().startsWith("file://"),name:h().optional(),_meta:G(h(),X()).optional()}),pv=ae.extend({method:x("roots/list"),params:Pe.optional()}),di=ce.extend({roots:C(lv)}),dv=Ie.extend({method:x("notifications/roots/list_changed"),params:Re.optional()}),jP=W([Ko,ti,cv,li,yy,hy,X_,ty,ny,cy,ly,Cr,ui,Wo,Qo,Yo,en]),NP=W([Go,Ho,ri,dv,Nr]),AP=W([Jo,Mr,pi,Ut,di,Bo,Xo,Lt]),CP=W([Ko,Dy,rv,pv,Wo,Qo,Yo,en]),ZP=W([Go,Ho,Oy,dy,iy,Ty,xy,Nr,nv]),MP=W([Jo,G_,uv,zy,gy,ey,ry,sy,tn,Py,Bo,Xo,Lt]),R=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===A.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Ws(n.elicitations,r)}return new e(t,r,o)}},Ws=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(A.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function lt(e){return e==="completed"||e==="failed"||e==="cancelled"}var fv=Symbol("Let zodToJsonSchema decide on which parser to use");var _E=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fi(e){let r=qo(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Dp(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function mi(e,t){let r=ct(e,t);if(!r.success)throw r.error;return r.data}var vv=6e4,rn=class{constructor(t){this._options=t,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(Go,r=>{this._oncancel(r)}),this.setNotificationHandler(Ho,r=>{this._onprogress(r)}),this.setRequestHandler(Ko,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Qo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let p=c,d=new R(p.error.code,p.error.message,p.error.data);l(d)}else{let p=a.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(A.InvalidParams,`Task not found: ${s}`);if(!lt(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(lt(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ut]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Yo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(A.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(en,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,`Task not found: ${r.params.taskId}`);if(lt(n.status))throw new R(A.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(A.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(A.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){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=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Tr(s)||Pd(s)?this._onresponse(s):Ys(s)?this._onrequest(s,i):kd(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(A.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[ut]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:A.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):n?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=zd(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let p={relatedRequestId:t.id};s&&(p.relatedTask={taskId:s}),await this.notification(l,p)},sendRequest:async(l,p,d)=>{if(i.signal.aborted)throw new R(A.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,p,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,u)).then(async l=>{if(i.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)},async l=>{if(i.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:A.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Tr(t))o(t);else{let i=new R(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Tr(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Tr(t))n(t);else{let i=R.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Lt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(A.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},lt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(A.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(A.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let p=P=>{l(P)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(P){p(P);return}o?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:d};o?.onprogress&&(this._progressHandlers.set(d,o.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ut]:c}});let m=P=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let z=P instanceof R?P:new R(A.RequestTimeout,String(P));l(z)};this._responseHandlers.set(d,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let z=ct(r,P.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??vv,y=()=>m(R.fromError(A.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(d,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let P=z=>{let k=this._responseHandlers.get(d);k?k(z):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,P),this._enqueueTaskMessage(v,{type:"request",message:f,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(d),l(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(d),l(P)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Bo,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Xo,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Rd,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ut]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ut]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ut]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=fi(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=mi(t,n);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let o=fi(t);this._notificationHandlers.set(o,n=>{let s=mi(t,n);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Ys(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(A.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(A.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(A.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Nr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),lt(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(A.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(lt(a.status))throw new R(A.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Nr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),lt(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Cd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Zd(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];Cd(i)&&Cd(s)?r[n]={...i,...s}:r[n]=s}return r}var Th=dr(ec(),1),Rh=dr(Eh(),1);function wx(){let e=new Th.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Rh.default)(e),e}var Mn=class{constructor(t){this._ajv=t??wx()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var qn=class{constructor(t){this._server=t}requestStream(t,r,o){return this._server.requestStream(t,r,o)}createMessageStream(t,r){let o=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(d=>d.type==="tool_use").map(d=>d.id)),p=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==p.size||![...l].every(d=>p.has(d)))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:t},Mr,r)}elicitInputStream(t,r){let o=this._server.getClientCapabilities(),n=t.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Ut,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._server.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function Ih(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Oh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Dn=class extends rn{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Zr.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Mn,this.setRequestHandler(ti,o=>this._oninitialize(o)),this.setNotificationHandler(ri,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(li,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Zr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new qn(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Zd(this._capabilities,t)}setRequestHandler(t,r){let n=qo(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(qt(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ct(Cr,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(A.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:p}=l.data,d=await Promise.resolve(r(c,u));if(p.task){let m=ct(Lt,d);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(A.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=ct(tn,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(A.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);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 ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);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 ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);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 ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Oh(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Ih(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:$d.includes(r)?r:Bs,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"},Jo)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(n.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},pi,r):this.request({method:"sampling/createMessage",params:t},Mr,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=t;return this.request({method:"elicitation/create",params:n},Ut,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:n},Ut,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(A.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(A.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,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:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},di,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var cc=dr(require("node:process"),1);var Ln=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
73
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),zx(r)}clear(){this._buffer=void 0}};function zx(e){return Ed.parse(JSON.parse(e))}function jh(e){return JSON.stringify(e)+`
74
+ `}var Fn=class{constructor(t=cc.default.stdin,r=cc.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ln,this._started=!1,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer()},this._onerror=o=>{this.onerror?.(o)}}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 t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}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(t){return new Promise(r=>{let o=jh(t);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};function go(e){return(e??"").trim().replace(/\\/g,"/").replace(/^(?:\.\.?\/)+/,"")}var xx=/\]\((\.{1,2}\/[^)\s]*)\)/g,Sx=/(?<![\w:.\-/])([0-9]{3})(?![\w-])/g;function kx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Nh="ts|tsx|js|jsx|mjs|cjs|cs|py|go",Px=new RegExp(`\\]\\(((?:\\.{1,2}/)+[^)\\s]*\\.(?:${Nh}))\\)`,"g"),Ex=/`([^`\r\n]+)`/g,Tx=new RegExp(`^\\.{0,2}/?(?:[^\\s/]+/)+[^\\s/]+\\.(?:${Nh})$`);function Rx(e){return go(e)}var Ix=/^#{2,4}\s+([A-Z][A-Za-z0-9]+)\b[^\n]*\(([^)]*(?:\.[a-z]{2,4}|:\d+|db\.types)[^)]*)\)/gm;function Ox(e){return e.trim().slice(0,100)}function uc(e){let t=new Map;for(let r of e.matchAll(xx)){let o=r[0];for(let n of r[1].split("/")){if(!n||n==="."||n==="..")continue;let s=t.get(n);t.set(n,{kind:"link",targetHint:n,evidence:s?.evidence??o,count:(s?.count??0)+1})}}return[...t.values()]}function lc(e,t,r){let o=[...new Set(t)].filter(a=>a&&a!==r);if(o.length===0||!e)return[];o.sort((a,c)=>c.length-a.length);let n=o.map(kx).join("|"),s=new RegExp(`(?<![A-Za-z0-9-])(?:${n})(?![A-Za-z0-9-])`,"g"),i=new Map;for(let a of e.matchAll(s))i.set(a[0],(i.get(a[0])??0)+1);return[...i.entries()].map(([a,c])=>({id:a,count:c}))}function pc(e){let t=new Map,r=new Map;for(let o of e.split(/\r?\n/))if(!/\bT\d{3}\b/.test(o))for(let n of o.matchAll(Sx)){let s=n[1];r.set(s,(r.get(s)??0)+1),t.has(s)||t.set(s,Ox(o))}return[...r.entries()].map(([o,n])=>({kind:"number",targetHint:o,evidence:t.get(o)??o,count:n}))}function dc(e){let t=new Map;for(let r of e.matchAll(Ix)){let o=r[1];t.has(o)||t.set(o,{kind:"entity",targetHint:o,evidence:r[0].trim().slice(0,100),count:1})}return[...t.values()]}function fc(e){let t=new Map,r=o=>{let n=Rx(o);if(!n)return;let s=t.get(n);t.set(n,{kind:"code",targetHint:n,evidence:n,count:(s?.count??0)+1})};for(let o of e.matchAll(Px))r(o[1]);for(let o of e.matchAll(Ex)){let n=o[1].trim();Tx.test(n)&&r(n)}return[...t.values()]}function Un(e){let t=typeof e?.id=="string"?e.id:"",r=typeof e?.number=="string"?e.number:null,o=[],n=e&&typeof e.files=="object"&&e.files?e.files:{},s=Array.isArray(e?.artifacts)?e.artifacts.filter(d=>typeof d=="string"):[],i=Nx(s),a=t,c=null,u=null,l=[],p="";try{let d=mc(n,"spec.md"),f=mc(n,"tasks.md"),m=mc(n,"data-model.md"),_=Object.values(n).join(`
75
+ `);p=_,a=Ax(d)??t,c=Cx(d),u=Zx(f),l=[...uc(_),...pc(_),...fc(_),...m?dc(m):[]]}catch{o.push({code:"parse-error",message:`Could not fully parse feature "${t}"; using partial data.`,featureId:t})}return{id:t,number:r,title:a,status:c,taskCompletion:u,completeness:i,references:l,warnings:o,mentionText:p}}var jx={spec:["spec"],plan:["plan"],tasks:["tasks"],research:["research"],dataModel:["data-model","datamodel","dataModel"],quickstart:["quickstart"],contracts:["contracts"],checklists:["checklists"]};function Nx(e){let t=new Set(e.map(o=>o.toLowerCase().replace(/\.md$/,""))),r=o=>jx[o].some(n=>t.has(n.toLowerCase()));return{spec:r("spec"),plan:r("plan"),tasks:r("tasks"),research:r("research"),dataModel:r("dataModel"),quickstart:r("quickstart"),contracts:r("contracts"),checklists:r("checklists")}}function mc(e,t){if(typeof e[t]=="string")return e[t];for(let[r,o]of Object.entries(e))if(r.replace(/\\/g,"/").split("/").pop()===t&&typeof o=="string")return o;return""}function Ax(e){let t=e.match(/^#\s+(?:Feature Specification:\s*)?(.+?)\s*$/m);return t?t[1].trim():null}function Cx(e){let t=e.match(/^\s*\*\*Status\*\*:\s*(.+?)\s*$/m);return t?t[1].trim():null}function Zx(e){if(!e)return null;let t=(e.match(/^\s*-\s*\[[xX]\]/gm)??[]).length,r=(e.match(/^\s*-\s*\[ \]/gm)??[]).length,o=t+r;return o===0?null:{done:t,total:o}}var hc={links:!0,slugMentions:!0,sharedEntities:!0,bareNumbers:!0,specToCode:!0};function gc(e){return{...hc,...e??{},links:!0}}var Ah={definitive:4,strong:3,medium:2,risky:1};function Jn(e,t,r,o){let n=gc(o),s=Array.isArray(r)?r.filter(d=>!!d):[],i=[],a=s.map(d=>Lx(e,d,n)),c=new Set(s.map(d=>d.id)),u=qx(s,i),l=new Map,p=new Map;for(let d of s)try{for(let f of d.references??[])switch(f.kind){case"link":Mx(f.targetHint,c,d.id)&&Vn(l,d.id,f.targetHint,"link","definitive",1,f.evidence);break;case"slug":break;case"number":if(n.bareNumbers){let m=u.get(f.targetHint);m&&m!==d.id&&Vn(l,d.id,m,"bare-number","risky",f.count,f.evidence)}break;case"entity":if(n.sharedEntities){let m=p.get(f.targetHint)??new Set;m.add(d.id),p.set(f.targetHint,m)}break;case"code":break}}catch{i.push({code:"assemble-error",message:`Skipped some edges for "${d.id}".`,featureId:d.id})}if(n.slugMentions)for(let d of s)try{for(let{id:f,count:m}of lc(d.mentionText,c,d.id))Vn(l,d.id,f,"slug-mention","strong",m,f)}catch{i.push({code:"assemble-error",message:`Skipped some mention edges for "${d.id}".`,featureId:d.id})}if(n.sharedEntities)for(let[d,f]of p){if(f.size<2)continue;let m=[...f].sort();for(let _=0;_<m.length;_++)for(let y=_+1;y<m.length;y++)Vn(l,m[_],m[y],"shared-entity","medium",1,d,!0)}for(let d of s)for(let f of d.warnings??[])i.push(f);return{projectId:e,name:t,nodes:a,edges:[...l.values()].map(Dx),warnings:i}}function Mx(e,t,r){return t.has(e)&&e!==r}function qx(e,t){let r=new Map;for(let n of e)if(n.number){let s=r.get(n.number)??[];s.push(n.id),r.set(n.number,s)}let o=new Map;for(let[n,s]of r)s.length===1?o.set(n,s[0]):t.push({code:"ambiguous-number",message:`Feature number ${n} maps to multiple features (${s.join(", ")}); no edge inferred.`,featureIds:[...s].sort((i,a)=>i.localeCompare(a))});return o}function Vn(e,t,r,o,n,s,i,a=!1){if(t===r)return;let c=`${t}\0${r}`,u=e.get(c);if(!u){e.set(c,{source:t,target:r,heuristic:o,tier:n,weight:s,evidence:[i],symmetric:a});return}u.evidence.includes(i)||u.evidence.push(i),Ah[n]>Ah[u.tier]?(u.tier=n,u.heuristic=o,u.weight=s,u.symmetric=a):n===u.tier&&(u.weight=Math.max(u.weight,s),u.symmetric=u.symmetric&&a)}function Dx(e){let t={source:e.source,target:e.target,heuristic:e.heuristic,tier:e.tier,weight:e.weight,evidence:e.evidence};return e.symmetric?{...t,symmetric:!0}:t}function Lx(e,t,r){let o={id:t.id,projectId:e,title:t.title,status:t.status,taskCompletion:t.taskCompletion,completeness:t.completeness,warnings:t.warnings??[]};if(!r.specToCode)return o;let n=[...new Set((t.references??[]).filter(s=>s.kind==="code").map(s=>s.targetHint))];return{...o,codeReferences:n}}function Gn(e,t){return{projects:(Array.isArray(e)?e:[]).filter(n=>!!n).map(n=>{let s=(n.features??[]).map(i=>Un(i));return Jn(n.projectId,n.name,s,t)})}}function _c(e){return[...e].sort((t,r)=>t.id.localeCompare(r.id))}function Kn(e){return[...e].sort((t,r)=>t.source.localeCompare(r.source)||t.target.localeCompare(r.target)||t.heuristic.localeCompare(r.heuristic))}function Hn(e){return{...e,nodes:_c(e.nodes),edges:Kn(e.edges)}}function yc(e){return{projects:[...e.projects].map(Hn).sort((r,o)=>r.projectId.localeCompare(o.projectId))}}function Fe(e,t,r){return{schemaVersion:1,kind:e,data:t,warnings:[...r]}}function _o(e,t){let r=new Set(t);return e.filter(o=>{let n=o.featureId!==void 0,s=o.featureIds!==void 0;return!n&&!s?!0:n&&r.has(o.featureId)||(o.featureIds??[]).some(i=>r.has(i))})}var Fx=/^(in)[\s-]+(progress|review)\b|^(on)[\s-]+(hold)\b|^(not)[\s-]+(started)\b/i;function Ch(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Wn(e){if(e===null)return"(none)";let t=e.trim().replace(/^[*_`\s]+/,"");if(t==="")return"(none)";let r=Fx.exec(t);if(r)return r.slice(1).filter(s=>s!==void 0).map(Ch).join(" ");let o=/^[^\s(—–\-,;:.*_`]+/.exec(t);return o?Ch(o[0]):"(none)"}function Bn(e,t){let r=e?.projects??[],o=t?.projectId??null;return o?r.filter(n=>n.projectId===o):[...r]}function yo(e,t){let r=t?.projectId??null;if(r){let o=(e?.projects??[]).find(n=>n.projectId===r);return o?Hn(o):{projectId:r,name:r,nodes:[],edges:[],warnings:[]}}return yc(e??{projects:[]})}function Qn(e,t,r){let o=Bn(e,r),n=null,s=[],i=[];for(let a of o){let c=a.nodes.find(u=>u.id===t);if(c){n=c;for(let u of a.edges)u.source===t&&s.push(u),u.target===t&&i.push(u)}}return{spec:n,found:n!==null,dependsOn:Kn(s),dependedOnBy:Kn(i)}}function Yn(e,t,r){let o=go(t);if(o==="")return{path:"",matches:[]};let n=o.includes("/")?o.slice(0,o.lastIndexOf("/")):"",s=n===""?null:n+"/",i=[],a=[];for(let u of Bn(e,r))for(let l of u.nodes){let p=l.codeReferences??[];p.includes(o)?i.push(Zh(l,"exact")):s&&p.some(d=>d.startsWith(s))&&a.push(Zh(l,"folder"))}let c=(i.length>0?i:a).sort(Ux);return{path:o,matches:c}}function Zh(e,t){return{specId:e.id,projectId:e.projectId,title:e.title,status:e.status,matchKind:t}}var Mh={exact:0,folder:1};function Ux(e,t){return Mh[e.matchKind]-Mh[t.matchKind]||e.projectId.localeCompare(t.projectId)||e.specId.localeCompare(t.specId)}function Xn(e,t){let r=_c(Bn(e,t).flatMap(c=>c.nodes)),o=new Map,n=0,s=0,i=r.map(c=>{let u=Wn(c.status);return o.set(u,(o.get(u)??0)+1),c.taskCompletion&&(n+=c.taskCompletion.done,s+=c.taskCompletion.total),{id:c.id,projectId:c.projectId,status:c.status,done:c.taskCompletion?.done??null,total:c.taskCompletion?.total??null}}),a={};for(let c of[...o.keys()].sort((u,l)=>u.localeCompare(l)))a[c]=o.get(c)??0;return{perSpec:i,aggregate:{specs:r.length,byStatus:a,tasksDone:n,tasksTotal:s}}}function vo(e,t){let r=[];for(let o of Bn(e,t)){let n=new Set;for(let s of o.edges)n.add(s.source),n.add(s.target);for(let s of o.nodes)n.has(s.id)||r.push(s.id)}return{orphans:[...r].sort((o,n)=>o.localeCompare(n))}}var cr=["no-orphans"];function es(e,t,r){if(t==="no-orphans"){let o=vo(e,r).orphans;return{rule:t,ok:o.length===0,violations:o}}return{rule:t,ok:!1,violations:[],error:$o(t)}}function $o(e){return`Unknown rule "${e}". Known rules: ${cr.join(", ")}`}var Ot=dr(require("node:fs")),Ue=dr(require("node:path")),qh=require("node:url"),Gx=["spec.md","plan.md","tasks.md","data-model.md","research.md","quickstart.md"],Kx=["spec","plan","tasks","research","data-model","quickstart"],Hx=["contracts","checklists"];function Dh(e){let t=[],r=Ue.resolve(e),o=s=>{let i=Wx(Ue.join(s,"specs"));i.length>0&&t.push({projectId:(0,qh.pathToFileURL)(s).toString(),name:Ue.basename(s),features:i})};o(r);for(let s of Lh(r))s.isDirectory()&&!s.name.startsWith(".")&&s.name!=="node_modules"&&o(Ue.join(r,s.name));let n=new Set;return t.filter(s=>n.has(s.projectId)?!1:(n.add(s.projectId),!0))}function Wx(e){let t=[];for(let r of Lh(e))r.isDirectory()&&t.push(Bx(Ue.join(e,r.name),r.name));return t}function Bx(e,t){let r=t.match(/^(\d{3})-/),o=r?r[1]:null,n=[];for(let i of Kx)Qx(Ue.join(e,`${i}.md`))&&n.push(i);for(let i of Hx)Yx(Ue.join(e,i))&&n.push(i);let s={};for(let i of Gx){let a=Xx(Ue.join(e,i));a!==null&&(s[i]=a)}return{id:t,number:o,artifacts:n,files:s}}function Lh(e){try{return Ot.readdirSync(e,{withFileTypes:!0})}catch{return[]}}function Qx(e){try{return Ot.statSync(e).isFile()}catch{return!1}}function Yx(e){try{return Ot.statSync(e).isDirectory()}catch{return!1}}function Xx(e){try{return Ot.readFileSync(e,"utf8")}catch{return null}}function Fh(e){let t=Dh(e.root),r=Gn(t,{bareNumbers:!1,...e.options}),o={projectId:e.projectId??null},n=r.projects.flatMap(s=>[...s.warnings]);switch(e.kind){case"graph":return Fe("graph",yo(r,o),n);case"spec":{let s=e.specId??"";return Fe("spec",Qn(r,s,o),_o(n,[s]))}case"file":{let s=Yn(r,e.path??"",o);return Fe("file",s,_o(n,s.matches.map(i=>i.specId)))}case"status":return Fe("status",Xn(r,o),n);case"orphans":return Fe("orphans",vo(r,o),n);case"check":return Fe("check",es(r,e.rule??"no-orphans",o),n);default:return Fe("graph",yo(r,o),n)}}var{values:eS}=(0,Vh.parseArgs)({args:process.argv.slice(2),options:{root:{type:"string"}},allowPositionals:!0}),tS=eS.root??process.cwd(),Uh=cr.join(", "),rS={type:"object",description:"Heuristic toggles (defaults per the model).",properties:{slugMentions:{type:"boolean",description:"Slug-mention edges. Default true."},sharedEntities:{type:"boolean",description:"Shared-entity edges. Default true."},bareNumbers:{type:"boolean",description:"Opt-in risky tier (bare feature numbers); default false."},specToCode:{type:"boolean",description:"Spec->code layer (source-file references; feeds atlas_specs_for_file). Default true."}}},ur={root:{type:"string",description:"Workspace root (default: server root)."},projectId:{type:"string",description:"Scope to one project."},options:rS},Jh=[{name:"atlas_graph",kind:"graph",description:"The spec-relationship graph for a project (or all).",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_spec_relationships",kind:"spec",description:"A spec's dependsOn / dependedOnBy with tier/weight/evidence.",inputSchema:{type:"object",required:["specId"],properties:{specId:{type:"string"},...ur}}},{name:"atlas_specs_for_file",kind:"file",description:"Which spec(s) reference/relate to a source file (reverse traceability). Derived from spec artifacts (feature 011), no git.",inputSchema:{type:"object",required:["path"],properties:{path:{type:"string",description:"File path relative to the workspace root."},...ur}}},{name:"atlas_status_summary",kind:"status",description:"Implementation-status / completeness summary.",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_orphans",kind:"orphans",description:"Specs with no relationships.",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_check",kind:"check",description:`Evaluate a rule (default no-orphans); returns { ok, violations }. An unknown rule is an error (known rules: ${Uh}).`,inputSchema:{type:"object",properties:{rule:{type:"string",description:`Rule to check. Known rules: ${Uh}. Default no-orphans.`},...ur}}}],oS="0.1.2",vc=new Dn({name:"speckit-atlas",version:oS},{capabilities:{tools:{}}});vc.setRequestHandler(ui,async()=>({tools:Jh.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))}));vc.setRequestHandler(Cr,async e=>{let t=Jh.find(n=>n.name===e.params.name);if(!t)return{isError:!0,content:[{type:"text",text:`Unknown tool: ${e.params.name}`}]};let r=e.params.arguments??{};if(t.kind==="check"&&r.rule!==void 0&&!cr.includes(r.rule))return{isError:!0,content:[{type:"text",text:$o(String(r.rule))}]};let o=Fh({root:r.root??tS,kind:t.kind,specId:r.specId,path:r.path,rule:r.rule,projectId:r.projectId??null,options:r.options});return{content:[{type:"text",text:JSON.stringify(o)}]}});async function nS(){await vc.connect(new Fn)}nS();
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@cosmic-chimps/speckit-atlas",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "description": "Headless CLI and MCP server that query the spec-relationship graph of a GitHub Spec Kit repository, for AI agents and CI.",
5
+ "keywords": [
6
+ "speckit",
7
+ "spec-kit",
8
+ "mcp",
9
+ "cli"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Cosmic-Chimps/speckit-atlas.git"
15
+ },
16
+ "bin": {
17
+ "speckit-atlas": "cli.js",
18
+ "speckit-atlas-mcp": "mcp.js"
19
+ },
20
+ "files": [
21
+ "cli.js",
22
+ "mcp.js",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ }
32
+ }