@dvquys/qrec 0.2.0
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.
- package/README.md +99 -0
- package/package.json +32 -0
- package/plugin/scripts/qrec-cli.js +71 -0
- package/plugin/scripts/qrec.cjs +144 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
"use strict";var Hk=Object.create;var Pc=Object.defineProperty;var Wk=Object.getOwnPropertyDescriptor;var Xk=Object.getOwnPropertyNames;var Yk=Object.getPrototypeOf,Qk=Object.prototype.hasOwnProperty;var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Et=(e,t)=>{for(var r in t)Pc(e,r,{get:t[r],enumerable:!0})},ew=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xk(t))!Qk.call(e,o)&&o!==r&&Pc(e,o,{get:()=>t[o],enumerable:!(n=Wk(t,o))||n.enumerable});return e};var Xn=(e,t,r)=>(r=e!=null?Hk(Yk(e)):{},ew(t||!e||!e.__esModule?Pc(r,"default",{value:e,enumerable:!0}):r,e));function tw(){let e=process.env.BREW_PREFIX||process.env.HOMEBREW_PREFIX,t=[];e&&(t.push(`${e}/opt/sqlite/lib/libsqlite3.dylib`),t.push(`${e}/lib/libsqlite3.dylib`)),t.push("/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib"),t.push("/usr/local/opt/sqlite/lib/libsqlite3.dylib");for(let r of t)try{if((0,Yi.statSync)(r).size>0)return r}catch{}return null}function Sr(e=jc){let t=e.replace(/\/[^/]+$/,"");(0,Yi.mkdirSync)(t,{recursive:!0});let r=new Oc.Database(e);return r.loadExtension(rw),r.exec("PRAGMA journal_mode = WAL"),r.exec("PRAGMA synchronous = NORMAL"),r.exec("PRAGMA cache_size = -32000"),r.exec("PRAGMA foreign_keys = ON"),nw(r),r}function nw(e){e.exec(`
|
|
3
|
+
CREATE TABLE IF NOT EXISTS chunks (
|
|
4
|
+
id TEXT PRIMARY KEY,
|
|
5
|
+
session_id TEXT NOT NULL,
|
|
6
|
+
seq INTEGER NOT NULL,
|
|
7
|
+
pos INTEGER NOT NULL,
|
|
8
|
+
text TEXT NOT NULL,
|
|
9
|
+
created_at INTEGER NOT NULL
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_session_id ON chunks(session_id);
|
|
13
|
+
|
|
14
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
15
|
+
id TEXT PRIMARY KEY,
|
|
16
|
+
path TEXT NOT NULL,
|
|
17
|
+
project TEXT NOT NULL,
|
|
18
|
+
date TEXT NOT NULL,
|
|
19
|
+
title TEXT,
|
|
20
|
+
hash TEXT NOT NULL,
|
|
21
|
+
indexed_at INTEGER NOT NULL
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE TABLE IF NOT EXISTS query_cache (
|
|
25
|
+
query_hash TEXT PRIMARY KEY,
|
|
26
|
+
embedding BLOB NOT NULL,
|
|
27
|
+
created_at INTEGER NOT NULL
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
CREATE TABLE IF NOT EXISTS query_audit (
|
|
31
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
32
|
+
query TEXT NOT NULL,
|
|
33
|
+
k INTEGER NOT NULL,
|
|
34
|
+
result_count INTEGER NOT NULL,
|
|
35
|
+
top_session_id TEXT,
|
|
36
|
+
top_score REAL,
|
|
37
|
+
duration_ms REAL NOT NULL,
|
|
38
|
+
created_at INTEGER NOT NULL
|
|
39
|
+
);
|
|
40
|
+
`),e.exec(`
|
|
41
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS chunks_fts USING fts5(
|
|
42
|
+
session_id,
|
|
43
|
+
text,
|
|
44
|
+
content='chunks',
|
|
45
|
+
content_rowid='rowid'
|
|
46
|
+
);
|
|
47
|
+
`),e.exec(`
|
|
48
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS chunks_vec USING vec0(
|
|
49
|
+
chunk_id TEXT PRIMARY KEY,
|
|
50
|
+
embedding FLOAT[768] distance_metric=cosine
|
|
51
|
+
);
|
|
52
|
+
`),e.exec(`
|
|
53
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ai AFTER INSERT ON chunks BEGIN
|
|
54
|
+
INSERT INTO chunks_fts(rowid, session_id, text) VALUES (new.rowid, new.session_id, new.text);
|
|
55
|
+
END;
|
|
56
|
+
|
|
57
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ad AFTER DELETE ON chunks BEGIN
|
|
58
|
+
INSERT INTO chunks_fts(chunks_fts, rowid, session_id, text) VALUES ('delete', old.rowid, old.session_id, old.text);
|
|
59
|
+
END;
|
|
60
|
+
|
|
61
|
+
CREATE TRIGGER IF NOT EXISTS chunks_au AFTER UPDATE ON chunks BEGIN
|
|
62
|
+
INSERT INTO chunks_fts(chunks_fts, rowid, session_id, text) VALUES ('delete', old.rowid, old.session_id, old.text);
|
|
63
|
+
INSERT INTO chunks_fts(rowid, session_id, text) VALUES (new.rowid, new.session_id, new.text);
|
|
64
|
+
END;
|
|
65
|
+
`)}var Oc,Oh,jh,Nh,Yi,jc,rw,Qi=h(()=>{"use strict";Oc=require("bun:sqlite"),Oh=require("sqlite-vec"),jh=require("path"),Nh=require("os"),Yi=require("fs"),jc=(0,jh.join)((0,Nh.homedir)(),".qrec","qrec.db");if(process.platform==="darwin"){let e=tw();if(!e)throw new Error(`sqlite-vec requires a Homebrew SQLite build that supports dynamic extension loading. Install with: brew install sqlite
|
|
66
|
+
Then set BREW_PREFIX if Homebrew is in a non-standard location.`);Oc.Database.setCustomSQLite(e)}rw=(0,Oh.getLoadablePath)()});function Dh(e){if(e.length<=3600)return[{text:e,pos:0}];let t=ow(e),r=[],n="",o=0;for(let i of t){let a=n?n+`
|
|
67
|
+
|
|
68
|
+
`+i.text:i.text;if(a.length<=3600)n||(o=i.pos),n=a;else if(n){r.push({text:n.trim(),pos:o});let s=n.slice(-Rh),c=o+n.length-s.length;n=s+`
|
|
69
|
+
|
|
70
|
+
`+i.text,o=c}else{let s=iw(i.text,i.pos);if(s.length>1){for(let u=0;u<s.length-1;u++)r.push(s[u]);let c=s[s.length-1];n=c.text,o=c.pos}else n=i.text,o=i.pos}}return n.trim()&&r.push({text:n.trim(),pos:o}),r}function ow(e){let t=/^(#{1,6} .+)$/m,r=[],n=0,o=[],i,a=/^(#{1,6} .+)$/gm;for(;(i=a.exec(e))!==null;)i.index>0&&o.push(i.index);if(o.length===0)return[{text:e,pos:0}];for(let c of o){let u=e.slice(n,c);u.trim()&&r.push({text:u.trim(),pos:n}),n=c}let s=e.slice(n);return s.trim()&&r.push({text:s.trim(),pos:n}),r.length>0?r:[{text:e,pos:0}]}function iw(e,t){let r=[],n=0;for(;n<e.length;){let o=n+3600;if(o>=e.length){r.push({text:e.slice(n).trim(),pos:t+n});break}let i=e.lastIndexOf(`
|
|
71
|
+
|
|
72
|
+
`,o);if(i>n+3600*.5)o=i;else{let a=e.lastIndexOf(`
|
|
73
|
+
`,o);a>n+3600*.5&&(o=a)}r.push({text:e.slice(n,o).trim(),pos:t+n}),n=Math.max(n+1,o-Rh)}return r}var Rh,Zh=h(()=>{"use strict";Rh=Math.floor(540)});var ze,Nc=h(()=>{"use strict";ze={phase:"starting",modelDownload:{percent:0,downloadedMB:0,totalMB:null},indexing:{indexed:0,total:0,current:""}}});var Ch={};Et(Ch,{disposeEmbedder:()=>eo,getEmbedder:()=>cw});async function aw(){if((0,ea.existsSync)(Rc))return console.log(`[embed] Found model at legacy path: ${Rc}`),Rc;console.log(`[embed] Resolving model: ${Ah}`),(0,ea.mkdirSync)(Uh,{recursive:!0}),ze.phase="model_download",ze.modelDownload={percent:0,downloadedMB:0,totalMB:null};let{resolveModelFile:e}=await import("node-llama-cpp"),t=await e(Ah,{directory:Uh,onProgress({totalSize:r,downloadedSize:n}){ze.modelDownload={percent:r?Math.round(n/r*100):0,downloadedMB:+(n/1048576).toFixed(1),totalMB:r?+(r/1048576).toFixed(1):null}}});return console.log(`[embed] Model ready at ${t}`),t}async function sw(){let e=await aw();ze.phase="model_loading",console.log(`[embed] Loading model from ${e}`);let{getLlama:t}=await import("node-llama-cpp");Qn=await t();let n=await(await Qn.loadModel({modelPath:e})).createEmbeddingContext({contextSize:8192});return console.log("[embed] Model loaded, embedding dimensions: 768"),n}async function eo(){Xr&&(await Xr.dispose(),Xr=null),Qn&&(await Qn.dispose(),Qn=null,Yn=null)}async function cw(){return Yn||(Yn=sw().catch(e=>{throw Yn=null,e})),Xr||(Xr=await Yn),{dimensions:768,async embed(e){let t=Xr,r=24e3,n=e.length>r?e.slice(0,r):e;n!==e&&console.warn(`[embed] Truncated chunk from ${e.length} to ${r} chars`);let o=await t.getEmbeddingFor(n);return new Float32Array(o.vector)}}}var Dc,Zc,ea,Ah,Rc,Uh,Qn,Xr,Yn,ta=h(()=>{"use strict";Dc=require("path"),Zc=require("os"),ea=require("fs");Nc();Ah="hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf",Rc=(0,Dc.join)((0,Zc.homedir)(),".cache","qmd","models","hf_ggml-org_embeddinggemma-300M-Q8_0.gguf"),Uh=(0,Dc.join)((0,Zc.homedir)(),".qrec","models"),Qn=null,Xr=null,Yn=null});var Mh={};Et(Mh,{getOllamaEmbedder:()=>dw});function dw(){let e=process.env.QREC_OLLAMA_HOST??uw,t=process.env.QREC_OLLAMA_MODEL??lw;return console.log(`[embed/ollama] Using Ollama at ${e}, model: ${t}`),{dimensions:768,async embed(r){let n=await fetch(`${e}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:t,prompt:r})});if(!n.ok){let i=await n.text().catch(()=>"");throw new Error(`Ollama embeddings request failed: HTTP ${n.status} \u2014 ${i}`)}let o=await n.json();if(!Array.isArray(o.embedding)||o.embedding.length===0)throw new Error("Ollama returned empty or invalid embedding");return new Float32Array(o.embedding)}}}var uw,lw,Lh=h(()=>{"use strict";uw="http://localhost:11434",lw="nomic-embed-text"});var qh={};Et(qh,{getOpenAIEmbedder:()=>fw});function fw(){let e=process.env.QREC_OPENAI_KEY;if(!e)throw new Error("QREC_OPENAI_KEY environment variable is required for OpenAI embedding backend");let t=(process.env.QREC_OPENAI_BASE_URL??pw).replace(/\/$/,""),r=process.env.QREC_OPENAI_MODEL??mw,n=parseInt(process.env.QREC_OPENAI_DIMENSIONS??String(768),10);return console.log(`[embed/openai] Using OpenAI-compatible API at ${t}, model: ${r}, dimensions: ${n}`),{dimensions:n,async embed(o){let i={model:r,input:o};r.startsWith("text-embedding-3")&&(i.dimensions=n);let a=await fetch(`${t}/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(i)});if(!a.ok){let c=await a.text().catch(()=>"");throw new Error(`OpenAI embeddings request failed: HTTP ${a.status} \u2014 ${c}`)}let s=await a.json();if(!s.data?.[0]?.embedding||s.data[0].embedding.length===0)throw new Error("OpenAI returned empty or invalid embedding");return new Float32Array(s.data[0].embedding)}}}var pw,mw,Fh=h(()=>{"use strict";pw="https://api.openai.com/v1",mw="text-embedding-3-small"});var Jh={};Et(Jh,{getStubEmbedder:()=>hw});function hw(){return{dimensions:768,async embed(e){return Vh}}}var Vh,Bh=h(()=>{"use strict";Vh=new Float32Array(768);Vh[0]=1});async function Yr(){let e=(process.env.QREC_EMBED_PROVIDER??"local").toLowerCase().trim();switch(e){case"local":case"":{let{getEmbedder:t}=await Promise.resolve().then(()=>(ta(),Ch));return t()}case"ollama":{let{getOllamaEmbedder:t}=await Promise.resolve().then(()=>(Lh(),Mh));return t()}case"openai":{let{getOpenAIEmbedder:t}=await Promise.resolve().then(()=>(Fh(),qh));return t()}case"stub":{let{getStubEmbedder:t}=await Promise.resolve().then(()=>(Bh(),Jh));return t()}default:throw new Error(`Unknown QREC_EMBED_PROVIDER: "${e}". Valid values: local, ollama, openai, stub`)}}var ra=h(()=>{"use strict"});function Gh(e){return e.replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g,"").replace(/<[^>]+\/>/g,"").trim()}function gw(e,t){let n={Bash:"command",Read:"file_path",Write:"file_path",Edit:"file_path",Glob:"pattern",Grep:"pattern",WebFetch:"url",WebSearch:"query",Agent:"description"}[e],o=n&&typeof t[n]=="string"?t[n]:JSON.stringify(t),i=o.length>80?o.slice(0,80)+"\u2026":o;return`${e}: \`${i}\``}function vw(e){if(typeof e=="string")return{text:Gh(e).trim(),isToolResult:!1};if(!Array.isArray(e))return{text:"",isToolResult:!1};if(e.every(n=>n?.type==="tool_result"))return{text:"",isToolResult:!0};let r=[];for(let n of e)if(n?.type==="text"&&typeof n.text=="string"){let o=Gh(n.text).trim();o&&r.push(o)}return{text:r.join(`
|
|
74
|
+
`).trim(),isToolResult:!1}}function yw(e){if(!Array.isArray(e))return{text:"",tools:[]};let t=[],r=[];for(let n of e)if(n?.type==="text"&&typeof n.text=="string"){let o=n.text.trim();o&&t.push(o)}else n?.type==="tool_use"&&n.name&&r.push(gw(n.name,n.input??{}));return{text:t.join(`
|
|
75
|
+
`).trim(),tools:r}}async function na(e){let t=(0,Hh.readFileSync)(e,"utf-8"),r=(0,Kh.createHash)("sha256").update(t).digest("hex"),o=(0,Ac.basename)(e,".jsonl").replace(/-/g,"").slice(0,8),i=t.split(`
|
|
76
|
+
`).filter(l=>l.trim()).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null),a="",s="",c=null,u=[];for(let l of i){if(l.type==="file-history-snapshot"||l.type==="system"||l.type==="progress"||l.isMeta||l.isSidechain)continue;let d=l.message;if(d){if(!a&&l.cwd&&(a=(0,Ac.basename)(l.cwd)),!s&&l.timestamp&&(s=l.timestamp.slice(0,10)),d.role==="user"&&l.type==="user"){let{text:p,isToolResult:m}=vw(d.content);if(m||!p)continue;c||(c=p.slice(0,120)),u.push({role:"user",text:p,tools:[],timestamp:l.timestamp??null})}if(d.role==="assistant"&&l.type==="assistant"){let{text:p,tools:m}=yw(d.content);if(!p&&m.length===0)continue;u.push({role:"assistant",text:p,tools:m,timestamp:l.timestamp??null})}}}return{session_id:o,path:e,project:a,date:s,title:c,hash:r,turns:u}}function Wh(e){let t=[`# Session: ${e.project} \u2014 ${e.date}`,""];e.title&&t.push(`_${e.title}_`,"");for(let r of e.turns)if(r.role==="user")t.push("## User","",r.text,"");else{t.push("## Assistant",""),r.text&&t.push(r.text,"");for(let n of r.tools)t.push(`> **Tool:** ${n}`);r.tools.length>0&&t.push("")}return t.join(`
|
|
77
|
+
`)}function Xh(e){let t=[];for(let r of e.turns){r.text&&t.push(`[${r.role==="user"?"User":"Assistant"}] ${r.text}`);for(let n of r.tools)t.push(`[Tool] ${n}`)}return t.join(`
|
|
78
|
+
`)}var Kh,Hh,Ac,Uc=h(()=>{"use strict";Kh=require("crypto"),Hh=require("fs"),Ac=require("path")});function _w(e){let t=(0,zr.basename)(e,".md"),r=t.match(/^(\d{4}-\d{2}-\d{2})_(.+)_([0-9a-f]{8})$/);if(r)return{date:r[1],project:r[2],id:r[3]};let n=t.match(/^(\d{4}-\d{2}-\d{2})__(.+)_([0-9a-f]{8})$/);return n?{date:n[1],project:n[2],id:n[3]}:null}function $w(e){let t=e.match(/^# (.+)$/m);return t?t[1].trim():null}function bw(e){return(0,eg.createHash)("sha256").update(e).digest("hex")}function xw(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,zr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".jsonl")&&t.push((0,zr.join)(n,o));else r.endsWith(".jsonl")&&t.push(n)}return t}function kw(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,zr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".md")&&t.push((0,zr.join)(n,o));else r.endsWith(".md")&&t.push(n)}return t}function ww(e){return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Sw(e,t,r){let n=ww(r),o=[...e];for(let i=o.length-1;i>0;i--){let a=Math.floor(n()*(i+1));[o[i],o[a]]=[o[a],o[i]]}return o.slice(0,t)}async function Yh(e,t=2){try{let r=await na(e);if(r.turns.filter(i=>i.role==="user").length<t)return null;let o=Xh(r);return o.trim()?{id:r.session_id,path:e,project:r.project,date:r.date,title:r.title,hash:r.hash,chunkText:o}:null}catch{return null}}function zw(e){let t=_w(e);if(!t)return null;let r=(0,Le.readFileSync)(e,"utf-8");return{id:t.id,path:e,project:t.project,date:t.date,title:$w(r),hash:bw(r),chunkText:r}}async function oa(e,t,r={},n){let o=await Yr(),i=t.endsWith(".jsonl")&&(0,Le.existsSync)(t),a=!i&&(0,Le.existsSync)(t)&&(0,Le.statSync)(t).isDirectory(),s=new Map,c=e.prepare("SELECT path, indexed_at FROM sessions").all();for(let z of c)s.set(z.path,z.indexed_at);let u=[];if(i){let z=await Yh(t,Qh);if(!z){console.log("[indexer] Session skipped (too few user turns or empty)");return}u=[z]}else if(a){let z=xw(t);if(z.length>0){let k=z.filter(Me=>{let $t=s.get(Me);return $t?(0,Le.statSync)(Me).mtimeMs>=$t:!0}),$e=z.length-k.length;console.log(`[indexer] Found ${z.length} JSONL files (${$e} skipped by mtime, ${k.length} to check)`),u=(await Promise.all(k.map(Me=>Yh(Me,Qh)))).filter(Me=>Me!==null)}else{let k=kw(t);console.log(`[indexer] Found ${k.length} markdown files (legacy path)`),u=k.map(zw).filter($e=>$e!==null)}}else{console.error(`[indexer] Path not found or not a JSONL/directory: ${t}`);return}let l=new Map,d=e.prepare("SELECT id, hash FROM sessions").all();for(let z of d)l.set(z.id,z.hash);if(r.sessions&&r.sessions<u.length){let z=r.seed??42;u=Sw(u,r.sessions,z),console.log(`[indexer] Sampled ${u.length} sessions (seed=${z})`)}let p=u.filter(({id:z,hash:k})=>r.force?!0:l.get(z)!==k),m=u.length-p.length,g=i?1:u.length;console.log(`[indexer] ${p.length} sessions to index (${g} total, ${m} up-to-date)`);let y=e.prepare(`
|
|
79
|
+
INSERT OR REPLACE INTO sessions (id, path, project, date, title, hash, indexed_at)
|
|
80
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
81
|
+
`),_=e.prepare(`
|
|
82
|
+
INSERT OR REPLACE INTO chunks (id, session_id, seq, pos, text, created_at)
|
|
83
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
84
|
+
`),x=e.prepare(`
|
|
85
|
+
INSERT OR REPLACE INTO chunks_vec (chunk_id, embedding)
|
|
86
|
+
VALUES (?, ?)
|
|
87
|
+
`),j=e.prepare("DELETE FROM chunks WHERE session_id = ?"),P=e.prepare("DELETE FROM chunks_vec WHERE chunk_id LIKE ?");for(let z=0;z<p.length;z++){let{id:k,path:$e,project:Ie,date:Me,title:$t,hash:Ct,chunkText:wr}=p[z],Kr=Dh(wr),tr=Date.now(),Hn=e.transaction(()=>(j.run(k),P.run(`${k}_%`),y.run(k,$e,Ie,Me,$t,Ct,tr),Kr))();process.stdout.write(`[${z+1}/${p.length}] ${k} (${Ie}/${Me}) \u2014 ${Hn.length} chunks
|
|
88
|
+
`),n?.(z,p.length,k);let Ec=e.transaction(A=>{for(let{chunkId:_e,seq:He,pos:tt,text:Hr,embedding:Wr}of A)_.run(_e,k,He,tt,Hr,tr),x.run(_e,Buffer.from(Wr.buffer))}),Wn=[];for(let A=0;A<Hn.length;A++){let _e=Hn[A],He=`${k}_${A}`,tt=await o.embed(_e.text);Wn.push({chunkId:He,seq:A,pos:_e.pos,text:_e.text,embedding:tt})}Ec(Wn)}n?.(p.length,p.length,""),console.log(`[indexer] Done. Total sessions indexed: ${p.length}`)}var Le,zr,eg,Qh,Cc=h(()=>{"use strict";Le=require("fs"),zr=require("path"),eg=require("crypto");Zh();ra();Uc();Qh=2});function Iw(){(0,rt.mkdirSync)(rg,{recursive:!0})}function ng(){if(!(0,rt.existsSync)(Ir))return!1;let e=parseInt((0,rt.readFileSync)(Ir,"utf-8").trim(),10);if(isNaN(e))return!1;try{return process.kill(e,0),!0}catch{try{(0,rt.unlinkSync)(Ir)}catch{}return!1}}function Qr(){if(!(0,rt.existsSync)(Ir))return null;let e=parseInt((0,rt.readFileSync)(Ir,"utf-8").trim(),10);return isNaN(e)?null:e}async function Lc(){if(ng()){let a=Qr();console.log(`[daemon] qrec server already running (PID ${a})`);return}Iw();let e=(0,to.join)(rg,"qrec.log"),t=typeof tg.dir=="string"?["bun","run",(0,to.join)(tg.dir,"server.ts")]:[process.argv[0],process.argv[1],"serve"],r=Bun.spawn(t,{detached:!0,stdio:["ignore",Bun.file(e),Bun.file(e)]}),n=r.pid;(0,rt.writeFileSync)(Ir,String(n),"utf-8"),r.unref(),console.log(`[daemon] qrec server started (PID ${n})`),console.log(`[daemon] Logs: ${e}`),console.log("[daemon] Waiting for server to be ready...");let o=Date.now()+3e4,i=!1;for(;Date.now()<o;){await Bun.sleep(500);try{if((await fetch("http://localhost:3030/health")).ok){i=!0;break}}catch{}}i?console.log("[daemon] Server ready at http://localhost:3030"):(console.error(`[daemon] Server failed to start within 30 seconds. Check logs: ${e}`),process.exit(1))}async function qc(){if(!ng()){console.log("[daemon] No running qrec server found.");return}let e=Qr();try{process.kill(e,"SIGTERM"),console.log(`[daemon] Sent SIGTERM to PID ${e}`);let t=Date.now()+5e3;for(;Date.now()<t;){await Bun.sleep(200);try{process.kill(e,0)}catch{break}}}catch(t){console.error(`[daemon] Failed to send SIGTERM: ${t}`)}try{(0,rt.unlinkSync)(Ir)}catch{}console.log("[daemon] qrec server stopped.")}var to,Mc,rt,tg,Ir,rg,Fc=h(()=>{"use strict";to=require("path"),Mc=require("os"),rt=require("fs"),tg={},Ir=(0,to.join)((0,Mc.homedir)(),".qrec","qrec.pid"),rg=(0,to.join)((0,Mc.homedir)(),".qrec")});function Tw(e){return(0,ig.createHash)("sha256").update(e).digest("hex")}async function Ew(e,t,r){let n=Tw(t),o=e.prepare("SELECT embedding FROM query_cache WHERE query_hash = ?").get(n);if(o){let c=o.embedding;return{embedding:new Float32Array(c.buffer,c.byteOffset,c.byteLength/4),cached:!0,embedMs:0}}let i=performance.now(),a=await r.embed(t),s=performance.now()-i;return e.prepare("INSERT OR REPLACE INTO query_cache (query_hash, embedding, created_at) VALUES (?, ?, ?)").run(n,Buffer.from(a.buffer),Date.now()),{embedding:a,cached:!1,embedMs:s}}async function ro(e,t,r,n=10){let o=performance.now(),i=performance.now(),a=[];try{let A=r.replace(/[^a-zA-Z0-9\s'-]/g," ").replace(/\s+/g," ").trim();A.length>0&&(a=e.prepare("SELECT rowid, session_id, rank FROM chunks_fts WHERE text MATCH ? ORDER BY rank LIMIT ?").all(A,n*5))}catch{a=[]}let s=performance.now()-i,{embedding:c,embedMs:u}=await Ew(e,r,t),l=performance.now(),d=Buffer.from(c.buffer),p=e.prepare("SELECT chunk_id, distance FROM chunks_vec WHERE embedding MATCH ? AND k = ?").all(d,n*5),m=performance.now()-l,g=performance.now(),y=new Map;for(let A=0;A<a.length;A++){let _e=a[A];y.set(String(_e.rowid),A+1)}let _=new Map;for(let A=0;A<p.length;A++)_.set(p[A].chunk_id,A+1);let x=a.map(A=>A.rowid),j=new Map;if(x.length>0){let A=x.map(()=>"?").join(","),_e=e.prepare(`SELECT rowid, id FROM chunks WHERE rowid IN (${A})`).all(...x);for(let He of _e)j.set(He.rowid,He.id)}let P=new Set;for(let A of a){let _e=j.get(A.rowid);_e&&P.add(_e)}for(let A of p)P.add(A.chunk_id);let z=new Map;for(let A of P){let _e=0;for(let[tt,Hr]of j)if(Hr===A){let Wr=y.get(String(tt));Wr!==void 0&&(_e+=1/(og+Wr));break}let He=_.get(A);He!==void 0&&(_e+=1/(og+He)),z.set(A,_e)}let k=new Map;for(let[A,_e]of z){let He=A.split("_").slice(0,-1).join("_"),tt=k.get(He);(!tt||_e>tt.score)&&k.set(He,{score:_e,bestChunkId:A})}let $e=[...k.entries()].sort((A,_e)=>_e[1].score-A[1].score).slice(0,n),Ie=performance.now()-g,Me=performance.now()-o;if($e.length===0)return[];let $t=$e.map(([A])=>A),Ct=$t.map(()=>"?").join(","),wr=e.prepare(`SELECT id, project, date, title FROM sessions WHERE id IN (${Ct})`).all(...$t),Kr=new Map(wr.map(A=>[A.id,A])),tr=$e.map(([,A])=>A.bestChunkId),Xi=tr.map(()=>"?").join(","),Hn=e.prepare(`SELECT id, session_id, text FROM chunks WHERE id IN (${Xi})`).all(...tr),Ec=new Map(Hn.map(A=>[A.id,A])),Wn=[];for(let[A,{score:_e,bestChunkId:He}]of $e){let tt=Kr.get(A);if(!tt)continue;let Hr=Ec.get(He),Wr=Hr?Hr.text.slice(0,200):"";Wn.push({session_id:A,score:_e,preview:Wr,project:tt.project,date:tt.date,title:tt.title,latency:{bm25Ms:s,embedMs:u,knnMs:m,fusionMs:Ie,totalMs:Me}})}return Wn}var ig,og,Vc=h(()=>{"use strict";ig=require("crypto"),og=60});function ag(e,t,r,n,o){let i=n[0]??null;e.prepare(`
|
|
89
|
+
INSERT INTO query_audit (query, k, result_count, top_session_id, top_score, duration_ms, created_at)
|
|
90
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
91
|
+
`).run(t,r,n.length,i?.session_id??null,i?.score??null,o,Date.now())}function sg(e,t=100){return e.prepare("SELECT * FROM query_audit ORDER BY created_at DESC LIMIT ?").all(t)}var cg=h(()=>{"use strict"});function no(e){let t={ts:Date.now(),...e};try{(0,rr.mkdirSync)((0,Bc.join)((0,Gc.homedir)(),".qrec"),{recursive:!0}),(0,rr.appendFileSync)(Jc,JSON.stringify(t)+`
|
|
92
|
+
`,"utf-8")}catch{}}function ug(e=100){if(!(0,rr.existsSync)(Jc))return[];try{return(0,rr.readFileSync)(Jc,"utf-8").split(`
|
|
93
|
+
`).filter(n=>n.trim().length>0).map(n=>{try{return JSON.parse(n)}catch{return null}}).filter(n=>n!==null).slice(-e).reverse()}catch{return[]}}var Bc,Gc,rr,Jc,lg=h(()=>{"use strict";Bc=require("path"),Gc=require("os"),rr=require("fs"),Jc=(0,Bc.join)((0,Gc.homedir)(),".qrec","activity.jsonl")});var Nw={};async function Ow(e,t){if(!(0,io.existsSync)(e))return Response.json({error:"Not found"},{status:404});let r=await Bun.file(e).text();return new Response(r,{headers:{"Content-Type":t}})}async function jw(){console.log("[server] Starting qrec server...");let e=Sr(),t=null,r=null,n=!1;function o(){return e.prepare("SELECT COUNT(*) as count FROM sessions").get().count}let i=Bun.serve({port:Kc,async fetch(c){let u=new URL(c.url);if(c.method==="GET"&&u.pathname==="/health")return Response.json({status:"ok",phase:ze.phase,indexedSessions:o()});if(c.method==="GET"&&u.pathname==="/status"){let l=e.prepare("SELECT COUNT(*) as n FROM sessions").get().n,d=e.prepare("SELECT COUNT(*) as n FROM chunks").get().n,p=e.prepare("SELECT MAX(indexed_at) as ts FROM sessions").get(),m=e.prepare("SELECT COUNT(*) as n FROM query_audit").get().n;return Response.json({status:"ok",phase:ze.phase,sessions:l,chunks:d,lastIndexedAt:p.ts,searches:m,embedProvider:process.env.QREC_EMBED_PROVIDER??"local",modelDownload:ze.modelDownload,indexing:ze.indexing})}if(c.method==="GET"&&u.pathname==="/sessions"){let l=e.prepare("SELECT id FROM sessions").all();return Response.json({sessions:l.map(d=>d.id)})}if(c.method==="POST"&&u.pathname==="/search"){if(!t)return Response.json({error:r??`Model not ready yet (phase: ${ze.phase})`},{status:503});let l;try{l=await c.json()}catch{return Response.json({error:"Invalid JSON body"},{status:400})}let d=l.query?.trim();if(!d)return Response.json({error:"Missing required field: query"},{status:400});let p=l.k??10,m=performance.now();try{let g=await ro(e,t,d,p),y=performance.now()-m;try{ag(e,d,p,g,y)}catch{}let _=g[0]?.latency.totalMs??0;return Response.json({results:g,latencyMs:_})}catch(g){return console.error("[server] Search error:",g),Response.json({error:String(g)},{status:500})}}if(c.method==="GET"&&u.pathname==="/audit/entries"){let l=parseInt(u.searchParams.get("limit")??"100",10);try{let d=sg(e,l);return Response.json({entries:d})}catch(d){return Response.json({error:String(d)},{status:500})}}if(c.method==="GET"&&u.pathname==="/activity/entries"){let l=parseInt(u.searchParams.get("limit")??"100",10),d=ug(l);return Response.json({entries:d})}if(c.method==="GET"&&(u.pathname==="/"||u.pathname==="/search"||u.pathname==="/audit"||u.pathname==="/debug"))return Ow((0,nr.join)(Pw,"index.html"),"text/html; charset=utf-8");if(c.method==="GET"&&u.pathname==="/debug/log"){let l=(0,nr.join)((0,oo.homedir)(),".qrec","qrec.log"),d=parseInt(u.searchParams.get("lines")??"100",10);try{let m=(0,io.readFileSync)(l,"utf-8").split(`
|
|
94
|
+
`).filter(g=>g.length>0).slice(-d);return Response.json({lines:m})}catch{return Response.json({lines:[]})}}return c.method==="GET"&&u.pathname==="/debug/config"?Response.json({dbPath:jc,logPath:(0,nr.join)((0,oo.homedir)(),".qrec","qrec.log"),modelCachePath:(0,nr.join)((0,oo.homedir)(),".qrec","models"),embedProvider:process.env.QREC_EMBED_PROVIDER??"local",ollamaHost:process.env.QREC_OLLAMA_HOST??null,ollamaModel:process.env.QREC_OLLAMA_MODEL??null,openaiBaseUrl:process.env.QREC_OPENAI_BASE_URL??null,indexIntervalMs:pg,port:Kc,platform:process.platform,bunVersion:process.versions.bun??null,nodeVersion:process.version}):Response.json({error:"Not found"},{status:404})}});console.log(`[server] Listening on http://localhost:${Kc}`),no({type:"daemon_started"});async function a(){if(n||!(0,io.existsSync)(dg))return;n=!0;let c=Date.now();no({type:"index_started"}),ze.phase="indexing",ze.indexing={indexed:0,total:0,current:""};let u=0,l=0;try{await oa(e,dg,{},(d,p,m)=>{ze.indexing={indexed:d,total:p,current:m},m&&d>l&&(no({type:"session_indexed",data:{sessionId:m}}),u++,l=d)}),no({type:"index_complete",data:{newSessions:u,durationMs:Date.now()-c}})}catch(d){console.error("[server] Index error:",d)}finally{n=!1,ze.phase="ready"}}async function s(c=10,u=3e4){for(let l=1;l<=c;l++)try{ze.phase="model_loading",t=await Yr(),r=null,console.log("[server] Model ready"),await a(),ze.phase="ready",setInterval(a,pg);return}catch(d){r=String(d),console.error(`[server] Model load failed (attempt ${l}/${c}):`,d),l<c&&(console.log(`[server] Retrying in ${u/1e3}s...`),await Bun.sleep(u))}console.error("[server] Model load gave up after all retries."),ze.phase="ready"}s(),process.on("SIGTERM",()=>{console.log("[server] SIGTERM received, shutting down..."),e.close(),i.stop(),process.exit(0)}),process.on("SIGINT",()=>{console.log("[server] SIGINT received, shutting down..."),e.close(),i.stop(),process.exit(0)})}var nr,io,oo,mg,Kc,dg,pg,Pw,fg=h(()=>{"use strict";Qi();ra();Vc();cg();Cc();Nc();lg();nr=require("path"),io=require("fs"),oo=require("os"),mg={},Kc=3030,dg=(0,nr.join)((0,oo.homedir)(),".claude","projects"),pg=parseInt(process.env.QREC_INDEX_INTERVAL_MS??"60000",10),Pw=typeof mg.dir=="string"?(0,nr.join)(mg.dir,"..","ui"):(0,nr.join)(__dirname,"..","ui");jw().catch(e=>{console.error("[server] Fatal error:",e),process.exit(1)})});var ee,hg,T,Mt,ao=h(()=>{(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(hg||(hg={}));T=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Mt=e=>{switch(typeof e){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(e)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(e)?T.array:e===null?T.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?T.promise:typeof Map<"u"&&e instanceof Map?T.map:typeof Set<"u"&&e instanceof Set?T.set:typeof Date<"u"&&e instanceof Date?T.date:T.object;default:return T.unknown}}});var $,nt,ia=h(()=>{ao();$=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),nt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};nt.create=e=>new nt(e)});var Rw,or,Hc=h(()=>{ia();ao();Rw=(e,t)=>{let r;switch(e.code){case $.invalid_type:e.received===T.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case $.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case $.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case $.invalid_union:r="Invalid input";break;case $.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case $.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case $.invalid_arguments:r="Invalid function arguments";break;case $.invalid_return_type:r="Invalid function return type";break;case $.invalid_date:r="Invalid date";break;case $.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case $.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case $.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case $.custom:r="Invalid input";break;case $.invalid_intersection_types:r="Intersection results could not be merged";break;case $.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case $.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},or=Rw});function so(){return Dw}var Dw,aa=h(()=>{Hc();Dw=or});function w(e,t){let r=so(),n=sa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===or?void 0:or].filter(o=>!!o)});e.common.issues.push(n)}var sa,Re,M,en,qe,Wc,Xc,Tr,co,Yc=h(()=>{aa();Hc();sa=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};Re=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return M;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),en=e=>({status:"dirty",value:e}),qe=e=>({status:"valid",value:e}),Wc=e=>e.status==="aborted",Xc=e=>e.status==="dirty",Tr=e=>e.status==="valid",co=e=>typeof Promise<"u"&&e instanceof Promise});var gg=h(()=>{});var O,vg=h(()=>{(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}))});function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}function $g(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Yw(e){return new RegExp(`^${$g(e)}$`)}function Qw(e){let t=`${_g}T${$g(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function eS(e,t){return!!((t==="v4"||!t)&&Jw.test(e)||(t==="v6"||!t)&&Gw.test(e))}function tS(e,t){if(!Lw.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function rS(e,t){return!!((t==="v4"||!t)&&Bw.test(e)||(t==="v6"||!t)&&Kw.test(e))}function nS(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}function tn(e){if(e instanceof ot){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=bt.create(tn(n))}return new ot({...e._def,shape:()=>t})}else return e instanceof ar?new ar({...e._def,type:tn(e.element)}):e instanceof bt?bt.create(tn(e.unwrap())):e instanceof Ft?Ft.create(tn(e.unwrap())):e instanceof qt?qt.create(e.items.map(t=>tn(t))):e}function tu(e,t){let r=Mt(e),n=Mt(t);if(e===t)return{valid:!0,data:e};if(r===T.object&&n===T.object){let o=ee.objectKeys(t),i=ee.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=tu(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===T.array&&n===T.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=tu(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===T.date&&n===T.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function bg(e,t){return new ln({values:e,typeName:Z.ZodEnum,...V(t)})}var ut,yg,W,Zw,Aw,Uw,Cw,Mw,Lw,qw,Fw,Vw,Qc,Jw,Bw,Gw,Kw,Hw,Ww,_g,Xw,rn,uo,lo,po,mo,fo,nn,on,ho,ir,Pt,go,ar,ot,an,Lt,eu,sn,qt,ru,vo,yo,nu,cn,un,ln,dn,Er,xt,bt,Ft,pn,mn,_o,ca,ua,fn,t1,Z,r1,n1,o1,i1,a1,s1,c1,u1,l1,d1,p1,m1,f1,h1,oS,g1,v1,y1,_1,$1,b1,x1,k1,w1,S1,z1,I1,T1,E1,P1,O1,j1,N1,R1,xg=h(()=>{ia();aa();vg();Yc();ao();ut=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},yg=(e,t)=>{if(Tr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new nt(e.common.issues);return this._error=r,this._error}}};W=class{get description(){return this._def.description}_getType(t){return Mt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:Mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(co(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Mt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return yg(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Mt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Tr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Tr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Mt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(co(o)?o:Promise.resolve(o));return yg(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:$.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new xt({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bt.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ar.create(this)}promise(){return Er.create(this,this._def)}or(t){return an.create([this,t],this._def)}and(t){return sn.create(this,t,this._def)}transform(t){return new xt({...V(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new pn({...V(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new ca({typeName:Z.ZodBranded,type:this,...V(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new mn({...V(this._def),innerType:this,catchValue:r,typeName:Z.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ua.create(this,t)}readonly(){return fn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zw=/^c[^\s-]{8,}$/i,Aw=/^[0-9a-z]+$/,Uw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Cw=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mw=/^[a-z0-9_-]{21}$/i,Lw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Fw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jw=/^(?:(?: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])$/,Bw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Gw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Kw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ww=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_g="((\\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])))",Xw=new RegExp(`^${_g}$`);rn=class e extends W{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==T.string){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:T.string,received:i.parsedType}),M}let n=new Re,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?w(o,{code:$.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:$.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Fw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"email",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qc||(Qc=new RegExp(Vw,"u")),Qc.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"emoji",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Cw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"uuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Mw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"nanoid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Zw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Aw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid2",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Uw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ulid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),w(o,{validation:"url",code:$.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"regex",code:$.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Qw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Xw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Yw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?qw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?eS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?tS(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?rS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Hw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ww.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64url",code:$.invalid_string,message:i.message}),n.dirty()):ee.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:$.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};rn.create=e=>new rn({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...V(e)});uo=class e extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==T.number){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:T.number,received:i.parsedType}),M}let n,o=new Re;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:$.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?nS(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_finite,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};uo.create=e=>new uo({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...V(e)});lo=class e extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==T.bigint)return this._getInvalidInput(t);let n,o=new Re;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return w(r,{code:$.invalid_type,expected:T.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};lo.create=e=>new lo({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...V(e)});po=class extends W{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==T.boolean){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.boolean,received:n.parsedType}),M}return qe(t.data)}};po.create=e=>new po({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...V(e)});mo=class e extends W{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==T.date){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:T.date,received:i.parsedType}),M}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_date}),M}let n=new Re,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ee.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};mo.create=e=>new mo({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...V(e)});fo=class extends W{_parse(t){if(this._getType(t)!==T.symbol){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.symbol,received:n.parsedType}),M}return qe(t.data)}};fo.create=e=>new fo({typeName:Z.ZodSymbol,...V(e)});nn=class extends W{_parse(t){if(this._getType(t)!==T.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.undefined,received:n.parsedType}),M}return qe(t.data)}};nn.create=e=>new nn({typeName:Z.ZodUndefined,...V(e)});on=class extends W{_parse(t){if(this._getType(t)!==T.null){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.null,received:n.parsedType}),M}return qe(t.data)}};on.create=e=>new on({typeName:Z.ZodNull,...V(e)});ho=class extends W{constructor(){super(...arguments),this._any=!0}_parse(t){return qe(t.data)}};ho.create=e=>new ho({typeName:Z.ZodAny,...V(e)});ir=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qe(t.data)}};ir.create=e=>new ir({typeName:Z.ZodUnknown,...V(e)});Pt=class extends W{_parse(t){let r=this._getOrReturnCtx(t);return w(r,{code:$.invalid_type,expected:T.never,received:r.parsedType}),M}};Pt.create=e=>new Pt({typeName:Z.ZodNever,...V(e)});go=class extends W{_parse(t){if(this._getType(t)!==T.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.void,received:n.parsedType}),M}return qe(t.data)}};go.create=e=>new go({typeName:Z.ZodVoid,...V(e)});ar=class e extends W{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==T.array)return w(r,{code:$.invalid_type,expected:T.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?$.too_big:$.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(w(r,{code:$.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(w(r,{code:$.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new ut(r,a,r.path,s)))).then(a=>Re.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ut(r,a,r.path,s)));return Re.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};ar.create=(e,t)=>new ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...V(t)});ot=class e extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==T.object){let u=this._getOrReturnCtx(t);return w(u,{code:$.invalid_type,expected:T.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ut(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Pt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:$.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ut(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(n,u)):Re.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return tn(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof bt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return bg(ee.objectKeys(this.shape))}};ot.create=(e,t)=>new ot({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});ot.strictCreate=(e,t)=>new ot({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});ot.lazycreate=(e,t)=>new ot({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});an=class extends W{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new nt(s.ctx.common.issues));return w(r,{code:$.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new nt(c));return w(r,{code:$.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};an.create=(e,t)=>new an({options:e,typeName:Z.ZodUnion,...V(t)});Lt=e=>e instanceof cn?Lt(e.schema):e instanceof xt?Lt(e.innerType()):e instanceof un?[e.value]:e instanceof ln?e.options:e instanceof dn?ee.objectValues(e.enum):e instanceof pn?Lt(e._def.innerType):e instanceof nn?[void 0]:e instanceof on?[null]:e instanceof bt?[void 0,...Lt(e.unwrap())]:e instanceof Ft?[null,...Lt(e.unwrap())]:e instanceof ca||e instanceof fn?Lt(e.unwrap()):e instanceof mn?Lt(e._def.innerType):[],eu=class e extends W{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.object)return w(r,{code:$.invalid_type,expected:T.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Lt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...V(n)})}};sn=class extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Wc(i)||Wc(a))return M;let s=tu(i.value,a.value);return s.valid?((Xc(i)||Xc(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:$.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};sn.create=(e,t,r)=>new sn({left:e,right:t,typeName:Z.ZodIntersection,...V(r)});qt=class e extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.array)return w(n,{code:$.invalid_type,expected:T.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return w(n,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:$.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ut(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Re.mergeArray(r,a)):Re.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};qt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qt({items:e,typeName:Z.ZodTuple,rest:null,...V(t)})};ru=class e extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.object)return w(n,{code:$.invalid_type,expected:T.object,received:n.parsedType}),M;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new ut(n,s,n.path,s)),value:a._parse(new ut(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Re.mergeObjectAsync(r,o):Re.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof W?new e({keyType:t,valueType:r,typeName:Z.ZodRecord,...V(n)}):new e({keyType:rn.create(),valueType:t,typeName:Z.ZodRecord,...V(r)})}},vo=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.map)return w(n,{code:$.invalid_type,expected:T.map,received:n.parsedType}),M;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new ut(n,s,n.path,[u,"key"])),value:i._parse(new ut(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};vo.create=(e,t,r)=>new vo({valueType:t,keyType:e,typeName:Z.ZodMap,...V(r)});yo=class e extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==T.set)return w(n,{code:$.invalid_type,expected:T.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:$.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(w(n,{code:$.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new ut(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};yo.create=(e,t)=>new yo({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...V(t)});nu=class e extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.function)return w(r,{code:$.invalid_type,expected:T.function,received:r.parsedType}),M;function n(s,c){return sa({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),or].filter(u=>!!u),issueData:{code:$.invalid_arguments,argumentsError:c}})}function o(s,c){return sa({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,so(),or].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Er){let s=this;return qe(async function(...c){let u=new nt([]),l=await s._def.args.parseAsync(c,i).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let s=this;return qe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new nt([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new nt([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qt.create(t).rest(ir.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||qt.create([]).rest(ir.create()),returns:r||ir.create(),typeName:Z.ZodFunction,...V(n)})}},cn=class extends W{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cn.create=(e,t)=>new cn({getter:e,typeName:Z.ZodLazy,...V(t)});un=class extends W{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return w(r,{received:r.data,code:$.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};un.create=(e,t)=>new un({value:e,typeName:Z.ZodLiteral,...V(t)});ln=class e extends W{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return w(r,{expected:ee.joinValues(n),received:r.parsedType,code:$.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return w(r,{received:r.data,code:$.invalid_enum_value,options:n}),M}return qe(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};ln.create=bg;dn=class extends W{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==T.string&&n.parsedType!==T.number){let o=ee.objectValues(r);return w(n,{expected:ee.joinValues(o),received:n.parsedType,code:$.invalid_type}),M}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return w(n,{received:n.data,code:$.invalid_enum_value,options:o}),M}return qe(t.data)}get enum(){return this._def.values}};dn.create=(e,t)=>new dn({values:e,typeName:Z.ZodNativeEnum,...V(t)});Er=class extends W{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.promise&&r.common.async===!1)return w(r,{code:$.invalid_type,expected:T.promise,received:r.parsedType}),M;let n=r.parsedType===T.promise?r.data:Promise.resolve(r.data);return qe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Er.create=(e,t)=>new Er({type:e,typeName:Z.ZodPromise,...V(t)});xt=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{w(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?en(c.value):r.value==="dirty"?en(c.value):c});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?en(s.value):r.value==="dirty"?en(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Tr(a))return M;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Tr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);ee.assertNever(o)}};xt.create=(e,t,r)=>new xt({schema:e,typeName:Z.ZodEffects,effect:t,...V(r)});xt.createWithPreprocess=(e,t,r)=>new xt({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...V(r)});bt=class extends W{_parse(t){return this._getType(t)===T.undefined?qe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:Z.ZodOptional,...V(t)});Ft=class extends W{_parse(t){return this._getType(t)===T.null?qe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ft.create=(e,t)=>new Ft({innerType:e,typeName:Z.ZodNullable,...V(t)});pn=class extends W{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pn.create=(e,t)=>new pn({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...V(t)});mn=class extends W{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return co(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new nt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new nt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};mn.create=(e,t)=>new mn({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...V(t)});_o=class extends W{_parse(t){if(this._getType(t)!==T.nan){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:T.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};_o.create=e=>new _o({typeName:Z.ZodNaN,...V(e)});ca=class extends W{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ua=class e extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),en(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Z.ZodPipeline})}},fn=class extends W{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Tr(o)&&(o.value=Object.freeze(o.value)),o);return co(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};fn.create=(e,t)=>new fn({innerType:e,typeName:Z.ZodReadonly,...V(t)});t1={object:ot.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));r1=rn.create,n1=uo.create,o1=_o.create,i1=lo.create,a1=po.create,s1=mo.create,c1=fo.create,u1=nn.create,l1=on.create,d1=ho.create,p1=ir.create,m1=Pt.create,f1=go.create,h1=ar.create,oS=ot.create,g1=ot.strictCreate,v1=an.create,y1=eu.create,_1=sn.create,$1=qt.create,b1=ru.create,x1=vo.create,k1=yo.create,w1=nu.create,S1=cn.create,z1=un.create,I1=ln.create,T1=dn.create,E1=Er.create,P1=xt.create,O1=bt.create,j1=Ft.create,N1=xt.createWithPreprocess,R1=ua.create});var ou=h(()=>{aa();Yc();gg();ao();xg();ia()});var $o=h(()=>{ou();ou()});function f(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}function Se(e){return e&&Object.assign(la,e),la}var kg,Ot,Pr,la,hn=h(()=>{kg=Object.freeze({status:"aborted"});Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},la={}});var b={};Et(b,{BIGINT_FORMAT_RANGES:()=>fu,Class:()=>au,NUMBER_FORMAT_RANGES:()=>mu,aborted:()=>lr,allowsEval:()=>uu,assert:()=>dS,assertEqual:()=>sS,assertIs:()=>uS,assertNever:()=>lS,assertNotEqual:()=>cS,assignProp:()=>cr,base64ToUint8Array:()=>Og,base64urlToUint8Array:()=>xS,cached:()=>vn,captureStackTrace:()=>pa,cleanEnum:()=>bS,cleanRegex:()=>ko,clone:()=>Fe,cloneDef:()=>mS,createTransparentProxy:()=>_S,defineLazy:()=>J,esc:()=>da,escapeRegex:()=>lt,extend:()=>Ig,finalizeIssue:()=>We,floatSafeRemainder:()=>su,getElementAtPath:()=>fS,getEnumValues:()=>xo,getLengthableOrigin:()=>zo,getParsedType:()=>yS,getSizableOrigin:()=>So,hexToUint8Array:()=>wS,isObject:()=>Or,isPlainObject:()=>ur,issue:()=>yn,joinValues:()=>U,jsonStringifyReplacer:()=>gn,merge:()=>$S,mergeDefs:()=>Vt,normalizeParams:()=>S,nullish:()=>sr,numKeys:()=>vS,objectClone:()=>pS,omit:()=>zg,optionalKeys:()=>pu,parsedType:()=>L,partial:()=>Eg,pick:()=>Sg,prefixIssues:()=>it,primitiveTypes:()=>du,promiseAllObject:()=>hS,propertyKeyTypes:()=>wo,randomString:()=>gS,required:()=>Pg,safeExtend:()=>Tg,shallowClone:()=>lu,slugify:()=>cu,stringifyPrimitive:()=>C,uint8ArrayToBase64:()=>jg,uint8ArrayToBase64url:()=>kS,uint8ArrayToHex:()=>SS,unwrapMessage:()=>bo});function sS(e){return e}function cS(e){return e}function uS(e){}function lS(e){throw new Error("Unexpected value in exhaustive check")}function dS(e){}function xo(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function U(e,t="|"){return e.map(r=>C(r)).join(t)}function gn(e,t){return typeof t=="bigint"?t.toString():t}function vn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function sr(e){return e==null}function ko(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function su(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}function J(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==wg)return n===void 0&&(n=wg,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function pS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function cr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Vt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function mS(e){return Vt(e._zod.def)}function fS(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hS(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function gS(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function da(e){return JSON.stringify(e)}function cu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Or(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ur(e){if(Or(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Or(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function lu(e){return ur(e)?{...e}:Array.isArray(e)?[...e]:e}function vS(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function lt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(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 _S(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function C(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function pu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Sg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Vt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return cr(this,"shape",a),a},checks:[]});return Fe(e,i)}function zg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Vt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return cr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Ig(e,t){if(!ur(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Vt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return cr(this,"shape",i),i}});return Fe(e,o)}function Tg(e,t){if(!ur(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Vt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return cr(this,"shape",n),n}});return Fe(e,r)}function $S(e,t){let r=Vt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return cr(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function Eg(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Vt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return cr(this,"shape",c),c},checks:[]});return Fe(t,a)}function Pg(e,t,r){let n=Vt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return cr(this,"shape",i),i}});return Fe(t,n)}function lr(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 it(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function bo(e){return typeof e=="string"?e:e?.message}function We(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=bo(e.inst?._zod.def?.error?.(e))??bo(t?.error?.(e))??bo(r.customError?.(e))??bo(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function So(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function zo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function L(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 yn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function bS(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Og(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function jg(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function xS(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Og(t+r)}function kS(e){return jg(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wS(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 n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function SS(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var wg,pa,uu,yS,wo,du,mu,fu,au,N=h(()=>{wg=Symbol("evaluating");pa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};uu=vn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});yS=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}`)}},wo=new Set(["string","number","symbol"]),du=new Set(["string","number","bigint","boolean","symbol","undefined"]);mu={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]},fu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};au=class{constructor(...t){}}});function fa(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ha(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Ng,ma,Io,hu=h(()=>{hn();N();Ng=(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,gn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ma=f("$ZodError",Ng),Io=f("$ZodError",Ng,{Parent:Error})});var To,Eo,Po,Oo,jo,_n,No,Ro,Rg,Dg,Zg,Ag,Ug,Cg,Mg,Lg,gu=h(()=>{hn();hu();N();To=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Ot;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>We(c,i,Se())));throw pa(s,o?.callee),s}return a.value},Eo=To(Io),Po=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>We(c,i,Se())));throw pa(s,o?.callee),s}return a.value},Oo=Po(Io),jo=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ot;return i.issues.length?{success:!1,error:new(e??ma)(i.issues.map(a=>We(a,o,Se())))}:{success:!0,data:i.value}},_n=jo(Io),No=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>We(a,o,Se())))}:{success:!0,data:i.value}},Ro=No(Io),Rg=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return To(e)(t,r,o)},Dg=e=>(t,r,n)=>To(e)(t,r,n),Zg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Po(e)(t,r,o)},Ag=e=>async(t,r,n)=>Po(e)(t,r,n),Ug=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jo(e)(t,r,o)},Cg=e=>(t,r,n)=>jo(e)(t,r,n),Mg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return No(e)(t,r,o)},Lg=e=>async(t,r,n)=>No(e)(t,r,n)});var dt={};Et(dt,{base64:()=>ju,base64url:()=>ga,bigint:()=>Uu,boolean:()=>Mu,browserEmail:()=>RS,cidrv4:()=>Pu,cidrv6:()=>Ou,cuid:()=>vu,cuid2:()=>yu,date:()=>Ru,datetime:()=>Zu,domain:()=>AS,duration:()=>ku,e164:()=>Nu,email:()=>Su,emoji:()=>zu,extendedDuration:()=>IS,guid:()=>wu,hex:()=>US,hostname:()=>ZS,html5Email:()=>OS,idnEmail:()=>NS,integer:()=>Cu,ipv4:()=>Iu,ipv6:()=>Tu,ksuid:()=>bu,lowercase:()=>Fu,mac:()=>Eu,md5_base64:()=>MS,md5_base64url:()=>LS,md5_hex:()=>CS,nanoid:()=>xu,null:()=>Lu,number:()=>va,rfc5322Email:()=>jS,sha1_base64:()=>FS,sha1_base64url:()=>VS,sha1_hex:()=>qS,sha256_base64:()=>BS,sha256_base64url:()=>GS,sha256_hex:()=>JS,sha384_base64:()=>HS,sha384_base64url:()=>WS,sha384_hex:()=>KS,sha512_base64:()=>YS,sha512_base64url:()=>QS,sha512_hex:()=>XS,string:()=>Au,time:()=>Du,ulid:()=>_u,undefined:()=>qu,unicodeEmail:()=>qg,uppercase:()=>Vu,uuid:()=>jr,uuid4:()=>TS,uuid6:()=>ES,uuid7:()=>PS,xid:()=>$u});function zu(){return new RegExp(DS,"u")}function Vg(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 Du(e){return new RegExp(`^${Vg(e)}$`)}function Zu(e){let t=Vg({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Fg}T(?:${n})$`)}function Do(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Zo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var vu,yu,_u,$u,bu,xu,ku,IS,wu,jr,TS,ES,PS,Su,OS,jS,qg,NS,RS,DS,Iu,Tu,Eu,Pu,Ou,ju,ga,ZS,AS,Nu,Fg,Ru,Au,Uu,Cu,va,Mu,Lu,qu,Fu,Vu,US,CS,MS,LS,qS,FS,VS,JS,BS,GS,KS,HS,WS,XS,YS,QS,ya=h(()=>{N();vu=/^[cC][^\s-]{8,}$/,yu=/^[0-9a-z]+$/,_u=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$u=/^[0-9a-vA-V]{20}$/,bu=/^[A-Za-z0-9]{27}$/,xu=/^[a-zA-Z0-9_-]{21}$/,ku=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,IS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wu=/^([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})$/,jr=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)$/,TS=jr(4),ES=jr(6),PS=jr(7),Su=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,OS=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jS=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,qg=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,NS=qg,RS=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,DS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Iu=/^(?:(?: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])$/,Tu=/^(([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}|:))$/,Eu=e=>{let t=lt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Pu=/^((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])$/,Ou=/^(([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])$/,ju=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ga=/^[A-Za-z0-9_-]*$/,ZS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,AS=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Nu=/^\+[1-9]\d{6,14}$/,Fg="(?:(?:\\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])))",Ru=new RegExp(`^${Fg}$`);Au=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Uu=/^-?\d+n?$/,Cu=/^-?\d+$/,va=/^-?\d+(?:\.\d+)?$/,Mu=/^(?:true|false)$/i,Lu=/^null$/i,qu=/^undefined$/i,Fu=/^[^A-Z]*$/,Vu=/^[^a-z]*$/,US=/^[0-9a-fA-F]*$/;CS=/^[0-9a-fA-F]{32}$/,MS=Do(22,"=="),LS=Zo(22),qS=/^[0-9a-fA-F]{40}$/,FS=Do(27,"="),VS=Zo(27),JS=/^[0-9a-fA-F]{64}$/,BS=Do(43,"="),GS=Zo(43),KS=/^[0-9a-fA-F]{96}$/,HS=Do(64,""),WS=Zo(64),XS=/^[0-9a-fA-F]{128}$/,YS=Do(86,"=="),QS=Zo(86)});function Jg(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues))}var le,Bg,Ju,Bu,Gg,Kg,Hg,Wg,Xg,Yg,Qg,ev,tv,Ao,rv,nv,ov,iv,av,sv,cv,uv,lv,_a=h(()=>{hn();ya();N();le=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Bg={number:"number",bigint:"bigint",object:"date"},Ju=f("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=Bg[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bu=f("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);let r=Bg[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gg=f("$ZodCheckMultipleOf",(e,t)=>{le.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):su(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})}}),Kg=f("$ZodCheckNumberFormat",(e,t)=>{le.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=mu[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Cu)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Hg=f("$ZodCheckBigIntFormat",(e,t)=>{le.init(e,t);let[r,n]=fu[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Wg=f("$ZodCheckMaxSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:So(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xg=f("$ZodCheckMinSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:So(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Yg=f("$ZodCheckSizeEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:So(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qg=f("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=zo(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ev=f("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=zo(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tv=f("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=zo(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ao=f("$ZodCheckStringFormat",(e,t)=>{var r,n;le.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),rv=f("$ZodCheckRegex",(e,t)=>{Ao.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})}}),nv=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fu),Ao.init(e,t)}),ov=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vu),Ao.init(e,t)}),iv=f("$ZodCheckIncludes",(e,t)=>{le.init(e,t);let r=lt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),av=f("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`^${lt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),sv=f("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`.*${lt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});cv=f("$ZodCheckProperty",(e,t)=>{le.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Jg(o,r,t.property));Jg(n,r,t.property)}}),uv=f("$ZodCheckMimeType",(e,t)=>{le.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),lv=f("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var $a,Gu=h(()=>{$a=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 n=t.split(`
|
|
95
|
+
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
96
|
+
`))}}});var pv,Ku=h(()=>{pv={major:4,minor:3,patch:6}});function wv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function e0(e){if(!ga.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return wv(r)}function t0(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function mv(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function Sa(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...it(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Sv(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=pu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function zv(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(m=>Sa(m,r,d,t,l))):Sa(p,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}function fv(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!lr(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>We(a,n,Se())))}),t)}function hv(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>We(a,n,Se())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}function Hu(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(ur(e)&&ur(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Hu(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Hu(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function gv(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),lr(e))return e;let a=Hu(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}function ba(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function vv(e,t,r,n,o,i,a){e.issues.length&&(wo.has(typeof n)?r.issues.push(...it(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>We(s,a,Se()))})),t.issues.length&&(wo.has(typeof n)?r.issues.push(...it(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>We(s,a,Se()))})),r.value.set(e.value,t.value)}function yv(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function _v(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function $v(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function bv(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function xa(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function ka(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>wa(e,i,t.out,r)):wa(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>wa(e,i,t.in,r)):wa(e,o,t.in,r)}}function wa(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function xv(e){return e.value=Object.freeze(e.value),e}function kv(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(yn(o))}}var F,Nr,se,Wu,Xu,Yu,Qu,el,tl,rl,nl,ol,il,al,sl,cl,ul,ll,dl,pl,ml,fl,hl,gl,vl,yl,_l,$l,za,bl,Uo,Ia,xl,kl,wl,Sl,zl,Il,Tl,El,Pl,Ol,Iv,Tv,Co,jl,Nl,Rl,Ta,Dl,Zl,Al,Ul,Cl,Ml,Ll,Ea,ql,Fl,Vl,Jl,Bl,Gl,Kl,Hl,Wl,Mo,Xl,Yl,Ql,ed,td,rd,nd=h(()=>{_a();hn();Gu();gu();ya();N();Ku();N();F=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pv;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=lr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,m=d._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new Ot;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=lr(a,p)))});else{if(a.issues.length===p)continue;u||(u=lr(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(lr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new Ot;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new Ot;return c.then(u=>o(u,n,s))}return o(c,n,s)}}J(e,"~standard",()=>({validate:o=>{try{let i=_n(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ro(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Nr=f("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Au(e._zod.bag),e._zod.parse=(r,n)=>{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}}),se=f("$ZodStringFormat",(e,t)=>{Ao.init(e,t),Nr.init(e,t)}),Wu=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wu),se.init(e,t)}),Xu=f("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=jr(n))}else t.pattern??(t.pattern=jr());se.init(e,t)}),Yu=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Su),se.init(e,t)}),Qu=f("$ZodURL",(e,t)=>{se.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.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(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.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=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),el=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zu()),se.init(e,t)}),tl=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xu),se.init(e,t)}),rl=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=vu),se.init(e,t)}),nl=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yu),se.init(e,t)}),ol=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_u),se.init(e,t)}),il=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$u),se.init(e,t)}),al=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bu),se.init(e,t)}),sl=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zu(t)),se.init(e,t)}),cl=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ru),se.init(e,t)}),ul=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Du(t)),se.init(e,t)}),ll=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ku),se.init(e,t)}),dl=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Iu),se.init(e,t),e._zod.bag.format="ipv4"}),pl=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tu),se.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})}}}),ml=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Eu(t.delimiter)),se.init(e,t),e._zod.bag.format="mac"}),fl=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pu),se.init(e,t)}),hl=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ou),se.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});gl=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ju),se.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{wv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});vl=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ga),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{e0(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yl=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nu),se.init(e,t)});_l=f("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=r=>{t0(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),$l=f("$ZodCustomStringFormat",(e,t)=>{se.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),za=f("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??va,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),bl=f("$ZodNumberFormat",(e,t)=>{Kg.init(e,t),za.init(e,t)}),Uo=f("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Mu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Ia=f("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Uu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),xl=f("$ZodBigIntFormat",(e,t)=>{Hg.init(e,t),Ia.init(e,t)}),kl=f("$ZodSymbol",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),wl=f("$ZodUndefined",(e,t)=>{F.init(e,t),e._zod.pattern=qu,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Sl=f("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=Lu,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),zl=f("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Il=f("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Tl=f("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),El=f("$ZodVoid",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Pl=f("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});Ol=f("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>mv(u,r,a))):mv(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});Iv=f("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=vn(()=>Sv(t));J(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Or,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let m=d[p],g=m._zod.optout==="optional",y=m._zod.run({value:u[p],issues:[]},c);y instanceof Promise?l.push(y.then(_=>Sa(_,s,p,u,g))):Sa(y,s,p,u,g)}return i?zv(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Tv=f("$ZodObjectJIT",(e,t)=>{Iv.init(e,t);let r=e._zod.parse,n=vn(()=>Sv(t)),o=p=>{let m=new $a(["shape","payload","ctx"]),g=n.value,y=P=>{let z=da(P);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};m.write("const input = payload.value;");let _=Object.create(null),x=0;for(let P of g.keys)_[P]=`key_${x++}`;m.write("const newResult = {};");for(let P of g.keys){let z=_[P],k=da(P),Ie=p[P]?._zod?.optout==="optional";m.write(`const ${z} = ${y(P)};`),Ie?m.write(`
|
|
97
|
+
if (${z}.issues.length) {
|
|
98
|
+
if (${k} in input) {
|
|
99
|
+
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
100
|
+
...iss,
|
|
101
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
102
|
+
})));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (${z}.value === undefined) {
|
|
107
|
+
if (${k} in input) {
|
|
108
|
+
newResult[${k}] = undefined;
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
newResult[${k}] = ${z}.value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
`):m.write(`
|
|
115
|
+
if (${z}.issues.length) {
|
|
116
|
+
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
117
|
+
...iss,
|
|
118
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (${z}.value === undefined) {
|
|
123
|
+
if (${k} in input) {
|
|
124
|
+
newResult[${k}] = undefined;
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
newResult[${k}] = ${z}.value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");let j=m.compile();return(P,z)=>j(p,P,z)},i,a=Or,s=!la.jitless,u=s&&uu.value,l=t.catchall,d;e._zod.parse=(p,m)=>{d??(d=n.value);let g=p.value;return a(g)?s&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),p=i(p,m),l?zv([],g,p,m,d,e):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});Co=f("$ZodUnion",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),J(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>ko(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>fv(c,o,e,i)):fv(s,o,e,i)}});jl=f("$ZodXor",(e,t)=>{Co.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>hv(c,o,e,i)):hv(s,o,e,i)}}),Nl=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Co.init(e,t);let r=e._zod.parse;J(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=vn(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!Or(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Rl=f("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>gv(r,c,u)):gv(r,i,a)}});Ta=f("$ZodTuple",(e,t)=>{F.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>ba(p,n,u))):ba(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let p=t.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(m=>ba(m,n,u))):ba(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});Dl=f("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!ur(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...it(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...it(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&va.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>We(d,n,Se())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...it(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...it(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Zl=f("$ZodMap",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{vv(l,d,r,a,o,e,n)})):vv(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});Al=f("$ZodSet",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>yv(c,r))):yv(s,r)}return i.length?Promise.all(i).then(()=>r):r}});Ul=f("$ZodEnum",(e,t)=>{F.init(e,t);let r=xo(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>wo.has(typeof o)).map(o=>typeof o=="string"?lt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),Cl=f("$ZodLiteral",(e,t)=>{if(F.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(n=>typeof n=="string"?lt(n):n?lt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Ml=f("$ZodFile",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Ll=f("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Ot;return r.value=o,r}});Ea=f("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ko(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>_v(i,r.value)):_v(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ql=f("$ZodExactOptional",(e,t)=>{Ea.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Fl=f("$ZodNullable",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ko(r.source)}|null)$`):void 0}),J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Vl=f("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>$v(i,t)):$v(o,t)}});Jl=f("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Bl=f("$ZodNonOptional",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bv(i,e)):bv(o,e)}});Gl=f("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Kl=f("$ZodCatch",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>We(a,n,Se()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>We(i,n,Se()))},input:r.value}),r.issues=[]),r)}}),Hl=f("$ZodNaN",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Wl=f("$ZodPipe",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>xa(a,t.in,n)):xa(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>xa(i,t.out,n)):xa(o,t.out,n)}});Mo=f("$ZodCodec",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>ka(a,t,n)):ka(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ka(a,t,n)):ka(i,t,n)}}});Xl=f("$ZodReadonly",(e,t)=>{F.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>t.innerType?._zod?.optin),J(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(xv):xv(o)}});Yl=f("$ZodTemplateLiteral",(e,t)=>{F.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||du.has(typeof n))r.push(lt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ql=f("$ZodFunction",(e,t)=>(F.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Eo(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Eo(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Oo(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Oo(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ta({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),ed=f("$ZodPromise",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),td=f("$ZodLazy",(e,t)=>{F.init(e,t),J(e._zod,"innerType",()=>t.getter()),J(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),J(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),J(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),J(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),rd=f("$ZodCustom",(e,t)=>{le.init(e,t),F.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>kv(i,r,n,e));kv(o,r,n,e)}})});var Ev=h(()=>{N()});var Pv=h(()=>{N()});var Ov=h(()=>{N()});var jv=h(()=>{N()});var Nv=h(()=>{N()});var Rv=h(()=>{N()});var Dv=h(()=>{N()});var Zv=h(()=>{N()});function od(){return{localeError:n0()}}var n0,id=h(()=>{N();n0=()=>{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(o){return e[o]??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"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=L(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${C(o.values[0])}`:`Invalid option: expected one of ${U(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${U(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}}});var Av=h(()=>{N()});var Uv=h(()=>{N()});var Cv=h(()=>{N()});var Mv=h(()=>{N()});var Lv=h(()=>{N()});var qv=h(()=>{N()});var Fv=h(()=>{N()});var Vv=h(()=>{N()});var Jv=h(()=>{N()});var Bv=h(()=>{N()});var Gv=h(()=>{N()});var Kv=h(()=>{N()});var Hv=h(()=>{N()});var Wv=h(()=>{N()});var ad=h(()=>{N()});var Xv=h(()=>{ad()});var Yv=h(()=>{N()});var Qv=h(()=>{N()});var ey=h(()=>{N()});var ty=h(()=>{N()});var ry=h(()=>{N()});var ny=h(()=>{N()});var oy=h(()=>{N()});var iy=h(()=>{N()});var ay=h(()=>{N()});var sy=h(()=>{N()});var cy=h(()=>{N()});var uy=h(()=>{N()});var ly=h(()=>{N()});var dy=h(()=>{N()});var py=h(()=>{N()});var my=h(()=>{N()});var sd=h(()=>{N()});var fy=h(()=>{sd()});var hy=h(()=>{N()});var gy=h(()=>{N()});var vy=h(()=>{N()});var yy=h(()=>{N()});var _y=h(()=>{N()});var $y=h(()=>{N()});var Pa=h(()=>{Ev();Pv();Ov();jv();Nv();Rv();Dv();Zv();id();Av();Uv();Cv();Mv();Lv();qv();Fv();Vv();Jv();Bv();Gv();Kv();Hv();Wv();Xv();ad();Yv();Qv();ey();ty();ry();ny();oy();iy();ay();sy();cy();uy();ly();dy();py();my();fy();sd();hy();gy();vy();yy();_y();$y()});function ld(){return new ud}var by,ud,Ve,Lo=h(()=>{ud=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(by=globalThis).__zod_globalRegistry??(by.__zod_globalRegistry=ld());Ve=globalThis.__zod_globalRegistry});function dd(e,t){return new e({type:"string",...S(t)})}function Oa(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function qo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function ja(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Na(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Da(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function Fo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function Za(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function Aa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Ua(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Ca(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Ma(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function qa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Fa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Va(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function pd(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...S(t)})}function Ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Ba(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Ga(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Ka(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function Ha(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function Wa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function md(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function fd(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function hd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function gd(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function vd(e,t){return new e({type:"number",checks:[],...S(t)})}function yd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function _d(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...S(t)})}function $d(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...S(t)})}function bd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...S(t)})}function xd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...S(t)})}function kd(e,t){return new e({type:"boolean",...S(t)})}function wd(e,t){return new e({type:"bigint",...S(t)})}function Sd(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(t)})}function zd(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(t)})}function Id(e,t){return new e({type:"symbol",...S(t)})}function Td(e,t){return new e({type:"undefined",...S(t)})}function Ed(e,t){return new e({type:"null",...S(t)})}function Pd(e){return new e({type:"any"})}function Od(e){return new e({type:"unknown"})}function jd(e,t){return new e({type:"never",...S(t)})}function Nd(e,t){return new e({type:"void",...S(t)})}function Rd(e,t){return new e({type:"date",...S(t)})}function Dd(e,t){return new e({type:"nan",...S(t)})}function Jt(e,t){return new Ju({check:"less_than",...S(t),value:e,inclusive:!1})}function at(e,t){return new Ju({check:"less_than",...S(t),value:e,inclusive:!0})}function Bt(e,t){return new Bu({check:"greater_than",...S(t),value:e,inclusive:!1})}function Je(e,t){return new Bu({check:"greater_than",...S(t),value:e,inclusive:!0})}function Zd(e){return Bt(0,e)}function Ad(e){return Jt(0,e)}function Ud(e){return at(0,e)}function Cd(e){return Je(0,e)}function Rr(e,t){return new Gg({check:"multiple_of",...S(t),value:e})}function Dr(e,t){return new Wg({check:"max_size",...S(t),maximum:e})}function Gt(e,t){return new Xg({check:"min_size",...S(t),minimum:e})}function $n(e,t){return new Yg({check:"size_equals",...S(t),size:e})}function bn(e,t){return new Qg({check:"max_length",...S(t),maximum:e})}function dr(e,t){return new ev({check:"min_length",...S(t),minimum:e})}function xn(e,t){return new tv({check:"length_equals",...S(t),length:e})}function Vo(e,t){return new rv({check:"string_format",format:"regex",...S(t),pattern:e})}function Jo(e){return new nv({check:"string_format",format:"lowercase",...S(e)})}function Bo(e){return new ov({check:"string_format",format:"uppercase",...S(e)})}function Go(e,t){return new iv({check:"string_format",format:"includes",...S(t),includes:e})}function Ko(e,t){return new av({check:"string_format",format:"starts_with",...S(t),prefix:e})}function Ho(e,t){return new sv({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Md(e,t,r){return new cv({check:"property",property:e,schema:t,...S(r)})}function Wo(e,t){return new uv({check:"mime_type",mime:e,...S(t)})}function jt(e){return new lv({check:"overwrite",tx:e})}function Xo(e){return jt(t=>t.normalize(e))}function Yo(){return jt(e=>e.trim())}function Qo(){return jt(e=>e.toLowerCase())}function ei(){return jt(e=>e.toUpperCase())}function Xa(){return jt(e=>cu(e))}function xy(e,t,r){return new e({type:"array",element:t,...S(r)})}function Ld(e,t){return new e({type:"file",...S(t)})}function qd(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Fd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function Vd(e){let t=s0(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(yn(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(yn(o))}},e(r.value,r)));return t}function s0(e,t){let r=new le({check:"custom",...S(t)});return r._zod.check=e,r}function Jd(e){let t=new le({check:"describe"});return t._zod.onattach=[r=>{let n=Ve.get(r)??{};Ve.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Bd(e){let t=new le({check:"meta"});return t._zod.onattach=[r=>{let n=Ve.get(r)??{};Ve.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Gd(e,t){let r=S(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=e.Codec??Mo,c=e.Boolean??Uo,u=e.String??Nr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function kn(e,t,r,n={}){let o=S(n),i={...S(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}var ky=h(()=>{_a();Lo();nd();N()});function Ya(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??Ve,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 fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let p=a.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Be(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Qa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(g=>g);if(d)return{ref:p(d)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${p("__shared")}#/${s}/${m}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
131
|
+
|
|
132
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function es(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=e.seen.get(l),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,u),a._zod.parent===l)for(let y in c)y==="$ref"||y==="allOf"||y in u||delete c[y];if(m.$ref&&p.def)for(let y in c)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(c[y])===JSON.stringify(p.def[y])&&delete c[y]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$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");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ti(t,"input",e.processors),output:ti(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Be(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Be(n.element,r);if(n.type==="set")return Be(n.valueType,r);if(n.type==="lazy")return Be(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Be(n.innerType,r);if(n.type==="intersection")return Be(n.left,r)||Be(n.right,r);if(n.type==="record"||n.type==="map")return Be(n.keyType,r)||Be(n.valueType,r);if(n.type==="pipe")return Be(n.in,r)||Be(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Be(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Be(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Be(o,r))return!0;return!!(n.rest&&Be(n.rest,r))}return!1}var wy,ti,ri=h(()=>{Lo();wy=(e,t={})=>r=>{let n=Ya({...r,processors:t});return fe(e,n),Qa(n,e),es(n,e)},ti=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Ya({...o??{},target:i,io:t,processors:r});return fe(e,a),Qa(a,e),es(a,e)}});var c0,Sy,zy,Iy,Ty,Ey,Py,Oy,jy,Ny,Ry,Dy,Zy,Ay,Uy,Cy,My,Ly,qy,Fy,Vy,Jy,By,Gy,Ky,Hy,Kd,Wy,Xy,Yy,Qy,e_,t_,r_,n_,o_,i_,a_,Hd,s_,wn=h(()=>{ri();N();c0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Sy=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=c0[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zy=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Iy=(e,t,r,n)=>{r.type="boolean"},Ty=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ey=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Py=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Oy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Ny=(e,t,r,n)=>{r.not={}},Ry=(e,t,r,n)=>{},Dy=(e,t,r,n)=>{},Zy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Ay=(e,t,r,n)=>{let o=e._zod.def,i=xo(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Uy=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Cy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},My=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Ly=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},qy=(e,t,r,n)=>{r.type="boolean"},Fy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},By=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Gy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ky=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},Hy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Kd=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Wy=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},Xy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,m)=>fe(p,t,{...n,path:[...n.path,a,m]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Yy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Qy=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},e_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},t_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},r_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},n_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},o_=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},i_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},a_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Hd=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},s_=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o}});var c_=h(()=>{wn();ri()});var u_=h(()=>{});var be=h(()=>{hn();gu();hu();nd();_a();Ku();N();ya();Pa();Lo();Gu();ky();ri();wn();c_();u_()});var Xd=h(()=>{be()});var ts=h(()=>{be();N();Xd()});var d_=h(()=>{be()});var Yd=h(()=>{be();ts()});var p_=h(()=>{be();ts()});var Qd=h(()=>{be();Xd();ts();d_();be();wn();Pa();Yd();Yd();p_()});var ep=h(()=>{Qd();Qd()});function Sn(e){return!!e._zod}function pr(e,t){return Sn(e)?_n(e,t):e.safeParse(t)}function rs(e){if(!e)return;let t;if(Sn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function h_(e){if(Sn(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 n=e.value;if(n!==void 0)return n}var ns=h(()=>{$o();ep()});var os={};Et(os,{endsWith:()=>Ho,gt:()=>Bt,gte:()=>Je,includes:()=>Go,length:()=>xn,lowercase:()=>Jo,lt:()=>Jt,lte:()=>at,maxLength:()=>bn,maxSize:()=>Dr,mime:()=>Wo,minLength:()=>dr,minSize:()=>Gt,multipleOf:()=>Rr,negative:()=>Ad,nonnegative:()=>Cd,nonpositive:()=>Ud,normalize:()=>Xo,overwrite:()=>jt,positive:()=>Zd,property:()=>Md,regex:()=>Vo,size:()=>$n,slugify:()=>Xa,startsWith:()=>Ko,toLowerCase:()=>Qo,toUpperCase:()=>ei,trim:()=>Yo,uppercase:()=>Bo});var is=h(()=>{be()});var Zr={};Et(Zr,{ZodISODate:()=>np,ZodISODateTime:()=>tp,ZodISODuration:()=>sp,ZodISOTime:()=>ip,date:()=>op,datetime:()=>rp,duration:()=>cp,time:()=>ap});function rp(e){return md(tp,e)}function op(e){return fd(np,e)}function ap(e){return hd(ip,e)}function cp(e){return gd(sp,e)}var tp,np,ip,sp,ni=h(()=>{be();ii();tp=f("ZodISODateTime",(e,t)=>{sl.init(e,t),de.init(e,t)});np=f("ZodISODate",(e,t)=>{cl.init(e,t),de.init(e,t)});ip=f("ZodISOTime",(e,t)=>{ul.init(e,t),de.init(e,t)});sp=f("ZodISODuration",(e,t)=>{ll.init(e,t),de.init(e,t)})});var g_,ZA,st,up=h(()=>{be();be();N();g_=(e,t)=>{ma.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ha(e,r)},flatten:{value:r=>fa(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,gn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,gn,2)}},isEmpty:{get(){return e.issues.length===0}}})},ZA=f("ZodError",g_),st=f("ZodError",g_,{Parent:Error})});var v_,y_,__,$_,b_,x_,k_,w_,S_,z_,I_,T_,lp=h(()=>{be();up();v_=To(st),y_=Po(st),__=jo(st),$_=No(st),b_=Rg(st),x_=Dg(st),k_=Zg(st),w_=Ag(st),S_=Ug(st),z_=Cg(st),I_=Mg(st),T_=Lg(st)});var oi={};Et(oi,{ZodAny:()=>N_,ZodArray:()=>A_,ZodBase64:()=>Sp,ZodBase64URL:()=>zp,ZodBigInt:()=>ms,ZodBigIntFormat:()=>Ep,ZodBoolean:()=>ps,ZodCIDRv4:()=>kp,ZodCIDRv6:()=>wp,ZodCUID:()=>gp,ZodCUID2:()=>vp,ZodCatch:()=>n$,ZodCodec:()=>Zp,ZodCustom:()=>ys,ZodCustomStringFormat:()=>si,ZodDate:()=>Op,ZodDefault:()=>X_,ZodDiscriminatedUnion:()=>C_,ZodE164:()=>Ip,ZodEmail:()=>mp,ZodEmoji:()=>fp,ZodEnum:()=>ai,ZodExactOptional:()=>K_,ZodFile:()=>B_,ZodFunction:()=>p$,ZodGUID:()=>as,ZodIPv4:()=>bp,ZodIPv6:()=>xp,ZodIntersection:()=>M_,ZodJWT:()=>Tp,ZodKSUID:()=>$p,ZodLazy:()=>u$,ZodLiteral:()=>J_,ZodMAC:()=>E_,ZodMap:()=>F_,ZodNaN:()=>i$,ZodNanoID:()=>hp,ZodNever:()=>D_,ZodNonOptional:()=>Rp,ZodNull:()=>j_,ZodNullable:()=>W_,ZodNumber:()=>ds,ZodNumberFormat:()=>zn,ZodObject:()=>fs,ZodOptional:()=>Np,ZodPipe:()=>Dp,ZodPrefault:()=>Q_,ZodPromise:()=>d$,ZodReadonly:()=>a$,ZodRecord:()=>vs,ZodSet:()=>V_,ZodString:()=>us,ZodStringFormat:()=>de,ZodSuccess:()=>r$,ZodSymbol:()=>P_,ZodTemplateLiteral:()=>c$,ZodTransform:()=>G_,ZodTuple:()=>L_,ZodType:()=>B,ZodULID:()=>yp,ZodURL:()=>ls,ZodUUID:()=>Kt,ZodUndefined:()=>O_,ZodUnion:()=>hs,ZodUnknown:()=>R_,ZodVoid:()=>Z_,ZodXID:()=>_p,ZodXor:()=>U_,_ZodString:()=>pp,_default:()=>Y_,_function:()=>zz,any:()=>cz,array:()=>Y,base64:()=>J0,base64url:()=>B0,bigint:()=>nz,boolean:()=>ke,catch:()=>o$,check:()=>Iz,cidrv4:()=>F0,cidrv6:()=>V0,codec:()=>kz,cuid:()=>D0,cuid2:()=>Z0,custom:()=>Ap,date:()=>lz,describe:()=>Tz,discriminatedUnion:()=>gs,e164:()=>G0,email:()=>S0,emoji:()=>N0,enum:()=>Ze,exactOptional:()=>H_,file:()=>_z,float32:()=>Q0,float64:()=>ez,function:()=>zz,guid:()=>z0,hash:()=>Y0,hex:()=>X0,hostname:()=>W0,httpUrl:()=>j0,instanceof:()=>Pz,int:()=>dp,int32:()=>tz,int64:()=>oz,intersection:()=>ui,ipv4:()=>M0,ipv6:()=>q0,json:()=>jz,jwt:()=>K0,keyof:()=>dz,ksuid:()=>C0,lazy:()=>l$,literal:()=>R,looseObject:()=>De,looseRecord:()=>hz,mac:()=>L0,map:()=>gz,meta:()=>Ez,nan:()=>xz,nanoid:()=>R0,nativeEnum:()=>yz,never:()=>Pp,nonoptional:()=>t$,null:()=>ci,nullable:()=>ss,nullish:()=>$z,number:()=>ae,object:()=>E,optional:()=>ge,partialRecord:()=>fz,pipe:()=>cs,prefault:()=>e$,preprocess:()=>_s,promise:()=>Sz,readonly:()=>s$,record:()=>he,refine:()=>m$,set:()=>vz,strictObject:()=>pz,string:()=>v,stringFormat:()=>H0,stringbool:()=>Oz,success:()=>bz,superRefine:()=>f$,symbol:()=>az,templateLiteral:()=>wz,transform:()=>jp,tuple:()=>q_,uint32:()=>rz,uint64:()=>iz,ulid:()=>A0,undefined:()=>sz,union:()=>ce,unknown:()=>pe,url:()=>O0,uuid:()=>I0,uuidv4:()=>T0,uuidv6:()=>E0,uuidv7:()=>P0,void:()=>uz,xid:()=>U0,xor:()=>mz});function v(e){return dd(us,e)}function S0(e){return Oa(mp,e)}function z0(e){return qo(as,e)}function I0(e){return ja(Kt,e)}function T0(e){return Na(Kt,e)}function E0(e){return Ra(Kt,e)}function P0(e){return Da(Kt,e)}function O0(e){return Fo(ls,e)}function j0(e){return Fo(ls,{protocol:/^https?$/,hostname:dt.domain,...b.normalizeParams(e)})}function N0(e){return Za(fp,e)}function R0(e){return Aa(hp,e)}function D0(e){return Ua(gp,e)}function Z0(e){return Ca(vp,e)}function A0(e){return Ma(yp,e)}function U0(e){return La(_p,e)}function C0(e){return qa($p,e)}function M0(e){return Fa(bp,e)}function L0(e){return pd(E_,e)}function q0(e){return Va(xp,e)}function F0(e){return Ja(kp,e)}function V0(e){return Ba(wp,e)}function J0(e){return Ga(Sp,e)}function B0(e){return Ka(zp,e)}function G0(e){return Ha(Ip,e)}function K0(e){return Wa(Tp,e)}function H0(e,t,r={}){return kn(si,e,t,r)}function W0(e){return kn(si,"hostname",dt.hostname,e)}function X0(e){return kn(si,"hex",dt.hex,e)}function Y0(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=dt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return kn(si,n,o,t)}function ae(e){return vd(ds,e)}function dp(e){return yd(zn,e)}function Q0(e){return _d(zn,e)}function ez(e){return $d(zn,e)}function tz(e){return bd(zn,e)}function rz(e){return xd(zn,e)}function ke(e){return kd(ps,e)}function nz(e){return wd(ms,e)}function oz(e){return Sd(Ep,e)}function iz(e){return zd(Ep,e)}function az(e){return Id(P_,e)}function sz(e){return Td(O_,e)}function ci(e){return Ed(j_,e)}function cz(){return Pd(N_)}function pe(){return Od(R_)}function Pp(e){return jd(D_,e)}function uz(e){return Nd(Z_,e)}function lz(e){return Rd(Op,e)}function Y(e,t){return xy(A_,e,t)}function dz(e){let t=e._zod.def.shape;return Ze(Object.keys(t))}function E(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new fs(r)}function pz(e,t){return new fs({type:"object",shape:e,catchall:Pp(),...b.normalizeParams(t)})}function De(e,t){return new fs({type:"object",shape:e,catchall:pe(),...b.normalizeParams(t)})}function ce(e,t){return new hs({type:"union",options:e,...b.normalizeParams(t)})}function mz(e,t){return new U_({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}function gs(e,t,r){return new C_({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}function ui(e,t){return new M_({type:"intersection",left:e,right:t})}function q_(e,t,r){let n=t instanceof F,o=n?r:t,i=n?t:null;return new L_({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}function he(e,t,r){return new vs({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function fz(e,t,r){let n=Fe(e);return n._zod.values=void 0,new vs({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function hz(e,t,r){return new vs({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}function gz(e,t,r){return new F_({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}function vz(e,t){return new V_({type:"set",valueType:e,...b.normalizeParams(t)})}function Ze(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ai({type:"enum",entries:r,...b.normalizeParams(t)})}function yz(e,t){return new ai({type:"enum",entries:e,...b.normalizeParams(t)})}function R(e,t){return new J_({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}function _z(e){return Ld(B_,e)}function jp(e){return new G_({type:"transform",transform:e})}function ge(e){return new Np({type:"optional",innerType:e})}function H_(e){return new K_({type:"optional",innerType:e})}function ss(e){return new W_({type:"nullable",innerType:e})}function $z(e){return ge(ss(e))}function Y_(e,t){return new X_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function e$(e,t){return new Q_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function t$(e,t){return new Rp({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}function bz(e){return new r$({type:"success",innerType:e})}function o$(e,t){return new n$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function xz(e){return Dd(i$,e)}function cs(e,t){return new Dp({type:"pipe",in:e,out:t})}function kz(e,t,r){return new Zp({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function s$(e){return new a$({type:"readonly",innerType:e})}function wz(e,t){return new c$({type:"template_literal",parts:e,...b.normalizeParams(t)})}function l$(e){return new u$({type:"lazy",getter:e})}function Sz(e){return new d$({type:"promise",innerType:e})}function zz(e){return new p$({type:"function",input:Array.isArray(e?.input)?q_(e?.input):e?.input??Y(pe()),output:e?.output??pe()})}function Iz(e){let t=new le({check:"custom"});return t._zod.check=e,t}function Ap(e,t){return qd(ys,e??(()=>!0),t)}function m$(e,t={}){return Fd(ys,e,t)}function f$(e){return Vd(e)}function Pz(e,t={}){let r=new ys({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...b.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function jz(e){let t=l$(()=>ce([v(e),ae(),ke(),ci(),Y(t),he(v(),t)]));return t}function _s(e,t){return cs(jp(e),t)}var B,pp,us,de,mp,as,Kt,ls,fp,hp,gp,vp,yp,_p,$p,bp,E_,xp,kp,wp,Sp,zp,Ip,Tp,si,ds,zn,ps,ms,Ep,P_,O_,j_,N_,R_,D_,Z_,Op,A_,fs,hs,U_,C_,M_,L_,vs,F_,V_,ai,J_,B_,G_,Np,K_,W_,X_,Q_,Rp,r$,n$,i$,Dp,Zp,a$,c$,u$,d$,p$,ys,Tz,Ez,Oz,ii=h(()=>{be();be();wn();ri();is();ni();lp();B=f("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ti(e,"input"),output:ti(e,"output")}}),e.toJSONSchema=wy(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>v_(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>__(e,r,n),e.parseAsync=async(r,n)=>y_(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>$_(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>b_(e,r,n),e.decode=(r,n)=>x_(e,r,n),e.encodeAsync=async(r,n)=>k_(e,r,n),e.decodeAsync=async(r,n)=>w_(e,r,n),e.safeEncode=(r,n)=>S_(e,r,n),e.safeDecode=(r,n)=>z_(e,r,n),e.safeEncodeAsync=async(r,n)=>I_(e,r,n),e.safeDecodeAsync=async(r,n)=>T_(e,r,n),e.refine=(r,n)=>e.check(m$(r,n)),e.superRefine=r=>e.check(f$(r)),e.overwrite=r=>e.check(jt(r)),e.optional=()=>ge(e),e.exactOptional=()=>H_(e),e.nullable=()=>ss(e),e.nullish=()=>ge(ss(e)),e.nonoptional=r=>t$(e,r),e.array=()=>Y(e),e.or=r=>ce([e,r]),e.and=r=>ui(e,r),e.transform=r=>cs(e,jp(r)),e.default=r=>Y_(e,r),e.prefault=r=>e$(e,r),e.catch=r=>o$(e,r),e.pipe=r=>cs(e,r),e.readonly=()=>s$(e),e.describe=r=>{let n=e.clone();return Ve.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ve.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ve.get(e);let n=e.clone();return Ve.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),pp=f("_ZodString",(e,t)=>{Nr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Sy(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Vo(...n)),e.includes=(...n)=>e.check(Go(...n)),e.startsWith=(...n)=>e.check(Ko(...n)),e.endsWith=(...n)=>e.check(Ho(...n)),e.min=(...n)=>e.check(dr(...n)),e.max=(...n)=>e.check(bn(...n)),e.length=(...n)=>e.check(xn(...n)),e.nonempty=(...n)=>e.check(dr(1,...n)),e.lowercase=n=>e.check(Jo(n)),e.uppercase=n=>e.check(Bo(n)),e.trim=()=>e.check(Yo()),e.normalize=(...n)=>e.check(Xo(...n)),e.toLowerCase=()=>e.check(Qo()),e.toUpperCase=()=>e.check(ei()),e.slugify=()=>e.check(Xa())}),us=f("ZodString",(e,t)=>{Nr.init(e,t),pp.init(e,t),e.email=r=>e.check(Oa(mp,r)),e.url=r=>e.check(Fo(ls,r)),e.jwt=r=>e.check(Wa(Tp,r)),e.emoji=r=>e.check(Za(fp,r)),e.guid=r=>e.check(qo(as,r)),e.uuid=r=>e.check(ja(Kt,r)),e.uuidv4=r=>e.check(Na(Kt,r)),e.uuidv6=r=>e.check(Ra(Kt,r)),e.uuidv7=r=>e.check(Da(Kt,r)),e.nanoid=r=>e.check(Aa(hp,r)),e.guid=r=>e.check(qo(as,r)),e.cuid=r=>e.check(Ua(gp,r)),e.cuid2=r=>e.check(Ca(vp,r)),e.ulid=r=>e.check(Ma(yp,r)),e.base64=r=>e.check(Ga(Sp,r)),e.base64url=r=>e.check(Ka(zp,r)),e.xid=r=>e.check(La(_p,r)),e.ksuid=r=>e.check(qa($p,r)),e.ipv4=r=>e.check(Fa(bp,r)),e.ipv6=r=>e.check(Va(xp,r)),e.cidrv4=r=>e.check(Ja(kp,r)),e.cidrv6=r=>e.check(Ba(wp,r)),e.e164=r=>e.check(Ha(Ip,r)),e.datetime=r=>e.check(rp(r)),e.date=r=>e.check(op(r)),e.time=r=>e.check(ap(r)),e.duration=r=>e.check(cp(r))});de=f("ZodStringFormat",(e,t)=>{se.init(e,t),pp.init(e,t)}),mp=f("ZodEmail",(e,t)=>{Yu.init(e,t),de.init(e,t)});as=f("ZodGUID",(e,t)=>{Wu.init(e,t),de.init(e,t)});Kt=f("ZodUUID",(e,t)=>{Xu.init(e,t),de.init(e,t)});ls=f("ZodURL",(e,t)=>{Qu.init(e,t),de.init(e,t)});fp=f("ZodEmoji",(e,t)=>{el.init(e,t),de.init(e,t)});hp=f("ZodNanoID",(e,t)=>{tl.init(e,t),de.init(e,t)});gp=f("ZodCUID",(e,t)=>{rl.init(e,t),de.init(e,t)});vp=f("ZodCUID2",(e,t)=>{nl.init(e,t),de.init(e,t)});yp=f("ZodULID",(e,t)=>{ol.init(e,t),de.init(e,t)});_p=f("ZodXID",(e,t)=>{il.init(e,t),de.init(e,t)});$p=f("ZodKSUID",(e,t)=>{al.init(e,t),de.init(e,t)});bp=f("ZodIPv4",(e,t)=>{dl.init(e,t),de.init(e,t)});E_=f("ZodMAC",(e,t)=>{ml.init(e,t),de.init(e,t)});xp=f("ZodIPv6",(e,t)=>{pl.init(e,t),de.init(e,t)});kp=f("ZodCIDRv4",(e,t)=>{fl.init(e,t),de.init(e,t)});wp=f("ZodCIDRv6",(e,t)=>{hl.init(e,t),de.init(e,t)});Sp=f("ZodBase64",(e,t)=>{gl.init(e,t),de.init(e,t)});zp=f("ZodBase64URL",(e,t)=>{vl.init(e,t),de.init(e,t)});Ip=f("ZodE164",(e,t)=>{yl.init(e,t),de.init(e,t)});Tp=f("ZodJWT",(e,t)=>{_l.init(e,t),de.init(e,t)});si=f("ZodCustomStringFormat",(e,t)=>{$l.init(e,t),de.init(e,t)});ds=f("ZodNumber",(e,t)=>{za.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>zy(e,n,o,i),e.gt=(n,o)=>e.check(Bt(n,o)),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.lt=(n,o)=>e.check(Jt(n,o)),e.lte=(n,o)=>e.check(at(n,o)),e.max=(n,o)=>e.check(at(n,o)),e.int=n=>e.check(dp(n)),e.safe=n=>e.check(dp(n)),e.positive=n=>e.check(Bt(0,n)),e.nonnegative=n=>e.check(Je(0,n)),e.negative=n=>e.check(Jt(0,n)),e.nonpositive=n=>e.check(at(0,n)),e.multipleOf=(n,o)=>e.check(Rr(n,o)),e.step=(n,o)=>e.check(Rr(n,o)),e.finite=()=>e;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});zn=f("ZodNumberFormat",(e,t)=>{bl.init(e,t),ds.init(e,t)});ps=f("ZodBoolean",(e,t)=>{Uo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Iy(e,r,n,o)});ms=f("ZodBigInt",(e,t)=>{Ia.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ty(e,n,o,i),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.gt=(n,o)=>e.check(Bt(n,o)),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.lt=(n,o)=>e.check(Jt(n,o)),e.lte=(n,o)=>e.check(at(n,o)),e.max=(n,o)=>e.check(at(n,o)),e.positive=n=>e.check(Bt(BigInt(0),n)),e.negative=n=>e.check(Jt(BigInt(0),n)),e.nonpositive=n=>e.check(at(BigInt(0),n)),e.nonnegative=n=>e.check(Je(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Rr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Ep=f("ZodBigIntFormat",(e,t)=>{xl.init(e,t),ms.init(e,t)});P_=f("ZodSymbol",(e,t)=>{kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ey(e,r,n,o)});O_=f("ZodUndefined",(e,t)=>{wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oy(e,r,n,o)});j_=f("ZodNull",(e,t)=>{Sl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Py(e,r,n,o)});N_=f("ZodAny",(e,t)=>{zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o)});R_=f("ZodUnknown",(e,t)=>{Il.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dy(e,r,n,o)});D_=f("ZodNever",(e,t)=>{Tl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ny(e,r,n,o)});Z_=f("ZodVoid",(e,t)=>{El.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jy(e,r,n,o)});Op=f("ZodDate",(e,t)=>{Pl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Zy(e,n,o,i),e.min=(n,o)=>e.check(Je(n,o)),e.max=(n,o)=>e.check(at(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});A_=f("ZodArray",(e,t)=>{Ol.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ky(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(dr(r,n)),e.nonempty=r=>e.check(dr(1,r)),e.max=(r,n)=>e.check(bn(r,n)),e.length=(r,n)=>e.check(xn(r,n)),e.unwrap=()=>e.element});fs=f("ZodObject",(e,t)=>{Tv.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hy(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ze(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pe()}),e.loose=()=>e.clone({...e._zod.def,catchall:pe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Pp()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>b.extend(e,r),e.safeExtend=r=>b.safeExtend(e,r),e.merge=r=>b.merge(e,r),e.pick=r=>b.pick(e,r),e.omit=r=>b.omit(e,r),e.partial=(...r)=>b.partial(Np,e,r[0]),e.required=(...r)=>b.required(Rp,e,r[0])});hs=f("ZodUnion",(e,t)=>{Co.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.options=t.options});U_=f("ZodXor",(e,t)=>{hs.init(e,t),jl.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.options=t.options});C_=f("ZodDiscriminatedUnion",(e,t)=>{hs.init(e,t),Nl.init(e,t)});M_=f("ZodIntersection",(e,t)=>{Rl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wy(e,r,n,o)});L_=f("ZodTuple",(e,t)=>{Ta.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xy(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});vs=f("ZodRecord",(e,t)=>{Dl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yy(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});F_=f("ZodMap",(e,t)=>{Zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>By(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Dr(...r)),e.size=(...r)=>e.check($n(...r))});V_=f("ZodSet",(e,t)=>{Al.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gy(e,r,n,o),e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Dr(...r)),e.size=(...r)=>e.check($n(...r))});ai=f("ZodEnum",(e,t)=>{Ul.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ay(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ai({...t,checks:[],...b.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ai({...t,checks:[],...b.normalizeParams(o),entries:i})}});J_=f("ZodLiteral",(e,t)=>{Cl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uy(e,r,n,o),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]}})});B_=f("ZodFile",(e,t)=>{Ml.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ly(e,r,n,o),e.min=(r,n)=>e.check(Gt(r,n)),e.max=(r,n)=>e.check(Dr(r,n)),e.mime=(r,n)=>e.check(Wo(Array.isArray(r)?r:[r],n))});G_=f("ZodTransform",(e,t)=>{Ll.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jy(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(b.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Np=f("ZodOptional",(e,t)=>{Ea.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});K_=f("ZodExactOptional",(e,t)=>{ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});W_=f("ZodNullable",(e,t)=>{Fl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});X_=f("ZodDefault",(e,t)=>{Vl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>t_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});Q_=f("ZodPrefault",(e,t)=>{Jl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>r_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Rp=f("ZodNonOptional",(e,t)=>{Bl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>e_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});r$=f("ZodSuccess",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});n$=f("ZodCatch",(e,t)=>{Kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>n_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});i$=f("ZodNaN",(e,t)=>{Hl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cy(e,r,n,o)});Dp=f("ZodPipe",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>o_(e,r,n,o),e.in=t.in,e.out=t.out});Zp=f("ZodCodec",(e,t)=>{Dp.init(e,t),Mo.init(e,t)});a$=f("ZodReadonly",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>i_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});c$=f("ZodTemplateLiteral",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>My(e,r,n,o)});u$=f("ZodLazy",(e,t)=>{td.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>s_(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});d$=f("ZodPromise",(e,t)=>{ed.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>a_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});p$=f("ZodFunction",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vy(e,r,n,o)});ys=f("ZodCustom",(e,t)=>{rd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fy(e,r,n,o)});Tz=Jd,Ez=Bd;Oz=(...e)=>Gd({Codec:Zp,Boolean:ps,String:us},...e)});var h$,g$=h(()=>{be();be();h$||(h$={})});var VA,v$=h(()=>{Lo();is();ni();ii();VA={...oi,...os,iso:Zr}});var y$=h(()=>{be();ii()});var Up=h(()=>{be();ii();is();up();lp();g$();be();id();be();wn();v$();Pa();ni();ni();y$();Se(od())});var Cp=h(()=>{Up();Up()});var _$=h(()=>{Cp();Cp()});var Lp,$$,mr,bs,Te,b$,x$,uU,Zz,Az,qp,ct,li,k$,Ee,pt,mt,Pe,xs,w$,Fp,S$,z$,Vp,di,te,Jp,I$,T$,lU,ks,Uz,ws,Cz,pi,In,E$,Mz,Lz,qz,Fz,Vz,Jz,Bp,Bz,Gz,Gp,Ss,Kz,Hz,zs,Wz,mi,fi,Xz,hi,Tn,Yz,gi,Is,Ts,Es,dU,Ps,Os,js,P$,O$,j$,Kp,N$,vi,En,R$,Qz,eI,tI,rI,nI,Hp,oI,iI,aI,sI,cI,uI,lI,dI,pI,mI,fI,hI,gI,vI,yI,_I,Wp,Xp,Yp,$I,bI,xI,Qp,kI,wI,SI,zI,II,D$,em,TI,Ns,pU,EI,yi,PI,mU,_i,OI,tm,jI,NI,RI,DI,ZI,AI,UI,$s,CI,MI,LI,$i,rm,qI,FI,VI,JI,BI,GI,KI,HI,WI,XI,YI,QI,eT,tT,rT,nT,oT,iT,Pn,aT,sT,cT,uT,lT,dT,pT,nm,mT,fU,hU,gU,vU,yU,_U,G,Mp,On=h(()=>{_$();Lp="2025-11-25",$$=[Lp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mr="io.modelcontextprotocol/related-task",bs="2.0",Te=Ap(e=>e!==null&&(typeof e=="object"||typeof e=="function")),b$=ce([v(),ae().int()]),x$=v(),uU=De({ttl:ce([ae(),ci()]).optional(),pollInterval:ae().optional()}),Zz=E({ttl:ae().optional()}),Az=E({taskId:v()}),qp=De({progressToken:b$.optional(),[mr]:Az.optional()}),ct=E({_meta:qp.optional()}),li=ct.extend({task:Zz.optional()}),k$=e=>li.safeParse(e).success,Ee=E({method:v(),params:ct.loose().optional()}),pt=E({_meta:qp.optional()}),mt=E({method:v(),params:pt.loose().optional()}),Pe=De({_meta:qp.optional()}),xs=ce([v(),ae().int()]),w$=E({jsonrpc:R(bs),id:xs,...Ee.shape}).strict(),Fp=e=>w$.safeParse(e).success,S$=E({jsonrpc:R(bs),...mt.shape}).strict(),z$=e=>S$.safeParse(e).success,Vp=E({jsonrpc:R(bs),id:xs,result:Pe}).strict(),di=e=>Vp.safeParse(e).success;(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"})(te||(te={}));Jp=E({jsonrpc:R(bs),id:xs.optional(),error:E({code:ae().int(),message:v(),data:pe().optional()})}).strict(),I$=e=>Jp.safeParse(e).success,T$=ce([w$,S$,Vp,Jp]),lU=ce([Vp,Jp]),ks=Pe.strict(),Uz=pt.extend({requestId:xs.optional(),reason:v().optional()}),ws=mt.extend({method:R("notifications/cancelled"),params:Uz}),Cz=E({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Ze(["light","dark"]).optional()}),pi=E({icons:Y(Cz).optional()}),In=E({name:v(),title:v().optional()}),E$=In.extend({...In.shape,...pi.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Mz=ui(E({applyDefaults:ke().optional()}),he(v(),pe())),Lz=_s(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ui(E({form:Mz.optional(),url:Te.optional()}),he(v(),pe()).optional())),qz=De({list:Te.optional(),cancel:Te.optional(),requests:De({sampling:De({createMessage:Te.optional()}).optional(),elicitation:De({create:Te.optional()}).optional()}).optional()}),Fz=De({list:Te.optional(),cancel:Te.optional(),requests:De({tools:De({call:Te.optional()}).optional()}).optional()}),Vz=E({experimental:he(v(),Te).optional(),sampling:E({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:Lz.optional(),roots:E({listChanged:ke().optional()}).optional(),tasks:qz.optional()}),Jz=ct.extend({protocolVersion:v(),capabilities:Vz,clientInfo:E$}),Bp=Ee.extend({method:R("initialize"),params:Jz}),Bz=E({experimental:he(v(),Te).optional(),logging:Te.optional(),completions:Te.optional(),prompts:E({listChanged:ke().optional()}).optional(),resources:E({subscribe:ke().optional(),listChanged:ke().optional()}).optional(),tools:E({listChanged:ke().optional()}).optional(),tasks:Fz.optional()}),Gz=Pe.extend({protocolVersion:v(),capabilities:Bz,serverInfo:E$,instructions:v().optional()}),Gp=mt.extend({method:R("notifications/initialized"),params:pt.optional()}),Ss=Ee.extend({method:R("ping"),params:ct.optional()}),Kz=E({progress:ae(),total:ge(ae()),message:ge(v())}),Hz=E({...pt.shape,...Kz.shape,progressToken:b$}),zs=mt.extend({method:R("notifications/progress"),params:Hz}),Wz=ct.extend({cursor:x$.optional()}),mi=Ee.extend({params:Wz.optional()}),fi=Pe.extend({nextCursor:x$.optional()}),Xz=Ze(["working","input_required","completed","failed","cancelled"]),hi=E({taskId:v(),status:Xz,ttl:ce([ae(),ci()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:ge(ae()),statusMessage:ge(v())}),Tn=Pe.extend({task:hi}),Yz=pt.merge(hi),gi=mt.extend({method:R("notifications/tasks/status"),params:Yz}),Is=Ee.extend({method:R("tasks/get"),params:ct.extend({taskId:v()})}),Ts=Pe.merge(hi),Es=Ee.extend({method:R("tasks/result"),params:ct.extend({taskId:v()})}),dU=Pe.loose(),Ps=mi.extend({method:R("tasks/list")}),Os=fi.extend({tasks:Y(hi)}),js=Ee.extend({method:R("tasks/cancel"),params:ct.extend({taskId:v()})}),P$=Pe.merge(hi),O$=E({uri:v(),mimeType:ge(v()),_meta:he(v(),pe()).optional()}),j$=O$.extend({text:v()}),Kp=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),N$=O$.extend({blob:Kp}),vi=Ze(["user","assistant"]),En=E({audience:Y(vi).optional(),priority:ae().min(0).max(1).optional(),lastModified:Zr.datetime({offset:!0}).optional()}),R$=E({...In.shape,...pi.shape,uri:v(),description:ge(v()),mimeType:ge(v()),annotations:En.optional(),_meta:ge(De({}))}),Qz=E({...In.shape,...pi.shape,uriTemplate:v(),description:ge(v()),mimeType:ge(v()),annotations:En.optional(),_meta:ge(De({}))}),eI=mi.extend({method:R("resources/list")}),tI=fi.extend({resources:Y(R$)}),rI=mi.extend({method:R("resources/templates/list")}),nI=fi.extend({resourceTemplates:Y(Qz)}),Hp=ct.extend({uri:v()}),oI=Hp,iI=Ee.extend({method:R("resources/read"),params:oI}),aI=Pe.extend({contents:Y(ce([j$,N$]))}),sI=mt.extend({method:R("notifications/resources/list_changed"),params:pt.optional()}),cI=Hp,uI=Ee.extend({method:R("resources/subscribe"),params:cI}),lI=Hp,dI=Ee.extend({method:R("resources/unsubscribe"),params:lI}),pI=pt.extend({uri:v()}),mI=mt.extend({method:R("notifications/resources/updated"),params:pI}),fI=E({name:v(),description:ge(v()),required:ge(ke())}),hI=E({...In.shape,...pi.shape,description:ge(v()),arguments:ge(Y(fI)),_meta:ge(De({}))}),gI=mi.extend({method:R("prompts/list")}),vI=fi.extend({prompts:Y(hI)}),yI=ct.extend({name:v(),arguments:he(v(),v()).optional()}),_I=Ee.extend({method:R("prompts/get"),params:yI}),Wp=E({type:R("text"),text:v(),annotations:En.optional(),_meta:he(v(),pe()).optional()}),Xp=E({type:R("image"),data:Kp,mimeType:v(),annotations:En.optional(),_meta:he(v(),pe()).optional()}),Yp=E({type:R("audio"),data:Kp,mimeType:v(),annotations:En.optional(),_meta:he(v(),pe()).optional()}),$I=E({type:R("tool_use"),name:v(),id:v(),input:he(v(),pe()),_meta:he(v(),pe()).optional()}),bI=E({type:R("resource"),resource:ce([j$,N$]),annotations:En.optional(),_meta:he(v(),pe()).optional()}),xI=R$.extend({type:R("resource_link")}),Qp=ce([Wp,Xp,Yp,xI,bI]),kI=E({role:vi,content:Qp}),wI=Pe.extend({description:v().optional(),messages:Y(kI)}),SI=mt.extend({method:R("notifications/prompts/list_changed"),params:pt.optional()}),zI=E({title:v().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),II=E({taskSupport:Ze(["required","optional","forbidden"]).optional()}),D$=E({...In.shape,...pi.shape,description:v().optional(),inputSchema:E({type:R("object"),properties:he(v(),Te).optional(),required:Y(v()).optional()}).catchall(pe()),outputSchema:E({type:R("object"),properties:he(v(),Te).optional(),required:Y(v()).optional()}).catchall(pe()).optional(),annotations:zI.optional(),execution:II.optional(),_meta:he(v(),pe()).optional()}),em=mi.extend({method:R("tools/list")}),TI=fi.extend({tools:Y(D$)}),Ns=Pe.extend({content:Y(Qp).default([]),structuredContent:he(v(),pe()).optional(),isError:ke().optional()}),pU=Ns.or(Pe.extend({toolResult:pe()})),EI=li.extend({name:v(),arguments:he(v(),pe()).optional()}),yi=Ee.extend({method:R("tools/call"),params:EI}),PI=mt.extend({method:R("notifications/tools/list_changed"),params:pt.optional()}),mU=E({autoRefresh:ke().default(!0),debounceMs:ae().int().nonnegative().default(300)}),_i=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),OI=ct.extend({level:_i}),tm=Ee.extend({method:R("logging/setLevel"),params:OI}),jI=pt.extend({level:_i,logger:v().optional(),data:pe()}),NI=mt.extend({method:R("notifications/message"),params:jI}),RI=E({name:v().optional()}),DI=E({hints:Y(RI).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),ZI=E({mode:Ze(["auto","required","none"]).optional()}),AI=E({type:R("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(Qp).default([]),structuredContent:E({}).loose().optional(),isError:ke().optional(),_meta:he(v(),pe()).optional()}),UI=gs("type",[Wp,Xp,Yp]),$s=gs("type",[Wp,Xp,Yp,$I,AI]),CI=E({role:vi,content:ce([$s,Y($s)]),_meta:he(v(),pe()).optional()}),MI=li.extend({messages:Y(CI),modelPreferences:DI.optional(),systemPrompt:v().optional(),includeContext:Ze(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:Y(v()).optional(),metadata:Te.optional(),tools:Y(D$).optional(),toolChoice:ZI.optional()}),LI=Ee.extend({method:R("sampling/createMessage"),params:MI}),$i=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens"]).or(v())),role:vi,content:UI}),rm=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:vi,content:ce([$s,Y($s)])}),qI=E({type:R("boolean"),title:v().optional(),description:v().optional(),default:ke().optional()}),FI=E({type:R("string"),title:v().optional(),description:v().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ze(["email","uri","date","date-time"]).optional(),default:v().optional()}),VI=E({type:Ze(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),JI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),BI=E({type:R("string"),title:v().optional(),description:v().optional(),oneOf:Y(E({const:v(),title:v()})),default:v().optional()}),GI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),KI=ce([JI,BI]),HI=E({type:R("array"),title:v().optional(),description:v().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:E({type:R("string"),enum:Y(v())}),default:Y(v()).optional()}),WI=E({type:R("array"),title:v().optional(),description:v().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:E({anyOf:Y(E({const:v(),title:v()}))}),default:Y(v()).optional()}),XI=ce([HI,WI]),YI=ce([GI,KI,XI]),QI=ce([YI,qI,FI,VI]),eT=li.extend({mode:R("form").optional(),message:v(),requestedSchema:E({type:R("object"),properties:he(v(),QI),required:Y(v()).optional()})}),tT=li.extend({mode:R("url"),message:v(),elicitationId:v(),url:v().url()}),rT=ce([eT,tT]),nT=Ee.extend({method:R("elicitation/create"),params:rT}),oT=pt.extend({elicitationId:v()}),iT=mt.extend({method:R("notifications/elicitation/complete"),params:oT}),Pn=Pe.extend({action:Ze(["accept","decline","cancel"]),content:_s(e=>e===null?void 0:e,he(v(),ce([v(),ae(),ke(),Y(v())])).optional())}),aT=E({type:R("ref/resource"),uri:v()}),sT=E({type:R("ref/prompt"),name:v()}),cT=ct.extend({ref:ce([sT,aT]),argument:E({name:v(),value:v()}),context:E({arguments:he(v(),v()).optional()}).optional()}),uT=Ee.extend({method:R("completion/complete"),params:cT}),lT=Pe.extend({completion:De({values:Y(v()).max(100),total:ge(ae().int()),hasMore:ge(ke())})}),dT=E({uri:v().startsWith("file://"),name:v().optional(),_meta:he(v(),pe()).optional()}),pT=Ee.extend({method:R("roots/list"),params:ct.optional()}),nm=Pe.extend({roots:Y(dT)}),mT=mt.extend({method:R("notifications/roots/list_changed"),params:pt.optional()}),fU=ce([Ss,Bp,uT,tm,_I,gI,eI,rI,iI,uI,dI,yi,em,Is,Es,Ps,js]),hU=ce([ws,zs,Gp,mT,gi]),gU=ce([ks,$i,rm,Pn,nm,Ts,Os,Tn]),vU=ce([Ss,LI,nT,pT,Is,Es,Ps,js]),yU=ce([ws,zs,NI,mI,sI,PI,SI,gi,iT]),_U=ce([ks,Gz,lT,wI,vI,tI,nI,aI,Ns,TI,Ts,Os,Tn]),G=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===te.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Mp(o.elicitations,r)}return new e(t,r,n)}},Mp=class extends G{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(te.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}});function fr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Z$=h(()=>{});var Rs=h(()=>{});var om=h(()=>{Rs()});var hr=h(()=>{});var Ds=h(()=>{});var ft=h(()=>{Ds()});var im=h(()=>{$o();hr();we()});var am=h(()=>{hr()});var sm=h(()=>{});var Zs=h(()=>{we()});var cm=h(()=>{we()});var um=h(()=>{hr()});var lm=h(()=>{we()});var dm=h(()=>{we();ft()});var pm=h(()=>{});var mm=h(()=>{we()});var fm=h(()=>{});var QU,As=h(()=>{hr();QU=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});var Us=h(()=>{$o();we();As();Zs();ft()});var hm=h(()=>{we();Us();ft()});var gm=h(()=>{});var vm=h(()=>{ft()});var ym=h(()=>{});var Cs=h(()=>{we()});var _m=h(()=>{we();Cs()});var $m=h(()=>{hr()});var bm=h(()=>{we()});var xm=h(()=>{we();ft()});var km=h(()=>{we()});var wm=h(()=>{we()});var Sm=h(()=>{hr();we()});var zm=h(()=>{we()});var Im=h(()=>{ft()});var Tm=h(()=>{ft()});var Em=h(()=>{we()});var Pm=h(()=>{$o();ft();im();am();sm();Zs();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();wm();Us();Sm();As();zm();Im();Cs();Tm();Em()});var we=h(()=>{Rs();Pm();Ds();ft()});var A$=h(()=>{});var Om=h(()=>{we();om();ft()});var U$=h(()=>{Rs();om();hr();Ds();we();A$();ft();im();am();sm();Zs();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();wm();Em();Us();Sm();As();zm();Im();Cs();Tm();Pm();Om();Om()});function jm(e){let r=rs(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=h_(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Nm(e,t){let r=pr(e,t);if(!r.success)throw r.error;return r.data}var C$=h(()=>{ep();ns();U$()});function M$(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function L$(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];M$(a)&&M$(i)?r[o]={...a,...i}:r[o]=i}return r}var _T,Ms,q$=h(()=>{ns();On();Z$();C$();_T=6e4,Ms=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(ws,r=>{this._oncancel(r)}),this.setNotificationHandler(zs,r=>{this._onprogress(r)}),this.setRequestHandler(Ss,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Is,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new G(te.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Es,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new G(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new G(te.InvalidParams,`Task not found: ${i}`);if(!fr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(fr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[mr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Ps,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new G(te.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(js,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new G(te.InvalidParams,`Task not found: ${r.params.taskId}`);if(fr(o.status))throw new G(te.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new G(te.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof G?o:new G(te.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),G.fromError(te.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});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 n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),di(i)||I$(i)?this._onresponse(i):Fp(i)?this._onrequest(i,a):z$(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=G.fromError(te.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(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(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[mr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:te.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=k$(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new G(te.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:te.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),di(t))n(t);else{let a=new G(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===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 i=!1;if(di(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),di(t))o(t);else{let a=G.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof G?a:new G(te.InternalError,String(a))}}return}let i;try{let a=await this.request(t,Tn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new G(te.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new G(te.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new G(te.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof G?a:new G(te.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=j=>{l(j)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(j){d(j);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[mr]:c}});let g=j=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(j)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let P=j instanceof G?j:new G(te.RequestTimeout,String(j));l(P)};this._responseHandlers.set(p,j=>{if(!n?.signal?.aborted){if(j instanceof Error)return l(j);try{let P=pr(r,j.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let y=n?.timeout??_T,_=()=>g(G.fromError(te.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let x=c?.taskId;if(x){let j=P=>{let z=this._responseHandlers.get(p);z?z(P):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,j),this._enqueueTaskMessage(x,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(p),l(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(j=>{this._cleanupTimeout(p),l(j)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ts,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Os,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},P$,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[mr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,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 s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[mr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=jm(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Nm(t,o);return Promise.resolve(r(a,i))})}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 n=jm(t);this._notificationHandlers.set(n,o=>{let i=Nm(t,o);return Promise.resolve(r(i))})}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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Fp(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new G(te.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new G(te.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new G(te.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new G(te.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=gi.parse({method:"notifications/tasks/status",params:s});await this.notification(c),fr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new G(te.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(fr(s.status))throw new G(te.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=gi.parse({method:"notifications/tasks/status",params:c});await this.notification(u),fr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}}});var wi=I(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.regexpCode=ie.getEsmExportName=ie.getProperty=ie.safeStringify=ie.stringify=ie.strConcat=ie.addCodeArg=ie.str=ie._=ie.nil=ie._Code=ie.Name=ie.IDENTIFIER=ie._CodeOrName=void 0;var xi=class{};ie._CodeOrName=xi;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ar=class extends xi{constructor(t){if(super(),!ie.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}}};ie.Name=Ar;var ht=class extends xi{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,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Ar&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=ht;ie.nil=new ht("");function F$(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Dm(r,t[n]),r.push(e[++n]);return new ht(r)}ie._=F$;var Rm=new ht("+");function V$(e,...t){let r=[ki(e[0])],n=0;for(;n<t.length;)r.push(Rm),Dm(r,t[n]),r.push(Rm,ki(e[++n]));return $T(r),new ht(r)}ie.str=V$;function Dm(e,t){t instanceof ht?e.push(...t._items):t instanceof Ar?e.push(t):e.push(kT(t))}ie.addCodeArg=Dm;function $T(e){let t=1;for(;t<e.length-1;){if(e[t]===Rm){let r=bT(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bT(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Ar||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 Ar))return`"${e}${t.slice(1)}`}function xT(e,t){return t.emptyStr()?e:e.emptyStr()?t:V$`${e}${t}`}ie.strConcat=xT;function kT(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ki(Array.isArray(e)?e.join(","):e)}function wT(e){return new ht(ki(e))}ie.stringify=wT;function ki(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=ki;function ST(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new ht(`.${e}`):F$`[${e}]`}ie.getProperty=ST;function zT(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=zT;function IT(e){return new ht(e.toString())}ie.regexpCode=IT});var Um=I(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.ValueScope=Ye.ValueScopeName=Ye.Scope=Ye.varKinds=Ye.UsedValueState=void 0;var Xe=wi(),Zm=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ls;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ls||(Ye.UsedValueState=Ls={}));Ye.varKinds={const:new Xe.Name("const"),let:new Xe.Name("let"),var:new Xe.Name("var")};var qs=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Xe.Name?t:this.name(t)}name(t){return new Xe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};Ye.Scope=qs;var Fs=class extends Xe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Xe._)`.${new Xe.Name(r)}[${n}]`}};Ye.ValueScopeName=Fs;var TT=(0,Xe._)`\n`,Am=class extends qs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?TT:Xe.nil}}get(){return this._scope}name(t){return new Fs(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Xe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Xe.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ls.Started);let l=r(u);if(l){let d=this.opts.es5?Ye.varKinds.var:Ye.varKinds.const;i=(0,Xe._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Xe._)`${i}${l}${this.opts._n}`;else throw new Zm(u);c.set(u,Ls.Completed)})}return i}};Ye.ValueScope=Am});var H=I(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var re=wi(),wt=Um(),gr=wi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return gr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return gr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return gr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return gr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return gr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return gr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return gr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return gr.Name}});var Gs=Um();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Gs.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Gs.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Gs.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Gs.varKinds}});X.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};var Wt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Cm=class extends Wt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?wt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Nn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},Vs=class extends Wt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof re.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Nn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return Bs(t,this.rhs)}},Mm=class extends Vs{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Lm=class extends Wt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},qm=class extends Wt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Fm=class extends Wt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Vm=class extends Wt{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=Nn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},Si=class extends Wt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(ET(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Mr(t,r.names),{})}},Xt=class extends Si{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Jm=class extends Si{},jn=class extends Xt{};jn.kind="else";var Ur=class e extends Xt{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 n=r.optimizeNodes();r=this.else=Array.isArray(n)?new jn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(J$(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Nn(this.condition,t,r),this}get names(){let t=super.names;return Bs(t,this.condition),this.else&&Mr(t,this.else.names),t}};Ur.kind="if";var Cr=class extends Xt{};Cr.kind="for";var Bm=class extends Cr{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=Nn(this.iteration,t,r),this}get names(){return Mr(super.names,this.iteration.names)}},Gm=class extends Cr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?wt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Bs(super.names,this.from);return Bs(t,this.to)}},Js=class extends Cr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}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=Nn(this.iterable,t,r),this}get names(){return Mr(super.names,this.iterable.names)}},zi=class extends Xt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};zi.kind="func";var Ii=class extends Si{render(t){return"return "+super.render(t)}};Ii.kind="return";var Km=class extends Xt{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 n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Mr(t,this.catch.names),this.finally&&Mr(t,this.finally.names),t}},Ti=class extends Xt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ti.kind="catch";var Ei=class extends Xt{render(t){return"finally"+super.render(t)}};Ei.kind="finally";var Hm=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
133
|
+
`:""},this._extScope=t,this._scope=new wt.Scope({parent:t}),this._nodes=[new Jm]}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 n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Cm(t,i,n)),i}const(t,r,n){return this._def(wt.varKinds.const,t,r,n)}let(t,r,n){return this._def(wt.varKinds.let,t,r,n)}var(t,r,n){return this._def(wt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Vs(t,r,n))}add(t,r){return this._leafNode(new Mm(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==re.nil&&this._leafNode(new Vm(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,re.addCodeArg)(r,o));return r.push("}"),new re._Code(r)}if(t,r,n){if(this._blockNode(new Ur(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ur(t))}else(){return this._elseNode(new jn)}endIf(){return this._endBlockNode(Ur,jn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Bm(t),r)}forRange(t,r,n,o,i=this.opts.es5?wt.varKinds.var:wt.varKinds.let){let a=this._scope.toName(t);return this._for(new Gm(i,a,r,n),()=>o(a))}forOf(t,r,n,o=wt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof re.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,re._)`${a}.length`,s=>{this.var(i,(0,re._)`${a}[${s}]`),n(i)})}return this._for(new Js("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?wt.varKinds.var:wt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,re._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Js("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Cr)}label(t){return this._leafNode(new Lm(t))}break(t){return this._leafNode(new qm(t))}return(t){let r=new Ii;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ii)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Km;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Ti(i),r(i)}return n&&(this._currNode=o.finally=new Ei,this.code(n)),this._endBlockNode(Ti,Ei)}throw(t){return this._leafNode(new Fm(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 n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=re.nil,n,o){return this._blockNode(new zi(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(zi)}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 n=this._currNode;if(n instanceof t||r&&n 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 Ur))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}};X.CodeGen=Hm;function Mr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Bs(e,t){return t instanceof re._CodeOrName?Mr(e,t.names):e}function Nn(e,t,r){if(e instanceof re.Name)return n(e);if(!o(e))return e;return new re._Code(e._items.reduce((i,a)=>(a instanceof re.Name&&(a=n(a)),a instanceof re._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof re._Code&&i._items.some(a=>a instanceof re.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function ET(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function J$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Wm(e)}`}X.not=J$;var PT=B$(X.operators.AND);function OT(...e){return e.reduce(PT)}X.and=OT;var jT=B$(X.operators.OR);function NT(...e){return e.reduce(jT)}X.or=NT;function B$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${Wm(t)} ${e} ${Wm(r)}`}function Wm(e){return e instanceof re.Name?e:(0,re._)`(${e})`}});var ne=I(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var me=H(),RT=wi();function DT(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=DT;function ZT(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(H$(e,t),!W$(t,e.self.RULES.all))}Q.alwaysValidSchema=ZT;function H$(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Q$(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=H$;function W$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=W$;function AT(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=AT;function UT({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}Q.schemaRefOrVal=UT;function CT(e){return X$(decodeURIComponent(e))}Q.unescapeFragment=CT;function MT(e){return encodeURIComponent(Ym(e))}Q.escapeFragment=MT;function Ym(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Ym;function X$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=X$;function LT(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=LT;function G$({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof me.Name?(i instanceof me.Name?e(o,i,a):t(o,i,a),a):i instanceof me.Name?(t(o,a,i),i):r(i,a);return s===me.Name&&!(c instanceof me.Name)?n(o,c):c}}Q.mergeEvaluated={props:G$({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),Qm(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Y$}),items:G$({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Y$(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&Qm(e,r,t),r}Q.evaluatedPropsToName=Y$;function Qm(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=Qm;var K$={};function qT(e,t){return e.scopeValue("func",{ref:t,code:K$[t.code]||(K$[t.code]=new RT._Code(t.code))})}Q.useFunc=qT;var Xm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Xm||(Q.Type=Xm={}));function FT(e,t,r){if(e instanceof me.Name){let n=t===Xm.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+Ym(e)}Q.getErrorPath=FT;function Q$(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=Q$});var Yt=I(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var Ae=H(),VT={data:new Ae.Name("data"),valCxt:new Ae.Name("valCxt"),instancePath:new Ae.Name("instancePath"),parentData:new Ae.Name("parentData"),parentDataProperty:new Ae.Name("parentDataProperty"),rootData:new Ae.Name("rootData"),dynamicAnchors:new Ae.Name("dynamicAnchors"),vErrors:new Ae.Name("vErrors"),errors:new Ae.Name("errors"),this:new Ae.Name("this"),self:new Ae.Name("self"),scope:new Ae.Name("scope"),json:new Ae.Name("json"),jsonPos:new Ae.Name("jsonPos"),jsonLen:new Ae.Name("jsonLen"),jsonPart:new Ae.Name("jsonPart")};ef.default=VT});var Pi=I(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.extendErrors=Ue.resetErrorsCount=Ue.reportExtraError=Ue.reportError=Ue.keyword$DataError=Ue.keywordError=void 0;var oe=H(),Ks=ne(),Ge=Yt();Ue.keywordError={message:({keyword:e})=>(0,oe.str)`must pass "${e}" keyword validation`};Ue.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,oe.str)`"${e}" keyword must be ${t} ($data)`:(0,oe.str)`"${e}" keyword is invalid ($data)`};function JT(e,t=Ue.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=rb(e,t,r);n??(a||s)?eb(i,c):tb(o,(0,oe._)`[${c}]`)}Ue.reportError=JT;function BT(e,t=Ue.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=rb(e,t,r);eb(o,s),i||a||tb(n,Ge.default.vErrors)}Ue.reportExtraError=BT;function GT(e,t){e.assign(Ge.default.errors,t),e.if((0,oe._)`${Ge.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,oe._)`${Ge.default.vErrors}.length`,t),()=>e.assign(Ge.default.vErrors,null)))}Ue.resetErrorsCount=GT;function KT({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ge.default.errors,s=>{e.const(a,(0,oe._)`${Ge.default.vErrors}[${s}]`),e.if((0,oe._)`${a}.instancePath === undefined`,()=>e.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(Ge.default.instancePath,i.errorPath))),e.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,oe._)`${a}.schema`,r),e.assign((0,oe._)`${a}.data`,n))})}Ue.extendErrors=KT;function eb(e,t){let r=e.const("err",t);e.if((0,oe._)`${Ge.default.vErrors} === null`,()=>e.assign(Ge.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${Ge.default.vErrors}.push(${r})`),e.code((0,oe._)`${Ge.default.errors}++`)}function tb(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,oe._)`new ${e.ValidationError}(${t})`):(r.assign((0,oe._)`${n}.errors`,t),r.return(!1))}var Lr={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function rb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:HT(e,t,r)}function HT(e,t,r={}){let{gen:n,it:o}=e,i=[WT(o,r),XT(e,r)];return YT(e,t,i),n.object(...i)}function WT({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Ks.getErrorPath)(t,Ks.Type.Str)}`:e;return[Ge.default.instancePath,(0,oe.strConcat)(Ge.default.instancePath,r)]}function XT({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,oe.str)`${t}/${e}`;return r&&(o=(0,oe.str)`${o}${(0,Ks.getErrorPath)(r,Ks.Type.Str)}`),[Lr.schemaPath,o]}function YT(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Lr.keyword,o],[Lr.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Lr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Lr.schema,a],[Lr.parentSchema,(0,oe._)`${l}${d}`],[Ge.default.data,i]),u&&n.push([Lr.propertyName,u])}});var ob=I(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.boolOrEmptySchema=Rn.topBoolOrEmptySchema=void 0;var QT=Pi(),eE=H(),tE=Yt(),rE={message:"boolean schema is false"};function nE(e){let{gen:t,schema:r,validateName:n}=e;r===!1?nb(e,!1):typeof r=="object"&&r.$async===!0?t.return(tE.default.data):(t.assign((0,eE._)`${n}.errors`,null),t.return(!0))}Rn.topBoolOrEmptySchema=nE;function oE(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),nb(e)):r.var(t,!0)}Rn.boolOrEmptySchema=oE;function nb(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,QT.reportError)(o,rE,void 0,t)}});var tf=I(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.getRules=Dn.isJSONType=void 0;var iE=["string","number","integer","boolean","null","object","array"],aE=new Set(iE);function sE(e){return typeof e=="string"&&aE.has(e)}Dn.isJSONType=sE;function cE(){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:{}}}Dn.getRules=cE});var rf=I(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.shouldUseRule=vr.shouldUseGroup=vr.schemaHasRulesForType=void 0;function uE({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&ib(e,n)}vr.schemaHasRulesForType=uE;function ib(e,t){return t.rules.some(r=>ab(e,r))}vr.shouldUseGroup=ib;function ab(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}vr.shouldUseRule=ab});var Oi=I(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.reportTypeError=Ce.checkDataTypes=Ce.checkDataType=Ce.coerceAndCheckDataType=Ce.getJSONTypes=Ce.getSchemaTypes=Ce.DataType=void 0;var lE=tf(),dE=rf(),pE=Pi(),K=H(),sb=ne(),Zn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Zn||(Ce.DataType=Zn={}));function mE(e){let t=cb(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}Ce.getSchemaTypes=mE;function cb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(lE.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ce.getJSONTypes=cb;function fE(e,t){let{gen:r,data:n,opts:o}=e,i=hE(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,dE.schemaHasRulesForType)(e,t[0]));if(a){let s=of(t,n,o.strictNumbers,Zn.Wrong);r.if(s,()=>{i.length?gE(e,t,i):af(e)})}return a}Ce.coerceAndCheckDataType=fE;var ub=new Set(["string","number","integer","boolean","null"]);function hE(e,t){return t?e.filter(r=>ub.has(r)||t==="array"&&r==="array"):[]}function gE(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,K._)`typeof ${o}`),s=n.let("coerced",(0,K._)`undefined`);i.coerceTypes==="array"&&n.if((0,K._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,K._)`${o}[0]`).assign(a,(0,K._)`typeof ${o}`).if(of(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,K._)`${s} !== undefined`);for(let u of r)(ub.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),af(e),n.endIf(),n.if((0,K._)`${s} !== undefined`,()=>{n.assign(o,s),vE(e,s)});function c(u){switch(u){case"string":n.elseIf((0,K._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,K._)`"" + ${o}`).elseIf((0,K._)`${o} === null`).assign(s,(0,K._)`""`);return;case"number":n.elseIf((0,K._)`${a} == "boolean" || ${o} === null
|
|
134
|
+
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,K._)`+${o}`);return;case"integer":n.elseIf((0,K._)`${a} === "boolean" || ${o} === null
|
|
135
|
+
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,K._)`+${o}`);return;case"boolean":n.elseIf((0,K._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,K._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,K._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,K._)`${a} === "string" || ${a} === "number"
|
|
136
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function vE({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,K._)`${t} !== undefined`,()=>e.assign((0,K._)`${t}[${r}]`,n))}function nf(e,t,r,n=Zn.Correct){let o=n===Zn.Correct?K.operators.EQ:K.operators.NEQ,i;switch(e){case"null":return(0,K._)`${t} ${o} null`;case"array":i=(0,K._)`Array.isArray(${t})`;break;case"object":i=(0,K._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,K._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,K._)`typeof ${t} ${o} ${e}`}return n===Zn.Correct?i:(0,K.not)(i);function a(s=K.nil){return(0,K.and)((0,K._)`typeof ${t} == "number"`,s,r?(0,K._)`isFinite(${t})`:K.nil)}}Ce.checkDataType=nf;function of(e,t,r,n){if(e.length===1)return nf(e[0],t,r,n);let o,i=(0,sb.toHash)(e);if(i.array&&i.object){let a=(0,K._)`typeof ${t} != "object"`;o=i.null?a:(0,K._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=K.nil;i.number&&delete i.integer;for(let a in i)o=(0,K.and)(o,nf(a,t,r,n));return o}Ce.checkDataTypes=of;var yE={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,K._)`{type: ${e}}`:(0,K._)`{type: ${t}}`};function af(e){let t=_E(e);(0,pE.reportError)(t,yE)}Ce.reportTypeError=af;function _E(e){let{gen:t,data:r,schema:n}=e,o=(0,sb.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var db=I(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.assignDefaults=void 0;var An=H(),$E=ne();function bE(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)lb(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>lb(e,i,o.default))}Hs.assignDefaults=bE;function lb(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,An._)`${i}${(0,An.getProperty)(t)}`;if(o){(0,$E.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,An._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,An._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,An._)`${s} = ${(0,An.stringify)(r)}`)}});var gt=I(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.validateUnion=ue.validateArray=ue.usePattern=ue.callValidateCode=ue.schemaProperties=ue.allSchemaProperties=ue.noPropertyInData=ue.propertyInData=ue.isOwnProperty=ue.hasPropFunc=ue.reportMissingProp=ue.checkMissingProp=ue.checkReportMissingProp=void 0;var ve=H(),sf=ne(),yr=Yt(),xE=ne();function kE(e,t){let{gen:r,data:n,it:o}=e;r.if(uf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ve._)`${t}`},!0),e.error()})}ue.checkReportMissingProp=kE;function wE({gen:e,data:t,it:{opts:r}},n,o){return(0,ve.or)(...n.map(i=>(0,ve.and)(uf(e,t,i,r.ownProperties),(0,ve._)`${o} = ${i}`)))}ue.checkMissingProp=wE;function SE(e,t){e.setParams({missingProperty:t},!0),e.error()}ue.reportMissingProp=SE;function pb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}ue.hasPropFunc=pb;function cf(e,t,r){return(0,ve._)`${pb(e)}.call(${t}, ${r})`}ue.isOwnProperty=cf;function zE(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} !== undefined`;return n?(0,ve._)`${o} && ${cf(e,t,r)}`:o}ue.propertyInData=zE;function uf(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} === undefined`;return n?(0,ve.or)(o,(0,ve.not)(cf(e,t,r))):o}ue.noPropertyInData=uf;function mb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ue.allSchemaProperties=mb;function IE(e,t){return mb(t).filter(r=>!(0,sf.alwaysValidSchema)(e,t[r]))}ue.schemaProperties=IE;function TE({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ve._)`${e}, ${t}, ${n}${o}`:t,d=[[yr.default.instancePath,(0,ve.strConcat)(yr.default.instancePath,i)],[yr.default.parentData,a.parentData],[yr.default.parentDataProperty,a.parentDataProperty],[yr.default.rootData,yr.default.rootData]];a.opts.dynamicRef&&d.push([yr.default.dynamicAnchors,yr.default.dynamicAnchors]);let p=(0,ve._)`${l}, ${r.object(...d)}`;return c!==ve.nil?(0,ve._)`${s}.call(${c}, ${p})`:(0,ve._)`${s}(${p})`}ue.callValidateCode=TE;var EE=(0,ve._)`new RegExp`;function PE({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ve._)`${o.code==="new RegExp"?EE:(0,xE.useFunc)(e,o)}(${r}, ${n})`})}ue.usePattern=PE;function OE(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ve._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:sf.Type.Num},i),t.if((0,ve.not)(i),s)})}}ue.validateArray=OE;function jE(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,sf.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ve._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ve.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ue.validateUnion=jE});var gb=I(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;var Ke=H(),qr=Yt(),NE=gt(),RE=Pi();function DE(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=hb(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ke.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Nt.macroKeywordCode=DE;function ZE(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;UE(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=hb(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)y(),t.modifying&&fb(e),_(()=>e.error());else{let x=t.async?m():g();t.modifying&&fb(e),_(()=>AE(e,x))}}function m(){let x=n.let("ruleErrs",null);return n.try(()=>y((0,Ke._)`await `),j=>n.assign(d,!1).if((0,Ke._)`${j} instanceof ${c.ValidationError}`,()=>n.assign(x,(0,Ke._)`${j}.errors`),()=>n.throw(j))),x}function g(){let x=(0,Ke._)`${l}.errors`;return n.assign(x,null),y(Ke.nil),x}function y(x=t.async?(0,Ke._)`await `:Ke.nil){let j=c.opts.passContext?qr.default.this:qr.default.self,P=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${x}${(0,NE.callValidateCode)(e,l,j,P)}`,t.modifying)}function _(x){var j;n.if((0,Ke.not)((j=t.valid)!==null&&j!==void 0?j:d),x)}}Nt.funcKeywordCode=ZE;function fb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ke._)`${n.parentData}[${n.parentDataProperty}]`))}function AE(e,t){let{gen:r}=e;r.if((0,Ke._)`Array.isArray(${t})`,()=>{r.assign(qr.default.vErrors,(0,Ke._)`${qr.default.vErrors} === null ? ${t} : ${qr.default.vErrors}.concat(${t})`).assign(qr.default.errors,(0,Ke._)`${qr.default.vErrors}.length`),(0,RE.extendErrors)(e)},()=>e.error())}function UE({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function hb(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,Ke.stringify)(r)})}function CE(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Nt.validSchemaType=CE;function ME({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Nt.validateKeywordUsage=ME});var yb=I(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendSubschemaMode=_r.extendSubschemaData=_r.getSubschema=void 0;var Rt=H(),vb=ne();function LE(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Rt._)`${e.schemaPath}${(0,Rt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Rt._)`${e.schemaPath}${(0,Rt.getProperty)(t)}${(0,Rt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,vb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}_r.getSubschema=LE;function qE(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,Rt._)`${t.data}${(0,Rt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Rt.str)`${u}${(0,vb.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Rt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Rt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);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]}}_r.extendSubschemaData=qE;function FE(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}_r.extendSubschemaMode=FE});var lf=I((fL,_b)=>{"use strict";_b.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 n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var bb=I((hL,$b)=>{"use strict";var $r=$b.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ws(t,n,o,e,"",e)};$r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};$r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};$r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};$r.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 Ws(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in $r.arrayKeywords)for(var p=0;p<d.length;p++)Ws(e,t,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in $r.propsKeywords){if(d&&typeof d=="object")for(var m in d)Ws(e,t,r,d[m],o+"/"+l+"/"+VE(m),i,o,l,n,m)}else(l in $r.keywords||e.allKeys&&!(l in $r.skipKeywords))&&Ws(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function VE(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ji=I(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.getSchemaRefs=Qe.resolveUrl=Qe.normalizeId=Qe._getFullPath=Qe.getFullPath=Qe.inlineRef=void 0;var JE=ne(),BE=lf(),GE=bb(),KE=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function HE(e,t=!0){return typeof e=="boolean"?!0:t===!0?!df(e):t?xb(e)<=t:!1}Qe.inlineRef=HE;var WE=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function df(e){for(let t in e){if(WE.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(df)||typeof r=="object"&&df(r))return!0}return!1}function xb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!KE.has(r)&&(typeof e[r]=="object"&&(0,JE.eachItem)(e[r],n=>t+=xb(n)),t===1/0))return 1/0}return t}function kb(e,t="",r){r!==!1&&(t=Un(t));let n=e.parse(t);return wb(e,n)}Qe.getFullPath=kb;function wb(e,t){return e.serialize(t).split("#")[0]+"#"}Qe._getFullPath=wb;var XE=/#\/?$/;function Un(e){return e?e.replace(XE,""):""}Qe.normalizeId=Un;function YE(e,t,r){return r=Un(r),e.resolve(t,r)}Qe.resolveUrl=YE;var QE=/^[a-z_][-a-z0-9._]*$/i;function eP(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Un(e[r]||t),i={"":o},a=kb(n,o,!1),s={},c=new Set;return GE(e,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let y=a+p,_=i[g];typeof d[r]=="string"&&(_=x.call(this,d[r])),j.call(this,d.$anchor),j.call(this,d.$dynamicAnchor),i[p]=_;function x(P){let z=this.opts.uriResolver.resolve;if(P=Un(_?z(_,P):P),c.has(P))throw l(P);c.add(P);let k=this.refs[P];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?u(d,k.schema,P):P!==Un(y)&&(P[0]==="#"?(u(d,s[P],P),s[P]=d):this.refs[P]=y),P}function j(P){if(typeof P=="string"){if(!QE.test(P))throw new Error(`invalid anchor "${P}"`);x.call(this,`#${P}`)}}}),s;function u(d,p,m){if(p!==void 0&&!BE(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Qe.getSchemaRefs=eP});var Di=I(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.getData=br.KeywordCxt=br.validateFunctionCode=void 0;var Eb=ob(),Sb=Oi(),mf=rf(),Xs=Oi(),tP=db(),Ri=gb(),pf=yb(),D=H(),q=Yt(),rP=ji(),Qt=ne(),Ni=Pi();function nP(e){if(jb(e)&&(Nb(e),Ob(e))){aP(e);return}Pb(e,()=>(0,Eb.topBoolOrEmptySchema)(e))}br.validateFunctionCode=nP;function Pb({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,D._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${zb(r,o)}`),iP(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${oP(o)}`,n.$async,()=>e.code(zb(r,o)).code(i))}function oP(e){return(0,D._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,D._)`, ${q.default.dynamicAnchors}={}`:D.nil}}={}`}function iP(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,D._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,D._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,D._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,D._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,D._)`""`),e.var(q.default.parentData,(0,D._)`undefined`),e.var(q.default.parentDataProperty,(0,D._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`{}`)})}function aP(e){let{schema:t,opts:r,gen:n}=e;Pb(e,()=>{r.$comment&&t.$comment&&Db(e),dP(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&sP(e),Rb(e),fP(e)})}function sP(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function zb(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function cP(e,t){if(jb(e)&&(Nb(e),Ob(e))){uP(e,t);return}(0,Eb.boolOrEmptySchema)(e,t)}function Ob({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 jb(e){return typeof e.schema!="boolean"}function uP(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Db(e),pP(e),mP(e);let i=n.const("_errs",q.default.errors);Rb(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function Nb(e){(0,Qt.checkUnknownRules)(e),lP(e)}function Rb(e,t){if(e.opts.jtd)return Ib(e,[],!1,t);let r=(0,Sb.getSchemaTypes)(e.schema),n=(0,Sb.coerceAndCheckDataType)(e,r);Ib(e,r,!n,t)}function lP(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Qt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dP(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Qt.checkStrictMode)(e,"default is ignored in the schema root")}function pP(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rP.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function mP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Db({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,D._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function fP(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,D._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,D._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,q.default.vErrors),i.unevaluated&&hP(e),t.return((0,D._)`${q.default.errors} === 0`))}function hP({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Ib(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Qt.schemaHasRulesButRef)(i,l))){o.block(()=>Ab(e,"$ref",l.all.$ref.definition));return}c.jtd||gP(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,mf.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Xs.checkDataType)(p.type,a,c.strictNumbers)),Tb(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Xs.reportTypeError)(e)),o.endIf()):Tb(e,p),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Tb(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,tP.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,mf.shouldUseRule)(n,i)&&Ab(e,i.keyword,i.definition,t.type)})}function gP(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(vP(e,t),e.opts.allowUnionTypes||yP(e,t),_P(e,e.dataTypes))}function vP(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Zb(e.dataTypes,r)||ff(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bP(e,t)}}function yP(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ff(e,"use allowUnionTypes to allow union type keyword")}function _P(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mf.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>$P(t,a))&&ff(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function $P(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Zb(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bP(e,t){let r=[];for(let n of e.dataTypes)Zb(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ff(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Qt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ys=class{constructor(t,r,n){if((0,Ri.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Qt.schemaRefOrVal)(t,this.schema,n,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",Ub(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Ri.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",q.default.errors))}result(t,r,n){this.failResult((0,D.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():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,D.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,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ni.reportExtraError:Ni.reportError)(this,this.def.error,r)}$dataError(){(0,Ni.reportError)(this,this.def.$dataError||Ni.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ni.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,n=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,Xs.checkDataTypes)(c,r,i.opts.strictNumbers,Xs.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,pf.getSubschema)(this.it,t);(0,pf.extendSubschemaData)(n,this.it,t),(0,pf.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return cP(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Qt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Qt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,D.Name)),!0}};br.KeywordCxt=Ys;function Ab(e,t,r,n){let o=new Ys(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Ri.funcKeywordCode)(o,r):"macro"in r?(0,Ri.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Ri.funcKeywordCode)(o,r)}var xP=/^\/(?:[^~]|~0|~1)*$/,kP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ub(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!xP.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=kP.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,D._)`${i}${(0,D.getProperty)((0,Qt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}br.getData=Ub});var Qs=I(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var hf=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gf.default=hf});var Zi=I(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var vf=ji(),yf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,vf.resolveUrl)(t,r,n),this.missingSchema=(0,vf.normalizeId)((0,vf.getFullPath)(t,this.missingRef))}};_f.default=yf});var tc=I(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.resolveSchema=vt.getCompilingSchema=vt.resolveRef=vt.compileSchema=vt.SchemaEnv=void 0;var St=H(),wP=Qs(),Fr=Yt(),zt=ji(),Cb=ne(),SP=Di(),Cn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=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,zt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};vt.SchemaEnv=Cn;function bf(e){let t=Mb.call(this,e);if(t)return t;let r=(0,zt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new St.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:wP.default,code:(0,St._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Fr.default.data,parentData:Fr.default.parentData,parentDataProperty:Fr.default.parentDataProperty,dataNames:[Fr.default.data],dataPathArr:[St.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,St.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:St.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,St._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,SP.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Fr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Fr.default.self}`,`${Fr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:y}=u;m.evaluated={props:g instanceof St.Name?void 0:g,items:y instanceof St.Name?void 0:y,dynamicProps:g instanceof St.Name,dynamicItems:y instanceof St.Name},m.source&&(m.source.evaluated=(0,St.stringify)(m.evaluated))}return e.validate=m,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}vt.compileSchema=bf;function zP(e,t,r){var n;r=(0,zt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=EP.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new Cn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=IP.call(this,i)}vt.resolveRef=zP;function IP(e){return(0,zt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bf.call(this,e)}function Mb(e){for(let t of this._compilations)if(TP(t,e))return t}vt.getCompilingSchema=Mb;function TP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function EP(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||ec.call(this,e,t)}function ec(e,t){let r=this.opts.uriResolver.parse(t),n=(0,zt._getFullPath)(this.opts.uriResolver,r),o=(0,zt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return $f.call(this,r,e);let i=(0,zt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=ec.call(this,e,a);return typeof s?.schema!="object"?void 0:$f.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||bf.call(this,a),i===(0,zt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,zt.resolveUrl)(this.opts.uriResolver,o,u)),new Cn({schema:s,schemaId:c,root:e,baseId:o})}return $f.call(this,r,a)}}vt.resolveSchema=ec;var PP=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $f(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Cb.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!PP.has(s)&&u&&(t=(0,zt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Cb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,zt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=ec.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new Cn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Lb=I((bL,OP)=>{OP.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 kf=I((xL,Jb)=>{"use strict";var jP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Fb=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function xf(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var NP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function qb(e){return e.length=0,!0}function RP(e,t,r){if(e.length){let n=xf(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function DP(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=RP;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=qb}else{o.push(u);continue}}return o.length&&(s===qb?r.zone=o.join(""):a?n.push(o.join("")):n.push(xf(o))),r.address=n.join(""),r}function Vb(e){if(ZP(e,":")<2)return{host:e,isIPV6:!1};let t=DP(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZP(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function AP(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===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(o===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((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function UP(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function CP(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Fb(r)){let n=Vb(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}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}Jb.exports={nonSimpleDomain:NP,recomposeAuthority:CP,normalizeComponentEncoding:UP,removeDotSegments:AP,isIPv4:Fb,isUUID:jP,normalizeIPv6:Vb,stringArrayToHexStripped:xf}});var Wb=I((kL,Hb)=>{"use strict";var{isUUID:MP}=kf(),LP=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,qP=["http","https","ws","wss","urn","urn:uuid"];function FP(e){return qP.indexOf(e)!==-1}function wf(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 Bb(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Gb(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 VP(e){return e.secure=wf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function JP(e){if((e.port===(wf(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 BP(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(LP);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=Sf(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function GP(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=Sf(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function KP(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!MP(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function HP(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Kb={scheme:"http",domainHost:!0,parse:Bb,serialize:Gb},WP={scheme:"https",domainHost:Kb.domainHost,parse:Bb,serialize:Gb},rc={scheme:"ws",domainHost:!0,parse:VP,serialize:JP},XP={scheme:"wss",domainHost:rc.domainHost,parse:rc.parse,serialize:rc.serialize},YP={scheme:"urn",parse:BP,serialize:GP,skipNormalize:!0},QP={scheme:"urn:uuid",parse:KP,serialize:HP,skipNormalize:!0},nc={http:Kb,https:WP,ws:rc,wss:XP,urn:YP,"urn:uuid":QP};Object.setPrototypeOf(nc,null);function Sf(e){return e&&(nc[e]||nc[e.toLowerCase()])||void 0}Hb.exports={wsIsSecure:wf,SCHEMES:nc,isValidSchemeName:FP,getSchemeHandler:Sf}});var Qb=I((wL,ic)=>{"use strict";var{normalizeIPv6:eO,removeDotSegments:Ai,recomposeAuthority:tO,normalizeComponentEncoding:oc,isIPv4:rO,nonSimpleDomain:nO}=kf(),{SCHEMES:oO,getSchemeHandler:Xb}=Wb();function iO(e,t){return typeof e=="string"?e=Dt(er(e,t),t):typeof e=="object"&&(e=er(Dt(e,t),t)),e}function aO(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Yb(er(e,n),er(t,n),n,!0);return n.skipEscape=!0,Dt(o,n)}function Yb(e,t,r,n){let o={};return n||(e=er(Dt(e,r),r),t=er(Dt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ai(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ai(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Ai(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Ai(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function sO(e,t,r){return typeof e=="string"?(e=unescape(e),e=Dt(oc(er(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Dt(oc(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Dt(oc(er(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Dt(oc(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Dt(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:""},n=Object.assign({},t),o=[],i=Xb(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=tO(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Ai(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var cO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function er(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(cO);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(rO(n.host)===!1){let c=eO(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Xb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&nO(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var zf={SCHEMES:oO,normalize:iO,resolve:aO,resolveComponent:Yb,equal:sO,serialize:Dt,parse:er};ic.exports=zf;ic.exports.default=zf;ic.exports.fastUri=zf});var tx=I(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var ex=Qb();ex.code='require("ajv/dist/runtime/uri").default';If.default=ex});var ux=I(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.CodeGen=je.Name=je.nil=je.stringify=je.str=je._=je.KeywordCxt=void 0;var uO=Di();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return uO.KeywordCxt}});var Mn=H();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Mn._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Mn.str}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Mn.stringify}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Mn.nil}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Mn.Name}});Object.defineProperty(je,"CodeGen",{enumerable:!0,get:function(){return Mn.CodeGen}});var lO=Qs(),ax=Zi(),dO=tf(),Ui=tc(),pO=H(),Ci=ji(),ac=Oi(),Ef=ne(),rx=Lb(),mO=tx(),sx=(e,t)=>new RegExp(e,t);sx.code="new RegExp";var fO=["removeAdditional","useDefaults","coerceTypes"],hO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),gO={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."},vO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nx=200;function yO(e){var t,r,n,o,i,a,s,c,u,l,d,p,m,g,y,_,x,j,P,z,k,$e,Ie,Me,$t;let Ct=e.strict,wr=(t=e.code)===null||t===void 0?void 0:t.optimize,Kr=wr===!0||wr===void 0?1:wr||0,tr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:sx,Xi=(o=e.uriResolver)!==null&&o!==void 0?o:mO.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Ct)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Ct)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ct)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Ct)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:Ct)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Kr,regExp:tr}:{optimize:Kr,regExp:tr},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:nx,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:nx,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(P=e.inlineRefs)!==null&&P!==void 0?P:!0,schemaId:(z=e.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:($e=e.validateSchema)!==null&&$e!==void 0?$e:!0,validateFormats:(Ie=e.validateFormats)!==null&&Ie!==void 0?Ie:!0,unicodeRegExp:(Me=e.unicodeRegExp)!==null&&Me!==void 0?Me:!0,int32range:($t=e.int32range)!==null&&$t!==void 0?$t:!0,uriResolver:Xi}}var Mi=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...yO(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new pO.ValueScope({scope:{},prefixes:hO,es5:r,lines:n}),this.logger=wO(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,dO.getRules)(),ox.call(this,gO,t,"NOT SUPPORTED"),ox.call(this,vO,t,"DEPRECATED","warn"),this._metaOpts=xO.call(this),t.formats&&$O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&bO.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),_O.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=rx;n==="id"&&(o={...rx},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!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 n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ax.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Ci.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=ix.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ui.SchemaEnv({schema:{},schemaId:n});if(r=Ui.resolveSchema.call(this,o,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=ix.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 n=t[this.opts.schemaId];return n&&(n=(0,Ci.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(zO.call(this,n,r),!r)return(0,Ef.eachItem)(n,i=>Tf.call(this,i)),this;TO.call(this,r);let o={...r,type:(0,ac.getJSONTypes)(r.type),schemaType:(0,ac.getJSONTypes)(r.schemaType)};return(0,Ef.eachItem)(n,o.type.length===0?i=>Tf.call(this,i,o):i=>o.type.forEach(a=>Tf.call(this,i,o,a))),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 n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,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:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=cx(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];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;n=(0,Ci.normalizeId)(a||n);let u=Ci.getSchemaRefs.call(this,t,n);return c=new Ui.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&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):Ui.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{Ui.compileSchema.call(this,t)}finally{this.opts=r}}};Mi.ValidationError=lO.default;Mi.MissingRefError=ax.default;je.default=Mi;function ox(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function ix(e){return e=(0,Ci.normalizeId)(e),this.schemas[e]||this.refs[e]}function _O(){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 $O(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function bO(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 xO(){let e={...this.opts};for(let t of fO)delete e[t];return e}var kO={log(){},warn(){},error(){}};function wO(e){if(e===!1)return kO;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 SO=/^[a-z_$][a-z0-9_$:-]*$/i;function zO(e,t){let{RULES:r}=this;if((0,Ef.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!SO.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Tf(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ac.getJSONTypes)(t.type),schemaType:(0,ac.getJSONTypes)(t.schemaType)}};t.before?IO.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function IO(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function TO(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=cx(t)),e.validateSchema=this.compile(t,!0))}var EO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cx(e){return{anyOf:[e,EO]}}});var lx=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var PO={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pf.default=PO});var fx=I(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.callRef=Vr.getValidate=void 0;var OO=Zi(),dx=gt(),et=H(),Ln=Yt(),px=tc(),sc=ne(),jO={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=px.resolveRef.call(c,u,o,r);if(l===void 0)throw new OO.default(n.opts.uriResolver,o,r);if(l instanceof px.SchemaEnv)return p(l);return m(l);function d(){if(i===u)return cc(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return cc(e,(0,et._)`${g}.validate`,u,u.$async)}function p(g){let y=mx(e,g);cc(e,y,g,g.$async)}function m(g){let y=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,et.stringify)(g)}:{ref:g}),_=t.name("valid"),x=e.subschema({schema:g,dataTypes:[],schemaPath:et.nil,topSchemaRef:y,errSchemaPath:r},_);e.mergeEvaluated(x),e.ok(_)}}};function mx(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,et._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Vr.getValidate=mx;function cc(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?Ln.default.this:et.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,et._)`await ${(0,dx.callValidateCode)(e,t,u)}`),m(t),a||o.assign(g,!0)},y=>{o.if((0,et._)`!(${y} instanceof ${i.ValidationError})`,()=>o.throw(y)),p(y),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,dx.callValidateCode)(e,t,u),()=>m(t),()=>p(t))}function p(g){let y=(0,et._)`${g}.errors`;o.assign(Ln.default.vErrors,(0,et._)`${Ln.default.vErrors} === null ? ${y} : ${Ln.default.vErrors}.concat(${y})`),o.assign(Ln.default.errors,(0,et._)`${Ln.default.vErrors}.length`)}function m(g){var y;if(!i.opts.unevaluated)return;let _=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=sc.mergeEvaluated.props(o,_.props,i.props));else{let x=o.var("props",(0,et._)`${g}.evaluated.props`);i.props=sc.mergeEvaluated.props(o,x,i.props,et.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=sc.mergeEvaluated.items(o,_.items,i.items));else{let x=o.var("items",(0,et._)`${g}.evaluated.items`);i.items=sc.mergeEvaluated.items(o,x,i.items,et.Name)}}}Vr.callRef=cc;Vr.default=jO});var hx=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var NO=lx(),RO=fx(),DO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",NO.default,RO.default];Of.default=DO});var gx=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var uc=H(),xr=uc.operators,lc={maximum:{okStr:"<=",ok:xr.LTE,fail:xr.GT},minimum:{okStr:">=",ok:xr.GTE,fail:xr.LT},exclusiveMaximum:{okStr:"<",ok:xr.LT,fail:xr.GTE},exclusiveMinimum:{okStr:">",ok:xr.GT,fail:xr.LTE}},ZO={message:({keyword:e,schemaCode:t})=>(0,uc.str)`must be ${lc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,uc._)`{comparison: ${lc[e].okStr}, limit: ${t}}`},AO={keyword:Object.keys(lc),type:"number",schemaType:"number",$data:!0,error:ZO,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,uc._)`${r} ${lc[t].fail} ${n} || isNaN(${r})`)}};jf.default=AO});var vx=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var Li=H(),UO={message:({schemaCode:e})=>(0,Li.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Li._)`{multipleOf: ${e}}`},CO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:UO,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,Li._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Li._)`${a} !== parseInt(${a})`;e.fail$data((0,Li._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Nf.default=CO});var _x=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});function yx(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Rf.default=yx;yx.code='require("ajv/dist/runtime/ucs2length").default'});var $x=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var Jr=H(),MO=ne(),LO=_x(),qO={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Jr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Jr._)`{limit: ${e}}`},FO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:qO,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Jr.operators.GT:Jr.operators.LT,a=o.opts.unicode===!1?(0,Jr._)`${r}.length`:(0,Jr._)`${(0,MO.useFunc)(e.gen,LO.default)}(${r})`;e.fail$data((0,Jr._)`${a} ${i} ${n}`)}};Df.default=FO});var bx=I(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var VO=gt(),JO=ne(),qn=H(),BO={message:({schemaCode:e})=>(0,qn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,qn._)`{pattern: ${e}}`},GO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:BO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,qn._)`new RegExp`:(0,JO.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,qn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,qn._)`!${l}`)}else{let c=(0,VO.usePattern)(e,o);e.fail$data((0,qn._)`!${c}.test(${r})`)}}};Zf.default=GO});var xx=I(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});var qi=H(),KO={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,qi.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,qi._)`{limit: ${e}}`},HO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:KO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?qi.operators.GT:qi.operators.LT;e.fail$data((0,qi._)`Object.keys(${r}).length ${o} ${n}`)}};Af.default=HO});var kx=I(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var Fi=gt(),Vi=H(),WO=ne(),XO={message:({params:{missingProperty:e}})=>(0,Vi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Vi._)`{missingProperty: ${e}}`},YO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:XO,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let y of r)if(m?.[y]===void 0&&!g.has(y)){let _=a.schemaEnv.baseId+a.errSchemaPath,x=`required property "${y}" is not defined at "${_}" (strictRequired)`;(0,WO.checkStrictMode)(a,x,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Vi.nil,d);else for(let m of r)(0,Fi.checkReportMissingProp)(e,m)}function l(){let m=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>p(m,g)),e.ok(g)}else t.if((0,Fi.checkMissingProp)(e,r,m)),(0,Fi.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,Fi.noPropertyInData)(t,o,m,s.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(g,(0,Fi.propertyInData)(t,o,m,s.ownProperties)),t.if((0,Vi.not)(g),()=>{e.error(),t.break()})},Vi.nil)}}};Uf.default=YO});var wx=I(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var Ji=H(),QO={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Ji.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Ji._)`{limit: ${e}}`},ej={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:QO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Ji.operators.GT:Ji.operators.LT;e.fail$data((0,Ji._)`${r}.length ${o} ${n}`)}};Cf.default=ej});var dc=I(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var Sx=lf();Sx.code='require("ajv/dist/runtime/equal").default';Mf.default=Sx});var zx=I(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});var Lf=Oi(),Ne=H(),tj=ne(),rj=dc(),nj={message:({params:{i:e,j:t}})=>(0,Ne.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ne._)`{i: ${e}, j: ${t}}`},oj={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:nj,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Lf.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Ne._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Ne._)`${r}.length`),y=t.let("j");e.setParams({i:g,j:y}),t.assign(c,!0),t.if((0,Ne._)`${g} > 1`,()=>(d()?p:m)(g,y))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,y){let _=t.name("item"),x=(0,Lf.checkDataTypes)(u,_,s.opts.strictNumbers,Lf.DataType.Wrong),j=t.const("indices",(0,Ne._)`{}`);t.for((0,Ne._)`;${g}--;`,()=>{t.let(_,(0,Ne._)`${r}[${g}]`),t.if(x,(0,Ne._)`continue`),u.length>1&&t.if((0,Ne._)`typeof ${_} == "string"`,(0,Ne._)`${_} += "_"`),t.if((0,Ne._)`typeof ${j}[${_}] == "number"`,()=>{t.assign(y,(0,Ne._)`${j}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ne._)`${j}[${_}] = ${g}`)})}function m(g,y){let _=(0,tj.useFunc)(t,rj.default),x=t.name("outer");t.label(x).for((0,Ne._)`;${g}--;`,()=>t.for((0,Ne._)`${y} = ${g}; ${y}--;`,()=>t.if((0,Ne._)`${_}(${r}[${g}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(x)})))}}};qf.default=oj});var Ix=I(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});var Ff=H(),ij=ne(),aj=dc(),sj={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ff._)`{allowedValue: ${e}}`},cj={keyword:"const",$data:!0,error:sj,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Ff._)`!${(0,ij.useFunc)(t,aj.default)}(${r}, ${o})`):e.fail((0,Ff._)`${i} !== ${r}`)}};Vf.default=cj});var Tx=I(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var Bi=H(),uj=ne(),lj=dc(),dj={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Bi._)`{allowedValues: ${e}}`},pj={keyword:"enum",schemaType:"array",$data:!0,error:dj,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,uj.useFunc)(t,lj.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=t.const("vSchema",i);l=(0,Bi.or)(...o.map((g,y)=>p(m,y)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,m=>t.if((0,Bi._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function p(m,g){let y=o[g];return typeof y=="object"&&y!==null?(0,Bi._)`${u()}(${r}, ${m}[${g}])`:(0,Bi._)`${r} === ${y}`}}};Jf.default=pj});var Ex=I(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});var mj=gx(),fj=vx(),hj=$x(),gj=bx(),vj=xx(),yj=kx(),_j=wx(),$j=zx(),bj=Ix(),xj=Tx(),kj=[mj.default,fj.default,hj.default,gj.default,vj.default,yj.default,_j.default,$j.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},bj.default,xj.default];Bf.default=kj});var Kf=I(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.validateAdditionalItems=void 0;var Br=H(),Gf=ne(),wj={message:({params:{len:e}})=>(0,Br.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Br._)`{limit: ${e}}`},Sj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:wj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Gf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Px(e,n)}};function Px(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Br._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Br._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Gf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Br._)`${s} <= ${t.length}`);r.if((0,Br.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Gf.Type.Num},u),a.allErrors||r.if((0,Br.not)(u),()=>r.break())})}}Gi.validateAdditionalItems=Px;Gi.default=Sj});var Hf=I(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.validateTuple=void 0;var Ox=H(),pc=ne(),zj=gt(),Ij={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return jx(e,"additionalItems",t);r.items=!0,!(0,pc.alwaysValidSchema)(r,t)&&e.ok((0,zj.validateArray)(e))}};function jx(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=pc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,Ox._)`${i}.length`);r.forEach((d,p)=>{(0,pc.alwaysValidSchema)(s,d)||(n.if((0,Ox._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=s,g=r.length,y=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!y){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,pc.checkStrictMode)(s,_,p.strictTuples)}}}Ki.validateTuple=jx;Ki.default=Ij});var Nx=I(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var Tj=Hf(),Ej={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Tj.validateTuple)(e,"items")};Wf.default=Ej});var Dx=I(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var Rx=H(),Pj=ne(),Oj=gt(),jj=Kf(),Nj={message:({params:{len:e}})=>(0,Rx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Rx._)`{limit: ${e}}`},Rj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Nj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Pj.alwaysValidSchema)(n,t)&&(o?(0,jj.validateAdditionalItems)(e,o):e.ok((0,Oj.validateArray)(e)))}};Xf.default=Rj});var Zx=I(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});var yt=H(),mc=ne(),Dj={message:({params:{min:e,max:t}})=>t===void 0?(0,yt.str)`must contain at least ${e} valid item(s)`:(0,yt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,yt._)`{minContains: ${e}}`:(0,yt._)`{minContains: ${e}, maxContains: ${t}}`},Zj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Dj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,yt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,mc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,mc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,mc.alwaysValidSchema)(i,r)){let y=(0,yt._)`${l} >= ${a}`;s!==void 0&&(y=(0,yt._)`${y} && ${l} <= ${s}`),e.pass(y);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?m(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,yt._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let y=t.name("_valid"),_=t.let("count",0);m(y,()=>t.if(y,()=>g(_)))}function m(y,_){t.forRange("i",0,l,x=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:mc.Type.Num,compositeRule:!0},y),_()})}function g(y){t.code((0,yt._)`${y}++`),s===void 0?t.if((0,yt._)`${y} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,yt._)`${y} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,yt._)`${y} >= ${a}`,()=>t.assign(d,!0)))}}};Yf.default=Zj});var Cx=I(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.validateSchemaDeps=Zt.validatePropertyDeps=Zt.error=void 0;var Qf=H(),Aj=ne(),Hi=gt();Zt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Qf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Qf._)`{property: ${e},
|
|
137
|
+
missingProperty: ${n},
|
|
138
|
+
depsCount: ${t},
|
|
139
|
+
deps: ${r}}`};var Uj={keyword:"dependencies",type:"object",schemaType:"object",error:Zt.error,code(e){let[t,r]=Cj(e);Ax(e,t),Ux(e,r)}};function Cj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Ax(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,Hi.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,Hi.checkReportMissingProp)(e,u)}):(r.if((0,Qf._)`${c} && (${(0,Hi.checkMissingProp)(e,s,i)})`),(0,Hi.reportMissingProp)(e,i),r.else())}}Zt.validatePropertyDeps=Ax;function Ux(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,Aj.alwaysValidSchema)(i,t[s])||(r.if((0,Hi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}Zt.validateSchemaDeps=Ux;Zt.default=Uj});var Lx=I(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var Mx=H(),Mj=ne(),Lj={message:"property name must be valid",params:({params:e})=>(0,Mx._)`{propertyName: ${e.propertyName}}`},qj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Lj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Mj.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,Mx.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};eh.default=qj});var rh=I(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var fc=gt(),It=H(),Fj=Yt(),hc=ne(),Vj={message:"must NOT have additional properties",params:({params:e})=>(0,It._)`{additionalProperty: ${e.additionalProperty}}`},Jj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Vj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,hc.alwaysValidSchema)(a,r))return;let u=(0,fc.allSchemaProperties)(n.properties),l=(0,fc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,It._)`${i} === ${Fj.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?g(_):t.if(p(_),()=>g(_))})}function p(_){let x;if(u.length>8){let j=(0,hc.schemaRefOrVal)(a,n.properties,"properties");x=(0,fc.isOwnProperty)(t,j,_)}else u.length?x=(0,It.or)(...u.map(j=>(0,It._)`${_} === ${j}`)):x=It.nil;return l.length&&(x=(0,It.or)(x,...l.map(j=>(0,It._)`${(0,fc.usePattern)(e,j)}.test(${_})`))),(0,It.not)(x)}function m(_){t.code((0,It._)`delete ${o}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,hc.alwaysValidSchema)(a,r)){let x=t.name("valid");c.removeAdditional==="failing"?(y(_,x,!1),t.if((0,It.not)(x),()=>{e.reset(),m(_)})):(y(_,x),s||t.if((0,It.not)(x),()=>t.break()))}}function y(_,x,j){let P={keyword:"additionalProperties",dataProp:_,dataPropType:hc.Type.Str};j===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(P,x)}}};th.default=Jj});var Vx=I(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var Bj=Di(),qx=gt(),nh=ne(),Fx=rh(),Gj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Fx.default.code(new Bj.KeywordCxt(i,Fx.default,"additionalProperties"));let a=(0,qx.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=nh.mergeEvaluated.props(t,(0,nh.toHash)(a),i.props));let s=a.filter(d=>!(0,nh.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,qx.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};oh.default=Gj});var Kx=I(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var Jx=gt(),gc=H(),Bx=ne(),Gx=ne(),Kj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,Jx.allSchemaProperties)(r),c=s.filter(y=>(0,Bx.alwaysValidSchema)(i,r[y]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof gc.Name)&&(i.props=(0,Gx.evaluatedPropsToName)(t,i.props));let{props:d}=i;p();function p(){for(let y of s)u&&m(y),i.allErrors?g(y):(t.var(l,!0),g(y),t.if(l))}function m(y){for(let _ in u)new RegExp(y).test(_)&&(0,Bx.checkStrictMode)(i,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",n,_=>{t.if((0,gc._)`${(0,Jx.usePattern)(e,y)}.test(${_})`,()=>{let x=c.includes(y);x||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:Gx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,gc._)`${d}[${_}]`,!0):!x&&!i.allErrors&&t.if((0,gc.not)(l),()=>t.break())})})}}};ih.default=Kj});var Hx=I(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Hj=ne(),Wj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Hj.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ah.default=Wj});var Wx=I(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var Xj=gt(),Yj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Xj.validateUnion,error:{message:"must match a schema in anyOf"}};sh.default=Yj});var Xx=I(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var vc=H(),Qj=ne(),eN={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,vc._)`{passingSchemas: ${e.passing}}`},tN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:eN,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let p;(0,Qj.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,vc._)`${c} && ${a}`).assign(a,!1).assign(s,(0,vc._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,vc.Name)})})}}};ch.default=tN});var Yx=I(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});var rN=ne(),nN={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,rN.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};uh.default=nN});var tk=I(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var yc=H(),ek=ne(),oN={message:({params:e})=>(0,yc.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,yc._)`{failingKeyword: ${e.ifClause}}`},iN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:oN,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,ek.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Qx(n,"then"),i=Qx(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,yc.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(p,a),d?t.assign(d,(0,yc._)`${l}`):e.setParams({ifClause:l})}}}};function Qx(e,t){let r=e.schema[t];return r!==void 0&&!(0,ek.alwaysValidSchema)(e,r)}lh.default=iN});var rk=I(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var aN=ne(),sN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,aN.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};dh.default=sN});var nk=I(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var cN=Kf(),uN=Nx(),lN=Hf(),dN=Dx(),pN=Zx(),mN=Cx(),fN=Lx(),hN=rh(),gN=Vx(),vN=Kx(),yN=Hx(),_N=Wx(),$N=Xx(),bN=Yx(),xN=tk(),kN=rk();function wN(e=!1){let t=[yN.default,_N.default,$N.default,bN.default,xN.default,kN.default,fN.default,hN.default,mN.default,gN.default,vN.default];return e?t.push(uN.default,dN.default):t.push(cN.default,lN.default),t.push(pN.default),t}ph.default=wN});var ok=I(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var xe=H(),SN={message:({schemaCode:e})=>(0,xe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,xe._)`{format: ${e}}`},zN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:SN,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():m();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,xe._)`${g}[${a}]`),_=r.let("fType"),x=r.let("format");r.if((0,xe._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(_,(0,xe._)`${y}.type || "string"`).assign(x,(0,xe._)`${y}.validate`),()=>r.assign(_,(0,xe._)`"string"`).assign(x,y)),e.fail$data((0,xe.or)(j(),P()));function j(){return c.strictSchema===!1?xe.nil:(0,xe._)`${a} && !${x}`}function P(){let z=l.$async?(0,xe._)`(${y}.async ? await ${x}(${n}) : ${x}(${n}))`:(0,xe._)`${x}(${n})`,k=(0,xe._)`(typeof ${x} == "function" ? ${z} : ${x}.test(${n}))`;return(0,xe._)`${x} && ${x} !== true && ${_} === ${t} && !${k}`}}function m(){let g=d.formats[i];if(!g){j();return}if(g===!0)return;let[y,_,x]=P(g);y===t&&e.pass(z());function j(){if(c.strictSchema===!1){d.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function P(k){let $e=k instanceof RegExp?(0,xe.regexpCode)(k):c.code.formats?(0,xe._)`${c.code.formats}${(0,xe.getProperty)(i)}`:void 0,Ie=r.scopeValue("formats",{key:i,ref:k,code:$e});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,xe._)`${Ie}.validate`]:["string",k,Ie]}function z(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,xe._)`await ${x}(${n})`}return typeof _=="function"?(0,xe._)`${x}(${n})`:(0,xe._)`${x}.test(${n})`}}}};mh.default=zN});var ik=I(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});var IN=ok(),TN=[IN.default];fh.default=TN});var ak=I(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.contentVocabulary=Fn.metadataVocabulary=void 0;Fn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Fn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ck=I(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});var EN=hx(),PN=Ex(),ON=nk(),jN=ik(),sk=ak(),NN=[EN.default,PN.default,(0,ON.default)(),jN.default,sk.metadataVocabulary,sk.contentVocabulary];hh.default=NN});var lk=I(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.DiscrError=void 0;var uk;(function(e){e.Tag="tag",e.Mapping="mapping"})(uk||(_c.DiscrError=uk={}))});var pk=I(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});var Vn=H(),gh=lk(),dk=tc(),RN=Zi(),DN=ne(),ZN={message:({params:{discrError:e,tagName:t}})=>e===gh.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Vn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},AN={keyword:"discriminator",type:"object",schemaType:"object",error:ZN,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Vn._)`${r}${(0,Vn.getProperty)(s)}`);t.if((0,Vn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:gh.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let m=p();t.if(!1);for(let g in m)t.elseIf((0,Vn._)`${u} === ${g}`),t.assign(c,d(m[g]));t.else(),e.error(!1,{discrError:gh.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(m){let g=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(y,Vn.Name),g}function p(){var m;let g={},y=x(o),_=!0;for(let z=0;z<a.length;z++){let k=a[z];if(k?.$ref&&!(0,DN.schemaHasRulesButRef)(k,i.self.RULES)){let Ie=k.$ref;if(k=dk.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ie),k instanceof dk.SchemaEnv&&(k=k.schema),k===void 0)throw new RN.default(i.opts.uriResolver,i.baseId,Ie)}let $e=(m=k?.properties)===null||m===void 0?void 0:m[s];if(typeof $e!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);_=_&&(y||x(k)),j($e,z)}if(!_)throw new Error(`discriminator: "${s}" must be required`);return g;function x({required:z}){return Array.isArray(z)&&z.includes(s)}function j(z,k){if(z.const)P(z.const,k);else if(z.enum)for(let $e of z.enum)P($e,k);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function P(z,k){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[z]=k}}}};vh.default=AN});var mk=I((p2,UN)=>{UN.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 _h=I((ye,yh)=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MissingRefError=ye.ValidationError=ye.CodeGen=ye.Name=ye.nil=ye.stringify=ye.str=ye._=ye.KeywordCxt=ye.Ajv=void 0;var CN=ux(),MN=ck(),LN=pk(),fk=mk(),qN=["/properties"],$c="http://json-schema.org/draft-07/schema",Jn=class extends CN.default{_addVocabularies(){super._addVocabularies(),MN.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(LN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(fk,qN):fk;this.addMetaSchema(t,$c,!1),this.refs["http://json-schema.org/schema"]=$c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($c)?$c:void 0)}};ye.Ajv=Jn;yh.exports=ye=Jn;yh.exports.Ajv=Jn;Object.defineProperty(ye,"__esModule",{value:!0});ye.default=Jn;var FN=Di();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return FN.KeywordCxt}});var Bn=H();Object.defineProperty(ye,"_",{enumerable:!0,get:function(){return Bn._}});Object.defineProperty(ye,"str",{enumerable:!0,get:function(){return Bn.str}});Object.defineProperty(ye,"stringify",{enumerable:!0,get:function(){return Bn.stringify}});Object.defineProperty(ye,"nil",{enumerable:!0,get:function(){return Bn.nil}});Object.defineProperty(ye,"Name",{enumerable:!0,get:function(){return Bn.Name}});Object.defineProperty(ye,"CodeGen",{enumerable:!0,get:function(){return Bn.CodeGen}});var VN=Qs();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return VN.default}});var JN=Zi();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return JN.default}})});var xk=I(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.formatNames=Ut.fastFormats=Ut.fullFormats=void 0;function At(e,t){return{validate:e,compare:t}}Ut.fullFormats={date:At(yk,kh),time:At(bh(!0),wh),"date-time":At(hk(!0),$k),"iso-time":At(bh(),_k),"iso-date-time":At(hk(),bk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:XN,"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:oR,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:YN,int32:{type:"number",validate:tR},int64:{type:"number",validate:rR},float:{type:"number",validate:vk},double:{type:"number",validate:vk},password:!0,binary:!0};Ut.fastFormats={...Ut.fullFormats,date:At(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kh),time:At(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,wh),"date-time":At(/^\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,$k),"iso-time":At(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,_k),"iso-date-time":At(/^\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,bk),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};Ut.formatNames=Object.keys(Ut.fullFormats);function BN(e){return e%4===0&&(e%100!==0||e%400===0)}var GN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,KN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function yk(e){let t=GN.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&BN(r)?29:KN[n])}function kh(e,t){if(e&&t)return e>t?1:e<t?-1:0}var $h=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function bh(e){return function(r){let n=$h.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function wh(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function _k(e,t){if(!(e&&t))return;let r=$h.exec(e),n=$h.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var xh=/t|\s/i;function hk(e){let t=bh(e);return function(n){let o=n.split(xh);return o.length===2&&yk(o[0])&&t(o[1])}}function $k(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function bk(e,t){if(!(e&&t))return;let[r,n]=e.split(xh),[o,i]=t.split(xh),a=kh(r,o);if(a!==void 0)return a||wh(n,i)}var HN=/\/|:/,WN=/^(?:[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 XN(e){return HN.test(e)&&WN.test(e)}var gk=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function YN(e){return gk.lastIndex=0,gk.test(e)}var QN=-(2**31),eR=2**31-1;function tR(e){return Number.isInteger(e)&&e<=eR&&e>=QN}function rR(e){return Number.isInteger(e)}function vk(){return!0}var nR=/[^\\]\\Z/;function oR(e){if(nR.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var kk=I(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.formatLimitDefinition=void 0;var iR=_h(),Tt=H(),kr=Tt.operators,bc={formatMaximum:{okStr:"<=",ok:kr.LTE,fail:kr.GT},formatMinimum:{okStr:">=",ok:kr.GTE,fail:kr.LT},formatExclusiveMaximum:{okStr:"<",ok:kr.LT,fail:kr.GTE},formatExclusiveMinimum:{okStr:">",ok:kr.GT,fail:kr.LTE}},aR={message:({keyword:e,schemaCode:t})=>(0,Tt.str)`should be ${bc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Tt._)`{comparison: ${bc[e].okStr}, limit: ${t}}`};Gn.formatLimitDefinition={keyword:Object.keys(bc),type:"string",schemaType:"string",$data:!0,error:aR,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new iR.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),m=t.const("fmt",(0,Tt._)`${p}[${c.schemaCode}]`);e.fail$data((0,Tt.or)((0,Tt._)`typeof ${m} != "object"`,(0,Tt._)`${m} instanceof RegExp`,(0,Tt._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=s.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=t.scopeValue("formats",{key:p,ref:m,code:a.code.formats?(0,Tt._)`${a.code.formats}${(0,Tt.getProperty)(p)}`:void 0});e.fail$data(d(g))}function d(p){return(0,Tt._)`${p}.compare(${r}, ${n}) ${bc[o].fail} 0`}},dependencies:["format"]};var sR=e=>(e.addKeyword(Gn.formatLimitDefinition),e);Gn.default=sR});var Ik=I((Wi,zk)=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var Kn=xk(),cR=kk(),Sh=H(),wk=new Sh.Name("fullFormats"),uR=new Sh.Name("fastFormats"),zh=(e,t={keywords:!0})=>{if(Array.isArray(t))return Sk(e,t,Kn.fullFormats,wk),e;let[r,n]=t.mode==="fast"?[Kn.fastFormats,uR]:[Kn.fullFormats,wk],o=t.formats||Kn.formatNames;return Sk(e,o,r,n),t.keywords&&(0,cR.default)(e),e};zh.get=(e,t="full")=>{let n=(t==="fast"?Kn.fastFormats:Kn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Sk(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Sh._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}zk.exports=Wi=zh;Object.defineProperty(Wi,"__esModule",{value:!0});Wi.default=zh});function lR(){let e=new Tk.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ek.default)(e),e}var Tk,Ek,xc,Pk=h(()=>{Tk=Xn(_h(),1),Ek=Xn(Ik(),1);xc=class{constructor(t){this._ajv=t??lR()}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 n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var kc,Ok=h(()=>{On();kc=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.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],i=Array.isArray(o.content)?o.content:[o.content],a=i.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},$i,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},Pn,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}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 jk(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 Nk(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 Rk=h(()=>{});var wc,Dk=h(()=>{q$();On();Pk();ns();Ok();Rk();wc=class extends Ms{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(_i.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new xc,this.setRequestHandler(Bp,n=>this._oninitialize(n)),this.setNotificationHandler(Gp,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(tm,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=_i.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new kc(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=L$(this._capabilities,t)}setRequestHandler(t,r){let o=rs(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Sn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=pr(yi,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new G(te.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let g=pr(Tn,p);if(!g.success){let y=g.error instanceof Error?g.error.message:String(g.error);throw new G(te.InvalidParams,`Invalid task creation result: ${y}`)}return g.data}let m=pr(Ns,p);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new G(te.InvalidParams,`Invalid tools/call result: ${g}`)}return m.data};return super.setRequestHandler(t,s)}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){Nk(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&jk(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:$$.includes(r)?r:Lp,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"},ks)}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 n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.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(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},rm,r):this.request({method:"sampling/createMessage",params:t},$i,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 o=t;return this.request({method:"elicitation/create",params:o},Pn,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Pn,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new G(te.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof G?a:new G(te.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}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},nm,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"})}}});function dR(e){return T$.parse(JSON.parse(e))}function Zk(e){return JSON.stringify(e)+`
|
|
140
|
+
`}var Sc,Ak=h(()=>{On();Sc=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
141
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),dR(r)}clear(){this._buffer=void 0}}});var Ih,zc,Uk=h(()=>{Ih=Xn(require("node:process"),1);Ak();zc=class{constructor(t=Ih.default.stdin,r=Ih.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Sc,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}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 n=Zk(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}}});var Jk={};Et(Jk,{runMcpServer:()=>mR});function pR(e=20){if(!(0,Ic.existsSync)(Ck))return[];try{return(0,Ic.readFileSync)(Ck,"utf-8").split(`
|
|
142
|
+
`).filter(n=>n.length>0).slice(-e)}catch{return[]}}async function Lk(e,t){let r=e.prepare("SELECT COUNT(*) as count FROM sessions").get(),n=e.prepare("SELECT COUNT(*) as count FROM chunks").get(),o=e.prepare("SELECT MAX(indexed_at) as last FROM sessions").get(),i=Qr();return{health:"ok",session_count:r.count,chunk_count:n.count,last_indexed:o.last?new Date(o.last).toISOString():null,model_loaded:t,daemon_pid:i,log_tail:pR(20)}}async function qk(e){if(e.endsWith(".jsonl")){let t=await na(e);return Wh(t)}return Bun.file(e).text()}async function mR(e=!1){let t=Sr(),r=!1,n=await Yr();r=!0;let o=new wc({name:"qrec",version:"0.1.0"},{capabilities:{tools:{}}});o.setRequestHandler(em,async()=>({tools:[{name:"search",description:"Search indexed sessions using hybrid BM25 + vector search",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query"},k:{type:"number",description:"Number of results (default: 10)"}},required:["query"]}},{name:"get",description:"Get full session markdown by session ID",inputSchema:{type:"object",properties:{session_id:{type:"string",description:"8-char hex session ID"}},required:["session_id"]}},{name:"status",description:"Get qrec engine status and health information",inputSchema:{type:"object",properties:{}}}]})),o.setRequestHandler(yi,async a=>{let{name:s,arguments:c}=a.params;if(s==="search"){let u=String(c?.query??"").trim();if(!u)return{content:[{type:"text",text:JSON.stringify({error:"Missing required field: query"})}],isError:!0};let l=typeof c?.k=="number"?c.k:10;try{let d=await ro(t,n,u,l);return{content:[{type:"text",text:JSON.stringify({results:d})}]}}catch(d){return{content:[{type:"text",text:JSON.stringify({error:String(d)})}],isError:!0}}}if(s==="get"){let u=String(c?.session_id??"").trim();if(!u)return{content:[{type:"text",text:JSON.stringify({error:"Missing required field: session_id"})}],isError:!0};let l=t.prepare("SELECT path FROM sessions WHERE id = ?").get(u);if(!l)return{content:[{type:"text",text:JSON.stringify({error:`Session not found: ${u}`})}],isError:!0};try{return{content:[{type:"text",text:await qk(l.path)}]}}catch(d){return{content:[{type:"text",text:JSON.stringify({error:`Failed to read session file: ${d}`})}],isError:!0}}}if(s==="status")try{let u=await Lk(t,r);return{content:[{type:"text",text:JSON.stringify(u)}]}}catch(u){return{content:[{type:"text",text:JSON.stringify({error:String(u)})}],isError:!0}}return{content:[{type:"text",text:JSON.stringify({error:`Unknown tool: ${s}`})}],isError:!0}});async function i(){console.error("[mcp] Shutting down..."),t.close(),await eo(),process.exit(0)}if(process.on("SIGTERM",i),process.on("SIGINT",i),e)console.error(`[mcp] Starting HTTP MCP server on port ${Mk}`),Bun.serve({port:Mk,async fetch(a){if(a.method!=="POST")return Response.json({error:"Method not allowed"},{status:405});let s;try{s=await a.json()}catch{return Response.json({jsonrpc:"2.0",error:{code:-32700,message:"Parse error"},id:null},{status:400})}if(s.method==="tools/list"){let c=[{name:"search",description:"Search indexed sessions using hybrid BM25 + vector search",inputSchema:{type:"object",properties:{query:{type:"string"},k:{type:"number"}},required:["query"]}},{name:"get",description:"Get full session markdown by session ID",inputSchema:{type:"object",properties:{session_id:{type:"string"}},required:["session_id"]}},{name:"status",description:"Get qrec engine status",inputSchema:{type:"object",properties:{}}}];return Response.json({jsonrpc:"2.0",result:{tools:c},id:s.id})}if(s.method==="tools/call"){let c=s.params,u=c?.name??"",l=c?.arguments??{},d;try{if(u==="search"){let p=String(l?.query??"").trim(),m=typeof l?.k=="number"?l.k:10,g=await ro(t,n,p,m);d={content:[{type:"text",text:JSON.stringify({results:g})}]}}else if(u==="get"){let p=String(l?.session_id??"").trim(),m=t.prepare("SELECT path FROM sessions WHERE id = ?").get(p);m?d={content:[{type:"text",text:await qk(m.path)}]}:d={content:[{type:"text",text:JSON.stringify({error:`Session not found: ${p}`})}],isError:!0}}else if(u==="status"){let p=await Lk(t,r);d={content:[{type:"text",text:JSON.stringify(p)}]}}else d={content:[{type:"text",text:JSON.stringify({error:`Unknown tool: ${u}`})}],isError:!0}}catch(p){d={content:[{type:"text",text:JSON.stringify({error:String(p)})}],isError:!0}}return Response.json({jsonrpc:"2.0",result:d,id:s.id})}return Response.json({jsonrpc:"2.0",error:{code:-32601,message:"Method not found"},id:s.id},{status:404})}}),await new Promise(()=>{});else{let a=new zc;await o.connect(a),console.error("[mcp] qrec MCP server running on stdio")}}var Fk,Vk,Ic,Ck,Mk,Bk=h(()=>{"use strict";Dk();Uk();On();Qi();ra();ta();Vc();Fc();Uc();Fk=require("path"),Vk=require("os"),Ic=require("fs"),Ck=(0,Fk.join)((0,Vk.homedir)(),".qrec","qrec.log"),Mk=3031});Qi();Cc();ta();Fc();var Ph=require("path"),Tc=require("os"),Gr=require("fs"),[,,Gk,..._t]=process.argv,Kk=(0,Ph.join)((0,Tc.homedir)(),".qrec","qrec.log"),Th=(0,Ph.join)((0,Tc.homedir)(),".qrec");function fR(e=20){if(!(0,Gr.existsSync)(Kk))return[];try{return(0,Gr.readFileSync)(Kk,"utf-8").split(`
|
|
143
|
+
`).filter(n=>n.length>0).slice(-e)}catch{return[]}}function Eh(){let e=process.platform==="darwin"?"open":"xdg-open";try{Bun.spawnSync([e,"http://localhost:3030"])}catch{}}async function hR(){switch(Gk){case"--version":case"-v":console.log("qrec 0.2.0"),process.exit(0);case"onboard":{let e=_t.includes("--no-open");await Lc(),e||Eh();let t=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],r=22,n=s=>{let c=Math.min(r,Math.round(s*r/100));return"\u2588".repeat(c)+"\u2591".repeat(r-c)},o=0,i=0,a=s=>{let{phase:c,modelDownload:u,indexing:l}=s,d=t[i%t.length],p=["indexing","ready"].includes(c),m=c==="ready",g=c==="indexing",y=46,_=[""," qrec \u2014 setting up",` ${"\u2500".repeat(y)}`];if(c==="model_download"){let x=u.percent;_.push(` ${d} [1/3] Downloading model`),_.push(` ${n(x)} ${x}% (${u.downloadedMB.toFixed(0)} / ${u.totalMB?.toFixed(0)??"?"} MB)`)}else c==="model_loading"?(_.push(` ${d} [1/3] Loading model into memory\u2026`),_.push("")):(_.push(" \u2713 [1/3] Model ready"),_.push(""));if(!p)_.push(" \xB7 [2/3] Index sessions"),_.push("");else if(g){let x=l.total>0?Math.round(l.indexed*100/l.total):0;_.push(` ${d} [2/3] Indexing sessions`),_.push(` ${n(x)} ${x}% (${l.indexed}/${l.total}) ${l.current}`)}else _.push(` \u2713 [2/3] Sessions indexed (${s.sessions} sessions)`),_.push("");m?_.push(" \u2713 [3/3] Ready \u2192 http://localhost:3030"):_.push(" \xB7 [3/3] Ready"),_.push(` ${"\u2500".repeat(y)}`),_.push(""),o>0&&process.stdout.write(`\x1B[${o}A`);for(let x of _)process.stdout.write(`\x1B[2K${x}
|
|
144
|
+
`);o=_.length};for(;;){try{let s=await fetch("http://localhost:3030/status");if(s.ok){let c=await s.json();if(a(c),c.phase==="ready")break}}catch{}i++,await Bun.sleep(500)}process.exit(0)}case"teardown":{let e=_t.includes("--yes");await qc(),(0,Gr.existsSync)(Th)||(console.log("[teardown] ~/.qrec/ not found, nothing to remove."),process.exit(0)),e||(process.stdout.write(`[teardown] Remove ${Th} (DB, model, logs, pid, activity log)? [y/N] `),(await new Promise(r=>{process.stdin.setEncoding("utf-8"),process.stdin.once("data",n=>r(String(n).trim()))})).toLowerCase()!=="y"&&(console.log("[teardown] Aborted."),process.exit(0))),(0,Gr.rmSync)(Th,{recursive:!0,force:!0}),console.log("[teardown] Removed ~/.qrec/"),process.exit(0)}case"index":{let e,t=!1,r,n;if(!_t[0]&&!process.stdin.isTTY){let i=await Bun.stdin.text();try{let a=JSON.parse(i.trim());if(!a.transcript_path)throw new Error("Missing transcript_path");e=a.transcript_path}catch(a){console.error(`[cli] index: failed to parse stdin: ${a}`),process.exit(1)}}else{let i=_t[0]??`${(0,Tc.homedir)()}/.claude/projects/`;t=_t.includes("--force");let a=_t.indexOf("--sessions");r=a!==-1?parseInt(_t[a+1],10):void 0;let s=_t.indexOf("--seed");n=s!==-1?parseInt(_t[s+1],10):void 0,e=i.replace("~",process.env.HOME??"")}console.log(`[cli] Indexing: ${e}${r?` (${r} sessions, seed=${n??42})`:""}`);let o=Sr();try{await oa(o,e,{force:t,sessions:r,seed:n})}finally{o.close(),await eo()}process.exit(0)}case"serve":{let e=_t.includes("--daemon"),t=_t.includes("--no-open");e?(await Lc(),t||Eh()):(t||setTimeout(Eh,1e3),await Promise.resolve().then(()=>(fg(),Nw)));break}case"stop":{await qc();break}case"mcp":{let e=_t.includes("--http"),{runMcpServer:t}=await Promise.resolve().then(()=>(Bk(),Jk));await t(e);break}case"status":{let e=Sr();try{let t=e.prepare("SELECT COUNT(*) as count FROM sessions").get(),r=e.prepare("SELECT COUNT(*) as count FROM chunks").get(),n=e.prepare("SELECT MAX(indexed_at) as last FROM sessions").get(),o=Qr(),i=o!==null,a="not checked";if(i)try{let u=await fetch("http://localhost:3030/health");u.ok?a=(await u.json()).status??"unknown":a=`http error ${u.status}`}catch{a="unreachable"}let s=n.last?new Date(n.last).toISOString():"never";console.log("=== qrec status ==="),console.log(`Daemon PID: ${o??"not running"}`),console.log(`HTTP health: ${a}`),console.log(`Sessions: ${t.count}`),console.log(`Chunks: ${r.count}`),console.log(`Last indexed: ${s}`),console.log(""),console.log("--- Log tail (last 20 lines) ---");let c=fR(20);if(c.length===0)console.log("(no log entries)");else for(let u of c)console.log(u)}finally{e.close()}process.exit(0)}default:console.error(`Unknown command: ${Gk}`),console.error("Usage:"),console.error(" qrec onboard [--no-open] # first-time setup"),console.error(" qrec teardown [--yes] # remove all qrec data"),console.error(" qrec index [path] [--force] # default: ~/.claude/projects/"),console.error(" qrec index # stdin JSON {transcript_path} (hook mode)"),console.error(" qrec serve [--daemon] [--no-open]"),console.error(" qrec stop"),console.error(" qrec mcp [--http]"),console.error(" qrec status"),process.exit(1)}}hR().catch(e=>{console.error("Fatal error:",e),process.exit(1)});
|