@dvquys/qrec 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- "use strict";var Wk=Object.create;var Oc=Object.defineProperty;var Xk=Object.getOwnPropertyDescriptor;var Yk=Object.getOwnPropertyNames;var Qk=Object.getPrototypeOf,ew=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)Oc(e,r,{get:t[r],enumerable:!0})},tw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yk(t))!ew.call(e,o)&&o!==r&&Oc(e,o,{get:()=>t[o],enumerable:!(n=Xk(t,o))||n.enumerable});return e};var Yn=(e,t,r)=>(r=e!=null?Wk(Qk(e)):{},tw(t||!e||!e.__esModule?Oc(r,"default",{value:e,enumerable:!0}):r,e));function rw(){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,Qi.statSync)(r).size>0)return r}catch{}return null}function wr(e=Nc){let t=e.replace(/\/[^/]+$/,"");(0,Qi.mkdirSync)(t,{recursive:!0});let r=new jc.Database(e);return r.loadExtension(nw),r.exec("PRAGMA journal_mode = WAL"),r.exec("PRAGMA synchronous = NORMAL"),r.exec("PRAGMA cache_size = -32000"),r.exec("PRAGMA foreign_keys = ON"),ow(r),r}function ow(e){e.exec(`
2
+ "use strict";var Kk=Object.create;var Ic=Object.defineProperty;var Hk=Object.getOwnPropertyDescriptor;var Wk=Object.getOwnPropertyNames;var Xk=Object.getPrototypeOf,Yk=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)Ic(e,r,{get:t[r],enumerable:!0})},Qk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wk(t))!Yk.call(e,o)&&o!==r&&Ic(e,o,{get:()=>t[o],enumerable:!(n=Hk(t,o))||n.enumerable});return e};var Kn=(e,t,r)=>(r=e!=null?Kk(Xk(e)):{},Qk(t||!e||!e.__esModule?Ic(r,"default",{value:e,enumerable:!0}):r,e));function ew(){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,Wi.statSync)(r).size>0)return r}catch{}return null}function Hn(e=Ec){let t=e.replace(/\/[^/]+$/,"");(0,Wi.mkdirSync)(t,{recursive:!0});let r=new Tc.Database(e);return r.loadExtension(tw),r.exec("PRAGMA journal_mode = WAL"),r.exec("PRAGMA synchronous = NORMAL"),r.exec("PRAGMA cache_size = -32000"),r.exec("PRAGMA foreign_keys = ON"),rw(r),r}function rw(e){e.exec(`
3
3
  CREATE TABLE IF NOT EXISTS chunks (
4
4
  id TEXT PRIMARY KEY,
5
5
  session_id TEXT NOT NULL,
@@ -21,6 +21,9 @@
21
21
  indexed_at INTEGER NOT NULL
22
22
  );
23
23
 
24
+ CREATE INDEX IF NOT EXISTS idx_sessions_date ON sessions(date);
25
+ CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project);
26
+
24
27
  CREATE TABLE IF NOT EXISTS query_cache (
25
28
  query_hash TEXT PRIMARY KEY,
26
29
  embedding BLOB NOT NULL,
@@ -62,20 +65,20 @@
62
65
  INSERT INTO chunks_fts(chunks_fts, rowid, session_id, text) VALUES ('delete', old.rowid, old.session_id, old.text);
63
66
  INSERT INTO chunks_fts(rowid, session_id, text) VALUES (new.rowid, new.session_id, new.text);
64
67
  END;
65
- `)}var jc,Oh,jh,Nh,Qi,Nc,nw,ea=h(()=>{"use strict";jc=require("bun:sqlite"),Oh=require("sqlite-vec"),jh=require("path"),Nh=require("os"),Qi=require("fs"),Nc=(0,jh.join)((0,Nh.homedir)(),".qrec","qrec.db");if(process.platform==="darwin"){let e=rw();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.`);jc.Database.setCustomSQLite(e)}nw=(0,Oh.getLoadablePath)()});function Dh(e){if(e.length<=3600)return[{text:e,pos:0}];let t=iw(e),r=[],n="",o=0;for(let i of t){let a=n?n+`
68
+ `)}var Tc,Ph,Oh,jh,Wi,Ec,tw,Pc=h(()=>{"use strict";Tc=require("bun:sqlite"),Ph=require("sqlite-vec"),Oh=require("path"),jh=require("os"),Wi=require("fs"),Ec=(0,Oh.join)((0,jh.homedir)(),".qrec","qrec.db");if(process.platform==="darwin"){let e=ew();if(!e)throw new Error(`sqlite-vec requires a Homebrew SQLite build that supports dynamic extension loading. Install with: brew install sqlite
69
+ Then set BREW_PREFIX if Homebrew is in a non-standard location.`);Tc.Database.setCustomSQLite(e)}tw=(0,Ph.getLoadablePath)()});function Rh(e){if(e.length<=3600)return[{text:e,pos:0}];let t=nw(e),r=[],n="",o=0;for(let i of t){let a=n?n+`
67
70
 
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+`
71
+ `+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(-Nh),c=o+n.length-s.length;n=s+`
69
72
 
70
- `+i.text,o=c}else{let s=aw(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 iw(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 aw(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(`
73
+ `+i.text,o=c}else{let s=ow(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 nw(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 ow(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
74
 
72
75
  `,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,Rc=h(()=>{"use strict";ze={phase:"starting",modelDownload:{percent:0,downloadedMB:0,totalMB:null},indexing:{indexed:0,total:0,current:""}}});var Ch={};Et(Ch,{disposeEmbedder:()=>to,getEmbedder:()=>uw});async function sw(){if((0,ta.existsSync)(Dc))return console.log(`[embed] Found model at legacy path: ${Dc}`),Dc;console.log(`[embed] Resolving model: ${Ah}`),(0,ta.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 cw(){let e=await sw();ze.phase="model_loading",console.log(`[embed] Loading model from ${e}`);let{getLlama:t}=await import("node-llama-cpp");eo=await t();let n=await(await eo.loadModel({modelPath:e})).createEmbeddingContext({contextSize:8192});return console.log("[embed] Model loaded, embedding dimensions: 768"),n}async function to(){Wr&&(await Wr.dispose(),Wr=null),eo&&(await eo.dispose(),eo=null,Qn=null)}async function uw(){return Qn||(Qn=cw().catch(e=>{throw Qn=null,e})),Wr||(Wr=await Qn),{dimensions:768,async embed(e){let t=Wr,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 Zc,Ac,ta,Ah,Dc,Uh,eo,Wr,Qn,ra=h(()=>{"use strict";Zc=require("path"),Ac=require("os"),ta=require("fs");Rc();Ah="hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf",Dc=(0,Zc.join)((0,Ac.homedir)(),".cache","qmd","models","hf_ggml-org_embeddinggemma-300M-Q8_0.gguf"),Uh=(0,Zc.join)((0,Ac.homedir)(),".qrec","models"),eo=null,Wr=null,Qn=null});var Mh={};Et(Mh,{getOllamaEmbedder:()=>pw});function pw(){let e=process.env.QREC_OLLAMA_HOST??lw,t=process.env.QREC_OLLAMA_MODEL??dw;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 lw,dw,Lh=h(()=>{"use strict";lw="http://localhost:11434",dw="nomic-embed-text"});var qh={};Et(qh,{getOpenAIEmbedder:()=>hw});function hw(){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??mw).replace(/\/$/,""),r=process.env.QREC_OPENAI_MODEL??fw,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 mw,fw,Fh=h(()=>{"use strict";mw="https://api.openai.com/v1",fw="text-embedding-3-small"});var Jh={};Et(Jh,{getStubEmbedder:()=>gw});function gw(){return{dimensions:768,async embed(e){return Vh}}}var Vh,Bh=h(()=>{"use strict";Vh=new Float32Array(768);Vh[0]=1});async function Xr(){let e=(process.env.QREC_EMBED_PROVIDER??"local").toLowerCase().trim();switch(e){case"local":case"":{let{getEmbedder:t}=await Promise.resolve().then(()=>(ra(),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 na=h(()=>{"use strict"});function Gh(e){return e.replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g,"").replace(/<[^>]+\/>/g,"").trim()}function vw(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 yw(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 _w(e){if(!Array.isArray(e))return{text:"",tools:[],thinking:[]};let t=[],r=[],n=[];for(let o of e)if(o?.type==="text"&&typeof o.text=="string"){let i=o.text.trim();i&&t.push(i)}else if(o?.type==="tool_use"&&o.name)r.push(vw(o.name,o.input??{}));else if(o?.type==="thinking"&&typeof o.thinking=="string"){let i=o.thinking.trim();i&&n.push(i)}return{text:t.join(`
75
- `).trim(),tools:r,thinking:n}}async function Yr(e){let t=(0,Hh.readFileSync)(e,"utf-8"),r=(0,Kh.createHash)("sha256").update(t).digest("hex"),o=(0,Uc.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,Uc.basename)(l.cwd)),!s&&l.timestamp&&(s=l.timestamp.slice(0,10)),d.role==="user"&&l.type==="user"){let{text:p,isToolResult:m}=yw(d.content);if(m||!p)continue;c||(c=p.slice(0,120)),u.push({role:"user",text:p,tools:[],thinking:[],timestamp:l.timestamp??null})}if(d.role==="assistant"&&l.type==="assistant"){let{text:p,tools:m,thinking:g}=_w(d.content);if(!p&&m.length===0&&g.length===0)continue;u.push({role:"assistant",text:p,tools:m,thinking:g,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,Uc,oa=h(()=>{"use strict";Kh=require("crypto"),Hh=require("fs"),Uc=require("path")});function $w(e){let t=(0,Sr.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 bw(e){let t=e.match(/^# (.+)$/m);return t?t[1].trim():null}function xw(e){return(0,eg.createHash)("sha256").update(e).digest("hex")}function kw(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,Sr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".jsonl")&&t.push((0,Sr.join)(n,o));else r.endsWith(".jsonl")&&t.push(n)}return t}function ww(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,Sr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".md")&&t.push((0,Sr.join)(n,o));else r.endsWith(".md")&&t.push(n)}return t}function Sw(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 zw(e,t,r){let n=Sw(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 Yr(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 Iw(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:bw(r),hash:xw(r),chunkText:r}}async function ia(e,t,r={},n){let o=await Xr(),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=kw(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=ww(t);console.log(`[indexer] Found ${k.length} markdown files (legacy path)`),u=k.map(Iw).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=zw(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(`
76
+ `,o);a>n+3600*.5&&(o=a)}r.push({text:e.slice(n,o).trim(),pos:t+n}),n=Math.max(n+1,o-Nh)}return r}var Nh,Dh=h(()=>{"use strict";Nh=Math.floor(540)});var ze,Oc=h(()=>{"use strict";ze={phase:"starting",modelDownload:{percent:0,downloadedMB:0,totalMB:null},indexing:{indexed:0,total:0,current:""}}});var Ch={};Et(Ch,{disposeEmbedder:()=>Dc,getEmbedder:()=>sw});async function iw(){if((0,Xi.existsSync)(jc))return console.log(`[embed] Found model at legacy path: ${jc}`),jc;console.log(`[embed] Resolving model: ${Ah}`),(0,Xi.mkdirSync)(Zh,{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:Zh,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 aw(){let e=await iw();ze.phase="model_loading",console.log(`[embed] Loading model from ${e}`);let{getLlama:t}=await import("node-llama-cpp");Xn=await t();let n=await(await Xn.loadModel({modelPath:e})).createEmbeddingContext({contextSize:8192});return console.log("[embed] Model loaded, embedding dimensions: 768"),n}async function Dc(){Hr&&(await Hr.dispose(),Hr=null),Xn&&(await Xn.dispose(),Xn=null,Wn=null)}async function sw(){return Wn||(Wn=aw().catch(e=>{throw Wn=null,e})),Hr||(Hr=await Wn),{dimensions:768,async embed(e){let t=Hr,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 Nc,Rc,Xi,Ah,jc,Zh,Xn,Hr,Wn,Ac=h(()=>{"use strict";Nc=require("path"),Rc=require("os"),Xi=require("fs");Oc();Ah="hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf",jc=(0,Nc.join)((0,Rc.homedir)(),".cache","qmd","models","hf_ggml-org_embeddinggemma-300M-Q8_0.gguf"),Zh=(0,Nc.join)((0,Rc.homedir)(),".qrec","models"),Xn=null,Hr=null,Wn=null});var Uh={};Et(Uh,{getOllamaEmbedder:()=>lw});function lw(){let e=process.env.QREC_OLLAMA_HOST??cw,t=process.env.QREC_OLLAMA_MODEL??uw;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 cw,uw,Mh=h(()=>{"use strict";cw="http://localhost:11434",uw="nomic-embed-text"});var Lh={};Et(Lh,{getOpenAIEmbedder:()=>mw});function mw(){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??dw).replace(/\/$/,""),r=process.env.QREC_OPENAI_MODEL??pw,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 dw,pw,qh=h(()=>{"use strict";dw="https://api.openai.com/v1",pw="text-embedding-3-small"});var Vh={};Et(Vh,{getStubEmbedder:()=>fw});function fw(){return{dimensions:768,async embed(e){return Fh}}}var Fh,Jh=h(()=>{"use strict";Fh=new Float32Array(768);Fh[0]=1});async function Yi(){let e=(process.env.QREC_EMBED_PROVIDER??"local").toLowerCase().trim();switch(e){case"local":case"":{let{getEmbedder:t}=await Promise.resolve().then(()=>(Ac(),Ch));return t()}case"ollama":{let{getOllamaEmbedder:t}=await Promise.resolve().then(()=>(Mh(),Uh));return t()}case"openai":{let{getOpenAIEmbedder:t}=await Promise.resolve().then(()=>(qh(),Lh));return t()}case"stub":{let{getStubEmbedder:t}=await Promise.resolve().then(()=>(Jh(),Vh));return t()}default:throw new Error(`Unknown QREC_EMBED_PROVIDER: "${e}". Valid values: local, ollama, openai, stub`)}}var Zc=h(()=>{"use strict"});function Bh(e){return e.replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g,"").replace(/<[^>]+\/>/g,"").trim()}function hw(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 gw(e){if(typeof e=="string")return{text:Bh(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=Bh(n.text).trim();o&&r.push(o)}return{text:r.join(`
77
+ `).trim(),isToolResult:!1}}function vw(e){if(!Array.isArray(e))return{text:"",tools:[],thinking:[]};let t=[],r=[],n=[];for(let o of e)if(o?.type==="text"&&typeof o.text=="string"){let i=o.text.trim();i&&t.push(i)}else if(o?.type==="tool_use"&&o.name)r.push(hw(o.name,o.input??{}));else if(o?.type==="thinking"&&typeof o.thinking=="string"){let i=o.thinking.trim();i&&n.push(i)}return{text:t.join(`
78
+ `).trim(),tools:r,thinking:n}}async function Yn(e){let t=(0,Kh.readFileSync)(e,"utf-8"),r=(0,Gh.createHash)("sha256").update(t).digest("hex"),o=(0,Cc.basename)(e,".jsonl").replace(/-/g,"").slice(0,8),i=t.split(`
79
+ `).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,Cc.basename)(l.cwd)),!s&&l.timestamp&&(s=l.timestamp.slice(0,10)),d.role==="user"&&l.type==="user"){let{text:p,isToolResult:m}=gw(d.content);if(m||!p)continue;c||(c=p.slice(0,120)),u.push({role:"user",text:p,tools:[],thinking:[],timestamp:l.timestamp??null})}if(d.role==="assistant"&&l.type==="assistant"){let{text:p,tools:m,thinking:g}=vw(d.content);if(!p&&m.length===0&&g.length===0)continue;u.push({role:"assistant",text:p,tools:m,thinking:g,timestamp:l.timestamp??null})}}}return{session_id:o,path:e,project:a,date:s,title:c,hash:r,turns:u}}function Hh(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(`
80
+ `)}function Wh(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(`
81
+ `)}var Gh,Kh,Cc,Uc=h(()=>{"use strict";Gh=require("crypto"),Kh=require("fs"),Cc=require("path")});function yw(e){let t=(0,wr.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 $w(e){return(0,Qh.createHash)("sha256").update(e).digest("hex")}function bw(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,wr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".jsonl")&&t.push((0,wr.join)(n,o));else r.endsWith(".jsonl")&&t.push(n)}return t}function xw(e){let t=[];for(let r of(0,Le.readdirSync)(e)){let n=(0,wr.join)(e,r);if((0,Le.statSync)(n).isDirectory())for(let o of(0,Le.readdirSync)(n))o.endsWith(".md")&&t.push((0,wr.join)(n,o));else r.endsWith(".md")&&t.push(n)}return t}function kw(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 ww(e,t,r){let n=kw(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 Xh(e,t=2){try{let r=await Yn(e);if(r.turns.filter(i=>i.role==="user").length<t)return null;let o=Wh(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 Sw(e){let t=yw(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:$w(r),chunkText:r}}async function Qi(e,t,r={},n){let o=await Yi(),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 Xh(t,Yh);if(!z){console.log("[indexer] Session skipped (too few user turns or empty)");return}u=[z]}else if(a){let z=bw(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=>Xh(Me,Yh)))).filter(Me=>Me!==null)}else{let k=xw(t);console.log(`[indexer] Found ${k.length} markdown files (legacy path)`),u=k.map(Sw).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=ww(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
82
  INSERT OR REPLACE INTO sessions (id, path, project, date, title, hash, indexed_at)
80
83
  VALUES (?, ?, ?, ?, ?, ?, ?)
81
84
  `),_=e.prepare(`
@@ -84,14 +87,14 @@ Then set BREW_PREFIX if Homebrew is in a non-standard location.`);jc.Database.se
84
87
  `),x=e.prepare(`
85
88
  INSERT OR REPLACE INTO chunks_vec (chunk_id, embedding)
86
89
  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:kr}=p[z],Gr=Dh(kr),tr=Date.now(),Wn=e.transaction(()=>(j.run(k),P.run(`${k}_%`),y.run(k,$e,Ie,Me,$t,Ct,tr),Gr))();process.stdout.write(`[${z+1}/${p.length}] ${k} (${Ie}/${Me}) \u2014 ${Wn.length} chunks
88
- `),n?.(z,p.length,k);let Pc=e.transaction(A=>{for(let{chunkId:_e,seq:He,pos:tt,text:Kr,embedding:Hr}of A)_.run(_e,k,He,tt,Kr,tr),x.run(_e,Buffer.from(Hr.buffer))}),Xn=[];for(let A=0;A<Wn.length;A++){let _e=Wn[A],He=`${k}_${A}`,tt=await o.embed(_e.text);Xn.push({chunkId:He,seq:A,pos:_e.pos,text:_e.text,embedding:tt})}Pc(Xn)}n?.(p.length,p.length,""),console.log(`[indexer] Done. Total sessions indexed: ${p.length}`)}var Le,Sr,eg,Qh,Cc=h(()=>{"use strict";Le=require("fs"),Sr=require("path"),eg=require("crypto");Zh();na();oa();Qh=2});function Tw(){(0,rt.mkdirSync)(rg,{recursive:!0})}function ng(){if(!(0,rt.existsSync)(zr))return!1;let e=parseInt((0,rt.readFileSync)(zr,"utf-8").trim(),10);if(isNaN(e))return!1;try{return process.kill(e,0),!0}catch{try{(0,rt.unlinkSync)(zr)}catch{}return!1}}function Qr(){if(!(0,rt.existsSync)(zr))return null;let e=parseInt((0,rt.readFileSync)(zr,"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}Tw();let e=(0,ro.join)(rg,"qrec.log"),t=typeof tg.dir=="string"?["bun","run",(0,ro.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)(zr,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)(zr)}catch{}console.log("[daemon] qrec server stopped.")}var ro,Mc,rt,tg,zr,rg,Fc=h(()=>{"use strict";ro=require("path"),Mc=require("os"),rt=require("fs"),tg={},zr=(0,ro.join)((0,Mc.homedir)(),".qrec","qrec.pid"),rg=(0,ro.join)((0,Mc.homedir)(),".qrec")});function Ew(e){return(0,ig.createHash)("sha256").update(e).digest("hex")}async function Pw(e,t,r){let n=Ew(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 no(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 Pw(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,Kr]of j)if(Kr===A){let Hr=y.get(String(tt));Hr!==void 0&&(_e+=1/(og+Hr));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(","),kr=e.prepare(`SELECT id, project, date, title FROM sessions WHERE id IN (${Ct})`).all(...$t),Gr=new Map(kr.map(A=>[A.id,A])),tr=$e.map(([,A])=>A.bestChunkId),Yi=tr.map(()=>"?").join(","),Wn=e.prepare(`SELECT id, session_id, text FROM chunks WHERE id IN (${Yi})`).all(...tr),Pc=new Map(Wn.map(A=>[A.id,A])),Xn=[];for(let[A,{score:_e,bestChunkId:He}]of $e){let tt=Gr.get(A);if(!tt)continue;let Kr=Pc.get(He),Hr=Kr?Kr.text.slice(0,200):"";Xn.push({session_id:A,score:_e,preview:Hr,project:tt.project,date:tt.date,title:tt.title,latency:{bm25Ms:s,embedMs:u,knnMs:m,fusionMs:Ie,totalMs:Me}})}return Xn}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(`
90
+ `),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:Ut,chunkText:kr}=p[z],Br=Rh(kr),tr=Date.now(),Bn=e.transaction(()=>(j.run(k),P.run(`${k}_%`),y.run(k,$e,Ie,Me,$t,Ut,tr),Br))();process.stdout.write(`[${z+1}/${p.length}] ${k} (${Ie}/${Me}) \u2014 ${Bn.length} chunks
91
+ `),n?.(z,p.length,k);let zc=e.transaction(Z=>{for(let{chunkId:_e,seq:He,pos:tt,text:Gr,embedding:Kr}of Z)_.run(_e,k,He,tt,Gr,tr),x.run(_e,Buffer.from(Kr.buffer))}),Gn=[];for(let Z=0;Z<Bn.length;Z++){let _e=Bn[Z],He=`${k}_${Z}`,tt=await o.embed(_e.text);Gn.push({chunkId:He,seq:Z,pos:_e.pos,text:_e.text,embedding:tt})}zc(Gn)}n?.(p.length,p.length,""),console.log(`[indexer] Done. Total sessions indexed: ${p.length}`)}var Le,wr,Qh,Yh,Mc=h(()=>{"use strict";Le=require("fs"),wr=require("path"),Qh=require("crypto");Dh();Zc();Uc();Yh=2});function Iw(e){return(0,og.createHash)("sha256").update(e).digest("hex")}async function Tw(e,t,r){let n=Iw(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 ig(e,t,r,n=10){let o=performance.now(),i=performance.now(),a=[];try{let Z=r.replace(/[^a-zA-Z0-9\s'-]/g," ").replace(/\s+/g," ").trim();Z.length>0&&(a=e.prepare("SELECT rowid, session_id, rank FROM chunks_fts WHERE text MATCH ? ORDER BY rank LIMIT ?").all(Z,n*5))}catch{a=[]}let s=performance.now()-i,{embedding:c,embedMs:u}=await Tw(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 Z=0;Z<a.length;Z++){let _e=a[Z];y.set(String(_e.rowid),Z+1)}let _=new Map;for(let Z=0;Z<p.length;Z++)_.set(p[Z].chunk_id,Z+1);let x=a.map(Z=>Z.rowid),j=new Map;if(x.length>0){let Z=x.map(()=>"?").join(","),_e=e.prepare(`SELECT rowid, id FROM chunks WHERE rowid IN (${Z})`).all(...x);for(let He of _e)j.set(He.rowid,He.id)}let P=new Set;for(let Z of a){let _e=j.get(Z.rowid);_e&&P.add(_e)}for(let Z of p)P.add(Z.chunk_id);let z=new Map;for(let Z of P){let _e=0;for(let[tt,Gr]of j)if(Gr===Z){let Kr=y.get(String(tt));Kr!==void 0&&(_e+=1/(ng+Kr));break}let He=_.get(Z);He!==void 0&&(_e+=1/(ng+He)),z.set(Z,_e)}let k=new Map;for(let[Z,_e]of z){let He=Z.split("_").slice(0,-1).join("_"),tt=k.get(He);(!tt||_e>tt.score)&&k.set(He,{score:_e,bestChunkId:Z})}let $e=[...k.entries()].sort((Z,_e)=>_e[1].score-Z[1].score).slice(0,n),Ie=performance.now()-g,Me=performance.now()-o;if($e.length===0)return[];let $t=$e.map(([Z])=>Z),Ut=$t.map(()=>"?").join(","),kr=e.prepare(`SELECT id, project, date, title FROM sessions WHERE id IN (${Ut})`).all(...$t),Br=new Map(kr.map(Z=>[Z.id,Z])),tr=$e.map(([,Z])=>Z.bestChunkId),Hi=tr.map(()=>"?").join(","),Bn=e.prepare(`SELECT id, session_id, text FROM chunks WHERE id IN (${Hi})`).all(...tr),zc=new Map(Bn.map(Z=>[Z.id,Z])),Gn=[];for(let[Z,{score:_e,bestChunkId:He}]of $e){let tt=Br.get(Z);if(!tt)continue;let Gr=zc.get(He),Kr=Gr?Gr.text.slice(0,200):"";Gn.push({session_id:Z,score:_e,preview:Kr,project:tt.project,date:tt.date,title:tt.title,latency:{bm25Ms:s,embedMs:u,knnMs:m,fusionMs:Ie,totalMs:Me}})}return Gn}var og,ng,ag=h(()=>{"use strict";og=require("crypto"),ng=60});function sg(e,t,r,n,o){let i=n[0]??null;e.prepare(`
89
92
  INSERT INTO query_audit (query, k, result_count, top_session_id, top_score, duration_ms, created_at)
90
93
  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 oo(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(){if(mg!==null)return new Response(mg,{headers:{"Content-Type":"text/html; charset=utf-8"}});if(!(0,ao.existsSync)(fg))return Response.json({error:"UI not found"},{status:404});let e=await Bun.file(fg).text();return new Response(e,{headers:{"Content-Type":"text/html; charset=utf-8"}})}async function jw(){console.log("[server] Starting qrec server...");let e=wr(),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, title, project, date, indexed_at FROM sessions ORDER BY date DESC, indexed_at DESC LIMIT 100").all(),d=e.prepare("SELECT COUNT(*) as count FROM sessions").get().count;return Response.json({sessions:l,total:d})}if(c.method==="GET"&&u.pathname.startsWith("/sessions/")){let l=u.pathname.slice(10);if(!l||l.includes("/"))return Response.json({error:"Not found"},{status:404});let d=e.prepare("SELECT id, title, project, date, path FROM sessions WHERE id = ?").get(l);if(!d)return Response.json({error:"Session not found"},{status:404});try{let p=await Yr(d.path);return Response.json({id:d.id,title:d.title,project:d.project,date:d.date,turns:p.turns})}catch(p){return console.error("[server] Failed to parse session:",p),Response.json({error:String(p)},{status:500})}}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 no(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();if(c.method==="GET"&&u.pathname==="/debug/log"){let l=(0,en.join)((0,io.homedir)(),".qrec","qrec.log"),d=parseInt(u.searchParams.get("lines")??"100",10);try{let m=(0,ao.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:Nc,logPath:(0,en.join)((0,io.homedir)(),".qrec","qrec.log"),modelCachePath:(0,en.join)((0,io.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}`),oo({type:"daemon_started"});async function a(){if(n||!(0,ao.existsSync)(dg))return;n=!0;let c=Date.now();oo({type:"index_started"}),ze.phase="indexing",ze.indexing={indexed:0,total:0,current:""};let u=0,l=0;try{await ia(e,dg,{},(d,p,m)=>{ze.indexing={indexed:d,total:p,current:m},m&&d>l&&(oo({type:"session_indexed",data:{sessionId:m}}),u++,l=d)}),oo({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 Xr(),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 en,ao,io,Rw,Kc,dg,pg,mg,fg,hg=h(()=>{"use strict";ea();na();Vc();cg();Cc();oa();Rc();lg();en=require("path"),ao=require("fs"),io=require("os"),Rw={},Kc=3030,dg=(0,en.join)((0,io.homedir)(),".claude","projects"),pg=parseInt(process.env.QREC_INDEX_INTERVAL_MS??"60000",10),mg=`<!DOCTYPE html>
94
+ `).run(t,r,n.length,i?.session_id??null,i?.score??null,o,Date.now())}function cg(e,t=100){return e.prepare("SELECT * FROM query_audit ORDER BY created_at DESC LIMIT ?").all(t)}var ug=h(()=>{"use strict"});function eo(e){let t={ts:Date.now(),...e};try{(0,rr.mkdirSync)((0,Jc.join)((0,Bc.homedir)(),".qrec"),{recursive:!0}),(0,rr.appendFileSync)(Vc,JSON.stringify(t)+`
95
+ `,"utf-8")}catch{}}function lg(e=100){if(!(0,rr.existsSync)(Vc))return[];try{return(0,rr.readFileSync)(Vc,"utf-8").split(`
96
+ `).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 Jc,Bc,rr,Vc,dg=h(()=>{"use strict";Jc=require("path"),Bc=require("os"),rr=require("fs"),Vc=(0,Jc.join)((0,Bc.homedir)(),".qrec","activity.jsonl")});var Ow={};async function Ew(){if(fg!==null)return new Response(fg,{headers:{"Content-Type":"text/html; charset=utf-8"}});if(!(0,ro.existsSync)(hg))return Response.json({error:"UI not found"},{status:404});let e=await Bun.file(hg).text();return new Response(e,{headers:{"Content-Type":"text/html; charset=utf-8"}})}async function Pw(){console.log("[server] Starting qrec server...");let e=Hn(),t=null,r=null,n=!1;function o(){return e.prepare("SELECT COUNT(*) as count FROM sessions").get().count}let i=Bun.serve({port:Gc,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, title, project, date, indexed_at FROM sessions ORDER BY date DESC, indexed_at DESC LIMIT 100").all(),d=e.prepare("SELECT COUNT(*) as count FROM sessions").get().count;return Response.json({sessions:l,total:d})}if(c.method==="GET"&&u.pathname.startsWith("/sessions/")&&u.pathname.endsWith("/markdown")){let l=u.pathname.slice(10,-9);if(!l)return Response.json({error:"Not found"},{status:404});let d=e.prepare("SELECT path FROM sessions WHERE id = ?").get(l);if(!d)return new Response("Session not found",{status:404});try{let p=await Yn(d.path);return new Response(Hh(p),{headers:{"Content-Type":"text/plain; charset=utf-8"}})}catch(p){return console.error("[server] Failed to render session markdown:",p),new Response(String(p),{status:500})}}if(c.method==="GET"&&u.pathname.startsWith("/sessions/")){let l=u.pathname.slice(10);if(!l||l.includes("/"))return Response.json({error:"Not found"},{status:404});let d=e.prepare("SELECT id, title, project, date, path FROM sessions WHERE id = ?").get(l);if(!d)return Response.json({error:"Session not found"},{status:404});try{let p=await Yn(d.path);return Response.json({id:d.id,title:d.title,project:d.project,date:d.date,turns:p.turns})}catch(p){return console.error("[server] Failed to parse session:",p),Response.json({error:String(p)},{status:500})}}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 ig(e,t,d,p),y=performance.now()-m;try{sg(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==="POST"&&u.pathname==="/query_db"){let l;try{l=await c.json()}catch{return Response.json({error:"Invalid JSON body"},{status:400})}let d=l.sql?.trim()??"";if(!d)return Response.json({error:"Missing required field: sql"},{status:400});if(!d.toUpperCase().startsWith("SELECT"))return Response.json({error:"Only SELECT queries are allowed"},{status:400});if(d.includes(";"))return Response.json({error:"Semicolons are not allowed (no statement stacking)"},{status:400});try{let p=e.prepare(d).all();return Response.json({rows:p,count:p.length})}catch(p){return Response.json({error:String(p)},{status:500})}}if(c.method==="GET"&&u.pathname==="/audit/entries"){let l=parseInt(u.searchParams.get("limit")??"100",10);try{let d=cg(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=lg(l);return Response.json({entries:d})}if(c.method==="GET"&&(u.pathname==="/"||u.pathname==="/search"||u.pathname==="/audit"||u.pathname==="/debug"))return Ew();if(c.method==="GET"&&u.pathname==="/debug/log"){let l=(0,Wr.join)((0,to.homedir)(),".qrec","qrec.log"),d=parseInt(u.searchParams.get("lines")??"100",10);try{let m=(0,ro.readFileSync)(l,"utf-8").split(`
97
+ `).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:Ec,logPath:(0,Wr.join)((0,to.homedir)(),".qrec","qrec.log"),modelCachePath:(0,Wr.join)((0,to.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:mg,port:Gc,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:${Gc}`),eo({type:"daemon_started"});async function a(){if(n||!(0,ro.existsSync)(pg))return;n=!0;let c=Date.now();eo({type:"index_started"}),ze.phase="indexing",ze.indexing={indexed:0,total:0,current:""};let u=0,l=0;try{await Qi(e,pg,{},(d,p,m)=>{ze.indexing={indexed:d,total:p,current:m},m&&d>l&&(eo({type:"session_indexed",data:{sessionId:m}}),u++,l=d)}),eo({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 Yi(),r=null,console.log("[server] Model ready"),await a(),ze.phase="ready",setInterval(a,mg);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 Wr,ro,to,jw,Gc,pg,mg,fg,hg,gg=h(()=>{"use strict";Pc();Zc();ag();ug();Mc();Uc();Oc();dg();Wr=require("path"),ro=require("fs"),to=require("os"),jw={},Gc=3030,pg=(0,Wr.join)((0,to.homedir)(),".claude","projects"),mg=parseInt(process.env.QREC_INDEX_INTERVAL_MS??"60000",10),fg=`<!DOCTYPE html>
95
98
  <html lang="en">
96
99
  <head>
97
100
  <meta charset="UTF-8">
@@ -1450,9 +1453,9 @@ function showToolOutput(text) {
1450
1453
  </script>
1451
1454
  </body>
1452
1455
  </html>
1453
- `,fg=(0,en.join)(Rw.dir??__dirname,"..","ui","index.html");jw().catch(e=>{console.error("[server] Fatal error:",e),process.exit(1)})});var ee,gg,T,Mt,so=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})})(gg||(gg={}));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,aa=h(()=>{so();$=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 Dw,nr,Hc=h(()=>{aa();so();Dw=(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}},nr=Dw});function co(){return Zw}var Zw,sa=h(()=>{Hc();Zw=nr});function w(e,t){let r=co(),n=ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===nr?void 0:nr].filter(o=>!!o)});e.common.issues.push(n)}var ca,Re,M,tn,qe,Wc,Xc,Ir,uo,Yc=h(()=>{sa();Hc();ca=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"}),tn=e=>({status:"dirty",value:e}),qe=e=>({status:"valid",value:e}),Wc=e=>e.status==="aborted",Xc=e=>e.status==="dirty",Ir=e=>e.status==="valid",uo=e=>typeof Promise<"u"&&e instanceof Promise});var vg=h(()=>{});var O,yg=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 bg(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 Qw(e){return new RegExp(`^${bg(e)}$`)}function eS(e){let t=`${$g}T${bg(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 tS(e,t){return!!((t==="v4"||!t)&&Bw.test(e)||(t==="v6"||!t)&&Kw.test(e))}function rS(e,t){if(!qw.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 nS(e,t){return!!((t==="v4"||!t)&&Gw.test(e)||(t==="v6"||!t)&&Hw.test(e))}function oS(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 rn(e){if(e instanceof ot){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=bt.create(rn(n))}return new ot({...e._def,shape:()=>t})}else return e instanceof ir?new ir({...e._def,type:rn(e.element)}):e instanceof bt?bt.create(rn(e.unwrap())):e instanceof Ft?Ft.create(rn(e.unwrap())):e instanceof qt?qt.create(e.items.map(t=>rn(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 xg(e,t){return new dn({values:e,typeName:Z.ZodEnum,...V(t)})}var ut,_g,W,Aw,Uw,Cw,Mw,Lw,qw,Fw,Vw,Jw,Qc,Bw,Gw,Kw,Hw,Ww,Xw,$g,Yw,nn,lo,po,mo,fo,ho,on,an,go,or,Pt,vo,ir,ot,sn,Lt,eu,cn,qt,ru,yo,_o,nu,un,ln,dn,pn,Tr,xt,bt,Ft,mn,fn,$o,ua,la,hn,n1,Z,o1,i1,a1,s1,c1,u1,l1,d1,p1,m1,f1,h1,g1,v1,iS,y1,_1,$1,b1,x1,k1,w1,S1,z1,I1,T1,E1,P1,O1,j1,N1,R1,D1,Z1,kg=h(()=>{aa();sa();yg();Yc();so();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}},_g=(e,t)=>{if(Ir(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(uo(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 _g(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 Ir(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=>Ir(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(uo(o)?o:Promise.resolve(o));return _g(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 ir.create(this)}promise(){return Tr.create(this,this._def)}or(t){return sn.create([this,t],this._def)}and(t){return cn.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 mn({...V(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new ua({typeName:Z.ZodBranded,type:this,...V(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fn({...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 la.create(this,t)}readonly(){return hn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Aw=/^c[^\s-]{8,}$/i,Uw=/^[0-9a-z]+$/,Cw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Mw=/^[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,Lw=/^[a-z0-9_-]{21}$/i,qw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fw=/^[-+]?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)?)??$/,Vw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",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])$/,Gw=/^(?:(?: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])$/,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]))$/,Hw=/^(([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])$/,Ww=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xw=/^([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])))",Yw=new RegExp(`^${$g}$`);nn=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")Vw.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(Jw,"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")Mw.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")Lw.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")Aw.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")Uw.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")Cw.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"?eS(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Yw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Qw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Fw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?tS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?rS(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?nS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ww.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Xw.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}};nn.create=e=>new nn({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...V(e)});lo=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"?oS(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)}};lo.create=e=>new lo({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...V(e)});po=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}};po.create=e=>new po({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...V(e)});mo=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)}};mo.create=e=>new mo({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...V(e)});fo=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}};fo.create=e=>new fo({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...V(e)});ho=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)}};ho.create=e=>new ho({typeName:Z.ZodSymbol,...V(e)});on=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)}};on.create=e=>new on({typeName:Z.ZodUndefined,...V(e)});an=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)}};an.create=e=>new an({typeName:Z.ZodNull,...V(e)});go=class extends W{constructor(){super(...arguments),this._any=!0}_parse(t){return qe(t.data)}};go.create=e=>new go({typeName:Z.ZodAny,...V(e)});or=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qe(t.data)}};or.create=e=>new or({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)});vo=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)}};vo.create=e=>new vo({typeName:Z.ZodVoid,...V(e)});ir=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)}};ir.create=(e,t)=>new ir({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 rn(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 xg(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)});sn=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}};sn.create=(e,t)=>new sn({options:e,typeName:Z.ZodUnion,...V(t)});Lt=e=>e instanceof un?Lt(e.schema):e instanceof xt?Lt(e.innerType()):e instanceof ln?[e.value]:e instanceof dn?e.options:e instanceof pn?ee.objectValues(e.enum):e instanceof mn?Lt(e._def.innerType):e instanceof on?[void 0]:e instanceof an?[null]:e instanceof bt?[void 0,...Lt(e.unwrap())]:e instanceof Ft?[null,...Lt(e.unwrap())]:e instanceof ua||e instanceof hn?Lt(e.unwrap()):e instanceof fn?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)})}};cn=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}))}};cn.create=(e,t,r)=>new cn({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:nn.create(),valueType:t,typeName:Z.ZodRecord,...V(r)})}},yo=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}}}};yo.create=(e,t,r)=>new yo({valueType:t,keyType:e,typeName:Z.ZodMap,...V(r)});_o=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)}};_o.create=(e,t)=>new _o({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 ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),nr].filter(u=>!!u),issueData:{code:$.invalid_arguments,argumentsError:c}})}function o(s,c){return ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,co(),nr].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Tr){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(or.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(or.create()),returns:r||or.create(),typeName:Z.ZodFunction,...V(n)})}},un=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})}};un.create=(e,t)=>new un({getter:e,typeName:Z.ZodLazy,...V(t)});ln=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}};ln.create=(e,t)=>new ln({value:e,typeName:Z.ZodLiteral,...V(t)});dn=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})}};dn.create=xg;pn=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}};pn.create=(e,t)=>new pn({values:e,typeName:Z.ZodNativeEnum,...V(t)});Tr=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})))}};Tr.create=(e,t)=>new Tr({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"?tn(c.value):r.value==="dirty"?tn(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"?tn(s.value):r.value==="dirty"?tn(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(!Ir(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=>Ir(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)});mn=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}};mn.create=(e,t)=>new mn({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...V(t)});fn=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 uo(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}};fn.create=(e,t)=>new fn({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)});ua=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}},la=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(),tn(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})}},hn=class extends W{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ir(o)&&(o.value=Object.freeze(o.value)),o);return uo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:Z.ZodReadonly,...V(t)});n1={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={}));o1=nn.create,i1=lo.create,a1=$o.create,s1=po.create,c1=mo.create,u1=fo.create,l1=ho.create,d1=on.create,p1=an.create,m1=go.create,f1=or.create,h1=Pt.create,g1=vo.create,v1=ir.create,iS=ot.create,y1=ot.strictCreate,_1=sn.create,$1=eu.create,b1=cn.create,x1=qt.create,k1=ru.create,w1=yo.create,S1=_o.create,z1=nu.create,I1=un.create,T1=ln.create,E1=dn.create,P1=pn.create,O1=Tr.create,j1=xt.create,N1=bt.create,R1=Ft.create,D1=xt.createWithPreprocess,Z1=la.create});var ou=h(()=>{sa();Yc();vg();so();kg();aa()});var bo=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(da,e),da}var wg,Ot,Er,da,gn=h(()=>{wg=Object.freeze({status:"aborted"});Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Er=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},da={}});var b={};Et(b,{BIGINT_FORMAT_RANGES:()=>fu,Class:()=>au,NUMBER_FORMAT_RANGES:()=>mu,aborted:()=>ur,allowsEval:()=>uu,assert:()=>pS,assertEqual:()=>cS,assertIs:()=>lS,assertNever:()=>dS,assertNotEqual:()=>uS,assignProp:()=>sr,base64ToUint8Array:()=>jg,base64urlToUint8Array:()=>kS,cached:()=>yn,captureStackTrace:()=>ma,cleanEnum:()=>xS,cleanRegex:()=>wo,clone:()=>Fe,cloneDef:()=>fS,createTransparentProxy:()=>$S,defineLazy:()=>J,esc:()=>pa,escapeRegex:()=>lt,extend:()=>Tg,finalizeIssue:()=>We,floatSafeRemainder:()=>su,getElementAtPath:()=>hS,getEnumValues:()=>ko,getLengthableOrigin:()=>Io,getParsedType:()=>_S,getSizableOrigin:()=>zo,hexToUint8Array:()=>SS,isObject:()=>Pr,isPlainObject:()=>cr,issue:()=>_n,joinValues:()=>U,jsonStringifyReplacer:()=>vn,merge:()=>bS,mergeDefs:()=>Vt,normalizeParams:()=>S,nullish:()=>ar,numKeys:()=>yS,objectClone:()=>mS,omit:()=>Ig,optionalKeys:()=>pu,parsedType:()=>L,partial:()=>Pg,pick:()=>zg,prefixIssues:()=>it,primitiveTypes:()=>du,promiseAllObject:()=>gS,propertyKeyTypes:()=>So,randomString:()=>vS,required:()=>Og,safeExtend:()=>Eg,shallowClone:()=>lu,slugify:()=>cu,stringifyPrimitive:()=>C,uint8ArrayToBase64:()=>Ng,uint8ArrayToBase64url:()=>wS,uint8ArrayToHex:()=>zS,unwrapMessage:()=>xo});function cS(e){return e}function uS(e){return e}function lS(e){}function dS(e){throw new Error("Unexpected value in exhaustive check")}function pS(e){}function ko(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 vn(e,t){return typeof t=="bigint"?t.toString():t}function yn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(e){return e==null}function wo(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!==Sg)return n===void 0&&(n=Sg,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function mS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function sr(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 fS(e){return Vt(e._zod.def)}function hS(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function gS(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 vS(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function pa(e){return JSON.stringify(e)}function cu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cr(e){if(Pr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Pr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function lu(e){return cr(e)?{...e}:Array.isArray(e)?[...e]:e}function yS(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 zg(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 sr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Ig(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 sr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Tg(e,t){if(!cr(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 sr(this,"shape",i),i}});return Fe(e,o)}function Eg(e,t){if(!cr(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 sr(this,"shape",n),n}});return Fe(e,r)}function bS(e,t){let r=Vt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return sr(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function Pg(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 sr(this,"shape",c),c},checks:[]});return Fe(t,a)}function Og(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 sr(this,"shape",i),i}});return Fe(t,n)}function ur(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 xo(e){return typeof e=="string"?e:e?.message}function We(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=xo(e.inst?._zod.def?.error?.(e))??xo(t?.error?.(e))??xo(r.customError?.(e))??xo(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function zo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Io(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 _n(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function xS(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function jg(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 Ng(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function kS(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return jg(t+r)}function wS(e){return Ng(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function SS(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 zS(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Sg,ma,uu,_S,So,du,mu,fu,au,N=h(()=>{Sg=Symbol("evaluating");ma="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};uu=yn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});_S=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}`)}},So=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 ha(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 ga(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 Rg,fa,To,hu=h(()=>{gn();N();Rg=(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,vn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fa=f("$ZodError",Rg),To=f("$ZodError",Rg,{Parent:Error})});var Eo,Po,Oo,jo,No,$n,Ro,Do,Dg,Zg,Ag,Ug,Cg,Mg,Lg,qg,gu=h(()=>{gn();hu();N();Eo=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 ma(s,o?.callee),s}return a.value},Po=Eo(To),Oo=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 ma(s,o?.callee),s}return a.value},jo=Oo(To),No=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??fa)(i.issues.map(a=>We(a,o,Se())))}:{success:!0,data:i.value}},$n=No(To),Ro=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}},Do=Ro(To),Dg=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Eo(e)(t,r,o)},Zg=e=>(t,r,n)=>Eo(e)(t,r,n),Ag=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,r,o)},Ug=e=>async(t,r,n)=>Oo(e)(t,r,n),Cg=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return No(e)(t,r,o)},Mg=e=>(t,r,n)=>No(e)(t,r,n),Lg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ro(e)(t,r,o)},qg=e=>async(t,r,n)=>Ro(e)(t,r,n)});var dt={};Et(dt,{base64:()=>ju,base64url:()=>va,bigint:()=>Uu,boolean:()=>Mu,browserEmail:()=>DS,cidrv4:()=>Pu,cidrv6:()=>Ou,cuid:()=>vu,cuid2:()=>yu,date:()=>Ru,datetime:()=>Zu,domain:()=>US,duration:()=>ku,e164:()=>Nu,email:()=>Su,emoji:()=>zu,extendedDuration:()=>TS,guid:()=>wu,hex:()=>CS,hostname:()=>AS,html5Email:()=>jS,idnEmail:()=>RS,integer:()=>Cu,ipv4:()=>Iu,ipv6:()=>Tu,ksuid:()=>bu,lowercase:()=>Fu,mac:()=>Eu,md5_base64:()=>LS,md5_base64url:()=>qS,md5_hex:()=>MS,nanoid:()=>xu,null:()=>Lu,number:()=>ya,rfc5322Email:()=>NS,sha1_base64:()=>VS,sha1_base64url:()=>JS,sha1_hex:()=>FS,sha256_base64:()=>GS,sha256_base64url:()=>KS,sha256_hex:()=>BS,sha384_base64:()=>WS,sha384_base64url:()=>XS,sha384_hex:()=>HS,sha512_base64:()=>QS,sha512_base64url:()=>e0,sha512_hex:()=>YS,string:()=>Au,time:()=>Du,ulid:()=>_u,undefined:()=>qu,unicodeEmail:()=>Fg,uppercase:()=>Vu,uuid:()=>Or,uuid4:()=>ES,uuid6:()=>PS,uuid7:()=>OS,xid:()=>$u});function zu(){return new RegExp(ZS,"u")}function Jg(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(`^${Jg(e)}$`)}function Zu(e){let t=Jg({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(`^${Vg}T(?:${n})$`)}function Zo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ao(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var vu,yu,_u,$u,bu,xu,ku,TS,wu,Or,ES,PS,OS,Su,jS,NS,Fg,RS,DS,ZS,Iu,Tu,Eu,Pu,Ou,ju,va,AS,US,Nu,Vg,Ru,Au,Uu,Cu,ya,Mu,Lu,qu,Fu,Vu,CS,MS,LS,qS,FS,VS,JS,BS,GS,KS,HS,WS,XS,YS,QS,e0,_a=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)?)?)$/,TS=/^[-+]?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})$/,Or=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)$/,ES=Or(4),PS=Or(6),OS=Or(7),Su=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jS=/^[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])?)*$/,NS=/^(([^<>()\[\]\\.,;:\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,}))$/,Fg=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,RS=Fg,DS=/^[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])?)*$/,ZS="^(\\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}=))?$/,va=/^[A-Za-z0-9_-]*$/,AS=/^(?=.{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])?)*\.?$/,US=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Nu=/^\+[1-9]\d{6,14}$/,Vg="(?:(?:\\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(`^${Vg}$`);Au=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Uu=/^-?\d+n?$/,Cu=/^-?\d+$/,ya=/^-?\d+(?:\.\d+)?$/,Mu=/^(?:true|false)$/i,Lu=/^null$/i,qu=/^undefined$/i,Fu=/^[^A-Z]*$/,Vu=/^[^a-z]*$/,CS=/^[0-9a-fA-F]*$/;MS=/^[0-9a-fA-F]{32}$/,LS=Zo(22,"=="),qS=Ao(22),FS=/^[0-9a-fA-F]{40}$/,VS=Zo(27,"="),JS=Ao(27),BS=/^[0-9a-fA-F]{64}$/,GS=Zo(43,"="),KS=Ao(43),HS=/^[0-9a-fA-F]{96}$/,WS=Zo(64,""),XS=Ao(64),YS=/^[0-9a-fA-F]{128}$/,QS=Zo(86,"=="),e0=Ao(86)});function Bg(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues))}var le,Gg,Ju,Bu,Kg,Hg,Wg,Xg,Yg,Qg,ev,tv,rv,Uo,nv,ov,iv,av,sv,cv,uv,lv,dv,$a=h(()=>{gn();_a();N();le=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Gg={number:"number",bigint:"bigint",object:"date"},Ju=f("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=Gg[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=Gg[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})}}),Kg=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})}}),Hg=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})}}),Wg=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})}}),Xg=f("$ZodCheckMaxSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:zo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Yg=f("$ZodCheckMinSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:zo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qg=f("$ZodCheckSizeEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:zo(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})}}),ev=f("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=Io(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tv=f("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=Io(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rv=f("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=Io(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})}}),Uo=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=()=>{})}),nv=f("$ZodCheckRegex",(e,t)=>{Uo.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})}}),ov=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fu),Uo.init(e,t)}),iv=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vu),Uo.init(e,t)}),av=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})}}),sv=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})}}),cv=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})}});uv=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=>Bg(o,r,t.property));Bg(n,r,t.property)}}),lv=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})}}),dv=f("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var ba,Gu=h(()=>{ba=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(`
1456
+ `,hg=(0,Wr.join)(jw.dir??__dirname,"..","ui","index.html");Pw().catch(e=>{console.error("[server] Fatal error:",e),process.exit(1)})});var ee,vg,T,Mt,no=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})})(vg||(vg={}));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,ta=h(()=>{no();$=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 Nw,nr,Kc=h(()=>{ta();no();Nw=(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}},nr=Nw});function oo(){return Rw}var Rw,ra=h(()=>{Kc();Rw=nr});function w(e,t){let r=oo(),n=na({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===nr?void 0:nr].filter(o=>!!o)});e.common.issues.push(n)}var na,Re,M,Xr,qe,Hc,Wc,zr,io,Xc=h(()=>{ra();Kc();na=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"}),Xr=e=>({status:"dirty",value:e}),qe=e=>({status:"valid",value:e}),Hc=e=>e.status==="aborted",Wc=e=>e.status==="dirty",zr=e=>e.status==="valid",io=e=>typeof Promise<"u"&&e instanceof Promise});var yg=h(()=>{});var O,_g=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 xg(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 Xw(e){return new RegExp(`^${xg(e)}$`)}function Yw(e){let t=`${bg}T${xg(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 Qw(e,t){return!!((t==="v4"||!t)&&Vw.test(e)||(t==="v6"||!t)&&Bw.test(e))}function eS(e,t){if(!Mw.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 tS(e,t){return!!((t==="v4"||!t)&&Jw.test(e)||(t==="v6"||!t)&&Gw.test(e))}function rS(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 Yr(e){if(e instanceof ot){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=bt.create(Yr(n))}return new ot({...e._def,shape:()=>t})}else return e instanceof ir?new ir({...e._def,type:Yr(e.element)}):e instanceof bt?bt.create(Yr(e.unwrap())):e instanceof Ft?Ft.create(Yr(e.unwrap())):e instanceof qt?qt.create(e.items.map(t=>Yr(t))):e}function eu(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=eu(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=eu(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 kg(e,t){return new sn({values:e,typeName:A.ZodEnum,...V(t)})}var ut,$g,W,Dw,Aw,Zw,Cw,Uw,Mw,Lw,qw,Fw,Yc,Vw,Jw,Bw,Gw,Kw,Hw,bg,Ww,Qr,ao,so,co,uo,lo,en,tn,po,or,Pt,mo,ir,ot,rn,Lt,Qc,nn,qt,tu,fo,ho,ru,on,an,sn,cn,Ir,xt,bt,Ft,un,ln,go,oa,ia,dn,a1,A,s1,c1,u1,l1,d1,p1,m1,f1,h1,g1,v1,y1,_1,$1,nS,b1,x1,k1,w1,S1,z1,I1,T1,E1,P1,O1,j1,N1,R1,D1,A1,Z1,C1,U1,wg=h(()=>{ta();ra();_g();Xc();no();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}},$g=(e,t)=>{if(zr(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(io(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 $g(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 zr(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=>zr(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(io(o)?o:Promise.resolve(o));return $g(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:A.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 ir.create(this)}promise(){return Ir.create(this,this._def)}or(t){return rn.create([this,t],this._def)}and(t){return nn.create(this,t,this._def)}transform(t){return new xt({...V(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new un({...V(this._def),innerType:this,defaultValue:r,typeName:A.ZodDefault})}brand(){return new oa({typeName:A.ZodBranded,type:this,...V(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ln({...V(this._def),innerType:this,catchValue:r,typeName:A.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ia.create(this,t)}readonly(){return dn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dw=/^c[^\s-]{8,}$/i,Aw=/^[0-9a-z]+$/,Zw=/^[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,Uw=/^[a-z0-9_-]{21}$/i,Mw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lw=/^[-+]?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)?)??$/,qw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vw=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,Bw=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bg="((\\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])))",Ww=new RegExp(`^${bg}$`);Qr=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")qw.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")Yc||(Yc=new RegExp(Fw,"u")),Yc.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")Uw.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")Dw.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")Zw.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"?Yw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ww.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Xw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Lw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Qw(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?eS(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?tS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Kw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Hw.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}};Qr.create=e=>new Qr({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...V(e)});ao=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"?rS(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)}};ao.create=e=>new ao({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...V(e)});so=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}};so.create=e=>new so({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...V(e)});co=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)}};co.create=e=>new co({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...V(e)});uo=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}};uo.create=e=>new uo({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...V(e)});lo=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)}};lo.create=e=>new lo({typeName:A.ZodSymbol,...V(e)});en=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)}};en.create=e=>new en({typeName:A.ZodUndefined,...V(e)});tn=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)}};tn.create=e=>new tn({typeName:A.ZodNull,...V(e)});po=class extends W{constructor(){super(...arguments),this._any=!0}_parse(t){return qe(t.data)}};po.create=e=>new po({typeName:A.ZodAny,...V(e)});or=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qe(t.data)}};or.create=e=>new or({typeName:A.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:A.ZodNever,...V(e)});mo=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)}};mo.create=e=>new mo({typeName:A.ZodVoid,...V(e)});ir=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)}};ir.create=(e,t)=>new ir({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.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:A.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 Yr(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 kg(ee.objectKeys(this.shape))}};ot.create=(e,t)=>new ot({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:A.ZodObject,...V(t)});ot.strictCreate=(e,t)=>new ot({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:A.ZodObject,...V(t)});ot.lazycreate=(e,t)=>new ot({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:A.ZodObject,...V(t)});rn=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}};rn.create=(e,t)=>new rn({options:e,typeName:A.ZodUnion,...V(t)});Lt=e=>e instanceof on?Lt(e.schema):e instanceof xt?Lt(e.innerType()):e instanceof an?[e.value]:e instanceof sn?e.options:e instanceof cn?ee.objectValues(e.enum):e instanceof un?Lt(e._def.innerType):e instanceof en?[void 0]:e instanceof tn?[null]:e instanceof bt?[void 0,...Lt(e.unwrap())]:e instanceof Ft?[null,...Lt(e.unwrap())]:e instanceof oa||e instanceof dn?Lt(e.unwrap()):e instanceof ln?Lt(e._def.innerType):[],Qc=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:A.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...V(n)})}};nn=class extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Hc(i)||Hc(a))return M;let s=eu(i.value,a.value);return s.valid?((Wc(i)||Wc(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}))}};nn.create=(e,t,r)=>new nn({left:e,right:t,typeName:A.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:A.ZodTuple,rest:null,...V(t)})};tu=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:A.ZodRecord,...V(n)}):new e({keyType:Qr.create(),valueType:t,typeName:A.ZodRecord,...V(r)})}},fo=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}}}};fo.create=(e,t,r)=>new fo({valueType:t,keyType:e,typeName:A.ZodMap,...V(r)});ho=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)}};ho.create=(e,t)=>new ho({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...V(t)});ru=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 na({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oo(),nr].filter(u=>!!u),issueData:{code:$.invalid_arguments,argumentsError:c}})}function o(s,c){return na({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oo(),nr].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Ir){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(or.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(or.create()),returns:r||or.create(),typeName:A.ZodFunction,...V(n)})}},on=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})}};on.create=(e,t)=>new on({getter:e,typeName:A.ZodLazy,...V(t)});an=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}};an.create=(e,t)=>new an({value:e,typeName:A.ZodLiteral,...V(t)});sn=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})}};sn.create=kg;cn=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}};cn.create=(e,t)=>new cn({values:e,typeName:A.ZodNativeEnum,...V(t)});Ir=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})))}};Ir.create=(e,t)=>new Ir({type:e,typeName:A.ZodPromise,...V(t)});xt=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.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"?Xr(c.value):r.value==="dirty"?Xr(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"?Xr(s.value):r.value==="dirty"?Xr(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(!zr(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=>zr(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:A.ZodEffects,effect:t,...V(r)});xt.createWithPreprocess=(e,t,r)=>new xt({schema:t,effect:{type:"preprocess",transform:e},typeName:A.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:A.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:A.ZodNullable,...V(t)});un=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}};un.create=(e,t)=>new un({innerType:e,typeName:A.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...V(t)});ln=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 io(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}};ln.create=(e,t)=>new ln({innerType:e,typeName:A.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...V(t)});go=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}}};go.create=e=>new go({typeName:A.ZodNaN,...V(e)});oa=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}},ia=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(),Xr(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:A.ZodPipeline})}},dn=class extends W{_parse(t){let r=this._def.innerType._parse(t),n=o=>(zr(o)&&(o.value=Object.freeze(o.value)),o);return io(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};dn.create=(e,t)=>new dn({innerType:e,typeName:A.ZodReadonly,...V(t)});a1={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"})(A||(A={}));s1=Qr.create,c1=ao.create,u1=go.create,l1=so.create,d1=co.create,p1=uo.create,m1=lo.create,f1=en.create,h1=tn.create,g1=po.create,v1=or.create,y1=Pt.create,_1=mo.create,$1=ir.create,nS=ot.create,b1=ot.strictCreate,x1=rn.create,k1=Qc.create,w1=nn.create,S1=qt.create,z1=tu.create,I1=fo.create,T1=ho.create,E1=ru.create,P1=on.create,O1=an.create,j1=sn.create,N1=cn.create,R1=Ir.create,D1=xt.create,A1=bt.create,Z1=Ft.create,C1=xt.createWithPreprocess,U1=ia.create});var nu=h(()=>{ra();Xc();yg();no();wg();ta()});var vo=h(()=>{nu();nu()});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(aa,e),aa}var Sg,Ot,Tr,aa,pn=h(()=>{Sg=Object.freeze({status:"aborted"});Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Tr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},aa={}});var b={};Et(b,{BIGINT_FORMAT_RANGES:()=>mu,Class:()=>iu,NUMBER_FORMAT_RANGES:()=>pu,aborted:()=>ur,allowsEval:()=>cu,assert:()=>lS,assertEqual:()=>aS,assertIs:()=>cS,assertNever:()=>uS,assertNotEqual:()=>sS,assignProp:()=>sr,base64ToUint8Array:()=>Ng,base64urlToUint8Array:()=>bS,cached:()=>fn,captureStackTrace:()=>ca,cleanEnum:()=>$S,cleanRegex:()=>$o,clone:()=>Fe,cloneDef:()=>pS,createTransparentProxy:()=>yS,defineLazy:()=>J,esc:()=>sa,escapeRegex:()=>lt,extend:()=>Eg,finalizeIssue:()=>We,floatSafeRemainder:()=>au,getElementAtPath:()=>mS,getEnumValues:()=>_o,getLengthableOrigin:()=>ko,getParsedType:()=>vS,getSizableOrigin:()=>xo,hexToUint8Array:()=>kS,isObject:()=>Er,isPlainObject:()=>cr,issue:()=>hn,joinValues:()=>C,jsonStringifyReplacer:()=>mn,merge:()=>_S,mergeDefs:()=>Vt,normalizeParams:()=>S,nullish:()=>ar,numKeys:()=>gS,objectClone:()=>dS,omit:()=>Tg,optionalKeys:()=>du,parsedType:()=>L,partial:()=>Og,pick:()=>Ig,prefixIssues:()=>it,primitiveTypes:()=>lu,promiseAllObject:()=>fS,propertyKeyTypes:()=>bo,randomString:()=>hS,required:()=>jg,safeExtend:()=>Pg,shallowClone:()=>uu,slugify:()=>su,stringifyPrimitive:()=>U,uint8ArrayToBase64:()=>Rg,uint8ArrayToBase64url:()=>xS,uint8ArrayToHex:()=>wS,unwrapMessage:()=>yo});function aS(e){return e}function sS(e){return e}function cS(e){}function uS(e){throw new Error("Unexpected value in exhaustive check")}function lS(e){}function _o(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 C(e,t="|"){return e.map(r=>U(r)).join(t)}function mn(e,t){return typeof t=="bigint"?t.toString():t}function fn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(e){return e==null}function $o(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function au(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!==zg)return n===void 0&&(n=zg,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function sr(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 pS(e){return Vt(e._zod.def)}function mS(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function fS(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 hS(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function sa(e){return JSON.stringify(e)}function su(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Er(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cr(e){if(Er(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Er(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function uu(e){return cr(e)?{...e}:Array.isArray(e)?[...e]:e}function gS(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 yS(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 U(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function du(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Ig(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 sr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Tg(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 sr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Eg(e,t){if(!cr(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 sr(this,"shape",i),i}});return Fe(e,o)}function Pg(e,t){if(!cr(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 sr(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 sr(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function Og(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 sr(this,"shape",c),c},checks:[]});return Fe(t,a)}function jg(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 sr(this,"shape",i),i}});return Fe(t,n)}function ur(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 yo(e){return typeof e=="string"?e:e?.message}function We(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=yo(e.inst?._zod.def?.error?.(e))??yo(t?.error?.(e))??yo(r.customError?.(e))??yo(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function xo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ko(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 hn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function $S(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ng(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 Rg(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function bS(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Ng(t+r)}function xS(e){return Rg(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function kS(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 wS(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var zg,ca,cu,vS,bo,lu,pu,mu,iu,N=h(()=>{zg=Symbol("evaluating");ca="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};cu=fn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});vS=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}`)}},bo=new Set(["string","number","symbol"]),lu=new Set(["string","number","bigint","boolean","symbol","undefined"]);pu={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]},mu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};iu=class{constructor(...t){}}});function la(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 da(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 Dg,ua,wo,fu=h(()=>{pn();N();Dg=(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,mn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ua=f("$ZodError",Dg),wo=f("$ZodError",Dg,{Parent:Error})});var So,zo,Io,To,Eo,gn,Po,Oo,Ag,Zg,Cg,Ug,Mg,Lg,qg,Fg,hu=h(()=>{pn();fu();N();So=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 ca(s,o?.callee),s}return a.value},zo=So(wo),Io=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 ca(s,o?.callee),s}return a.value},To=Io(wo),Eo=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??ua)(i.issues.map(a=>We(a,o,Se())))}:{success:!0,data:i.value}},gn=Eo(wo),Po=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}},Oo=Po(wo),Ag=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return So(e)(t,r,o)},Zg=e=>(t,r,n)=>So(e)(t,r,n),Cg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Io(e)(t,r,o)},Ug=e=>async(t,r,n)=>Io(e)(t,r,n),Mg=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Eo(e)(t,r,o)},Lg=e=>(t,r,n)=>Eo(e)(t,r,n),qg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Po(e)(t,r,o)},Fg=e=>async(t,r,n)=>Po(e)(t,r,n)});var dt={};Et(dt,{base64:()=>Ou,base64url:()=>pa,bigint:()=>Zu,boolean:()=>Uu,browserEmail:()=>NS,cidrv4:()=>Eu,cidrv6:()=>Pu,cuid:()=>gu,cuid2:()=>vu,date:()=>Nu,datetime:()=>Du,domain:()=>AS,duration:()=>xu,e164:()=>ju,email:()=>wu,emoji:()=>Su,extendedDuration:()=>zS,guid:()=>ku,hex:()=>ZS,hostname:()=>DS,html5Email:()=>PS,idnEmail:()=>jS,integer:()=>Cu,ipv4:()=>zu,ipv6:()=>Iu,ksuid:()=>$u,lowercase:()=>qu,mac:()=>Tu,md5_base64:()=>US,md5_base64url:()=>MS,md5_hex:()=>CS,nanoid:()=>bu,null:()=>Mu,number:()=>ma,rfc5322Email:()=>OS,sha1_base64:()=>qS,sha1_base64url:()=>FS,sha1_hex:()=>LS,sha256_base64:()=>JS,sha256_base64url:()=>BS,sha256_hex:()=>VS,sha384_base64:()=>KS,sha384_base64url:()=>HS,sha384_hex:()=>GS,sha512_base64:()=>XS,sha512_base64url:()=>YS,sha512_hex:()=>WS,string:()=>Au,time:()=>Ru,ulid:()=>yu,undefined:()=>Lu,unicodeEmail:()=>Vg,uppercase:()=>Fu,uuid:()=>Pr,uuid4:()=>IS,uuid6:()=>TS,uuid7:()=>ES,xid:()=>_u});function Su(){return new RegExp(RS,"u")}function Bg(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 Ru(e){return new RegExp(`^${Bg(e)}$`)}function Du(e){let t=Bg({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(`^${Jg}T(?:${n})$`)}function jo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function No(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var gu,vu,yu,_u,$u,bu,xu,zS,ku,Pr,IS,TS,ES,wu,PS,OS,Vg,jS,NS,RS,zu,Iu,Tu,Eu,Pu,Ou,pa,DS,AS,ju,Jg,Nu,Au,Zu,Cu,ma,Uu,Mu,Lu,qu,Fu,ZS,CS,US,MS,LS,qS,FS,VS,JS,BS,GS,KS,HS,WS,XS,YS,fa=h(()=>{N();gu=/^[cC][^\s-]{8,}$/,vu=/^[0-9a-z]+$/,yu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_u=/^[0-9a-vA-V]{20}$/,$u=/^[A-Za-z0-9]{27}$/,bu=/^[a-zA-Z0-9_-]{21}$/,xu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zS=/^[-+]?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)?)??$/,ku=/^([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})$/,Pr=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)$/,IS=Pr(4),TS=Pr(6),ES=Pr(7),wu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,PS=/^[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])?)*$/,OS=/^(([^<>()\[\]\\.,;:\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,}))$/,Vg=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,jS=Vg,NS=/^[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])?)*$/,RS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";zu=/^(?:(?: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])$/,Iu=/^(([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}|:))$/,Tu=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}$`)},Eu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Pu=/^(([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])$/,Ou=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pa=/^[A-Za-z0-9_-]*$/,DS=/^(?=.{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,}$/,ju=/^\+[1-9]\d{6,14}$/,Jg="(?:(?:\\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])))",Nu=new RegExp(`^${Jg}$`);Au=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Zu=/^-?\d+n?$/,Cu=/^-?\d+$/,ma=/^-?\d+(?:\.\d+)?$/,Uu=/^(?:true|false)$/i,Mu=/^null$/i,Lu=/^undefined$/i,qu=/^[^A-Z]*$/,Fu=/^[^a-z]*$/,ZS=/^[0-9a-fA-F]*$/;CS=/^[0-9a-fA-F]{32}$/,US=jo(22,"=="),MS=No(22),LS=/^[0-9a-fA-F]{40}$/,qS=jo(27,"="),FS=No(27),VS=/^[0-9a-fA-F]{64}$/,JS=jo(43,"="),BS=No(43),GS=/^[0-9a-fA-F]{96}$/,KS=jo(64,""),HS=No(64),WS=/^[0-9a-fA-F]{128}$/,XS=jo(86,"=="),YS=No(86)});function Gg(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues))}var le,Kg,Vu,Ju,Hg,Wg,Xg,Yg,Qg,ev,tv,rv,nv,Ro,ov,iv,av,sv,cv,uv,lv,dv,pv,ha=h(()=>{pn();fa();N();le=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Kg={number:"number",bigint:"bigint",object:"date"},Vu=f("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=Kg[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})}}),Ju=f("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);let r=Kg[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})}}),Hg=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):au(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})}}),Wg=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]=pu[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})}}),Xg=f("$ZodCheckBigIntFormat",(e,t)=>{le.init(e,t);let[r,n]=mu[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})}}),Yg=f("$ZodCheckMaxSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:xo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qg=f("$ZodCheckMinSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:xo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ev=f("$ZodCheckSizeEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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:xo(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})}}),tv=f("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=ko(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rv=f("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=ko(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nv=f("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!ar(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=ko(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})}}),Ro=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=()=>{})}),ov=f("$ZodCheckRegex",(e,t)=>{Ro.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})}}),iv=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qu),Ro.init(e,t)}),av=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fu),Ro.init(e,t)}),sv=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})}}),cv=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})}}),uv=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})}});lv=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=>Gg(o,r,t.property));Gg(n,r,t.property)}}),dv=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})}}),pv=f("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var ga,Bu=h(()=>{ga=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(`
1454
1457
  `).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(`
1455
- `))}}});var mv,Ku=h(()=>{mv={major:4,minor:3,patch:6}});function Sv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function t0(e){if(!va.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Sv(r)}function r0(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 fv(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function za(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 zv(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 Iv(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=>za(m,r,d,t,l))):za(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 hv(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=>!ur(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 gv(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(cr(e)&&cr(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 vv(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}),ur(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 xa(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function yv(e,t,r,n,o,i,a){e.issues.length&&(So.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&&(So.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 _v(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 bv(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function xv(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 ka(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function wa(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=>Sa(e,i,t.out,r)):Sa(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Sa(e,i,t.in,r)):Sa(e,o,t.in,r)}}function Sa(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function kv(e){return e.value=Object.freeze(e.value),e}function wv(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(_n(o))}}var F,jr,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,Ia,bl,Co,Ta,xl,kl,wl,Sl,zl,Il,Tl,El,Pl,Ol,Tv,Ev,Mo,jl,Nl,Rl,Ea,Dl,Zl,Al,Ul,Cl,Ml,Ll,Pa,ql,Fl,Vl,Jl,Bl,Gl,Kl,Hl,Wl,Lo,Xl,Yl,Ql,ed,td,rd,nd=h(()=>{$a();gn();Gu();gu();_a();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=mv;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=ur(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=ur(a,p)))});else{if(a.issues.length===p)continue;u||(u=ur(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(ur(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 Do(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),jr=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)=>{Uo.init(e,t),jr.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=Or(n))}else t.pattern??(t.pattern=Or());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=>{Sv(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=va),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{t0(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=>{r0(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})}}),Ia=f("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??ya,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)=>{Hg.init(e,t),Ia.init(e,t)}),Co=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}}),Ta=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)=>{Wg.init(e,t),Ta.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=>fv(u,r,a))):fv(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});Tv=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=yn(()=>zv(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=Pr,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(_=>za(_,s,p,u,g))):za(y,s,p,u,g)}return i?Iv(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Ev=f("$ZodObjectJIT",(e,t)=>{Tv.init(e,t);let r=e._zod.parse,n=yn(()=>zv(t)),o=p=>{let m=new ba(["shape","payload","ctx"]),g=n.value,y=P=>{let z=pa(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=pa(P),Ie=p[P]?._zod?.optout==="optional";m.write(`const ${z} = ${y(P)};`),Ie?m.write(`
1458
+ `))}}});var fv,Gu=h(()=>{fv={major:4,minor:3,patch:6}});function zv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function QS(e){if(!pa.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return zv(r)}function e0(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 hv(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function ba(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 Iv(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=du(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Tv(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=>ba(m,r,d,t,l))):ba(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 gv(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=>!ur(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 vv(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 Ku(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(cr(e)&&cr(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=Ku(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=Ku(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 yv(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}),ur(e))return e;let a=Ku(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 va(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function _v(e,t,r,n,o,i,a){e.issues.length&&(bo.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&&(bo.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 $v(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function bv(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function xv(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function kv(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 ya(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function _a(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=>$a(e,i,t.out,r)):$a(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>$a(e,i,t.in,r)):$a(e,o,t.in,r)}}function $a(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function wv(e){return e.value=Object.freeze(e.value),e}function Sv(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(hn(o))}}var F,Or,se,Hu,Wu,Xu,Yu,Qu,el,tl,rl,nl,ol,il,al,sl,cl,ul,ll,dl,pl,ml,fl,hl,gl,vl,yl,_l,xa,$l,Do,ka,bl,xl,kl,wl,Sl,zl,Il,Tl,El,Pl,Ev,Pv,Ao,Ol,jl,Nl,wa,Rl,Dl,Al,Zl,Cl,Ul,Ml,Sa,Ll,ql,Fl,Vl,Jl,Bl,Gl,Kl,Hl,Zo,Wl,Xl,Yl,Ql,ed,td,rd=h(()=>{ha();pn();Bu();hu();fa();N();Gu();N();F=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fv;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=ur(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=ur(a,p)))});else{if(a.issues.length===p)continue;u||(u=ur(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(ur(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=gn(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Oo(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Or=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)=>{Ro.init(e,t),Or.init(e,t)}),Hu=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ku),se.init(e,t)}),Wu=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=Pr(n))}else t.pattern??(t.pattern=Pr());se.init(e,t)}),Xu=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wu),se.init(e,t)}),Yu=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})}}}),Qu=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Su()),se.init(e,t)}),el=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=bu),se.init(e,t)}),tl=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gu),se.init(e,t)}),rl=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=vu),se.init(e,t)}),nl=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=yu),se.init(e,t)}),ol=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=_u),se.init(e,t)}),il=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$u),se.init(e,t)}),al=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Du(t)),se.init(e,t)}),sl=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nu),se.init(e,t)}),cl=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ru(t)),se.init(e,t)}),ul=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xu),se.init(e,t)}),ll=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zu),se.init(e,t),e._zod.bag.format="ipv4"}),dl=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Iu),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})}}}),pl=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Tu(t.delimiter)),se.init(e,t),e._zod.bag.format="mac"}),ml=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Eu),se.init(e,t)}),fl=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pu),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})}}});hl=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ou),se.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{zv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});gl=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=pa),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{QS(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vl=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ju),se.init(e,t)});yl=f("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=r=>{e0(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})}}),xa=f("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??ma,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}}),$l=f("$ZodNumberFormat",(e,t)=>{Wg.init(e,t),xa.init(e,t)}),Do=f("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Uu,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}}),ka=f("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Zu,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}}),bl=f("$ZodBigIntFormat",(e,t)=>{Xg.init(e,t),ka.init(e,t)}),xl=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}}),kl=f("$ZodUndefined",(e,t)=>{F.init(e,t),e._zod.pattern=Lu,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}}),wl=f("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=Mu,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}}),Sl=f("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),zl=f("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Il=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)}),Tl=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}}),El=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}});Pl=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=>hv(u,r,a))):hv(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});Ev=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=fn(()=>Iv(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=Er,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(_=>ba(_,s,p,u,g))):ba(y,s,p,u,g)}return i?Tv(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Pv=f("$ZodObjectJIT",(e,t)=>{Ev.init(e,t);let r=e._zod.parse,n=fn(()=>Iv(t)),o=p=>{let m=new ga(["shape","payload","ctx"]),g=n.value,y=P=>{let z=sa(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=sa(P),Ie=p[P]?._zod?.optout==="optional";m.write(`const ${z} = ${y(P)};`),Ie?m.write(`
1456
1459
  if (${z}.issues.length) {
1457
1460
  if (${k} in input) {
1458
1461
  payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
@@ -1486,18 +1489,31 @@ function showToolOutput(text) {
1486
1489
  newResult[${k}] = ${z}.value;
1487
1490
  }
1488
1491
 
1489
- `)}m.write("payload.value = newResult;"),m.write("return payload;");let j=m.compile();return(P,z)=>j(p,P,z)},i,a=Pr,s=!da.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?Iv([],g,p,m,d,e):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});Mo=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=>wo(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=>hv(c,o,e,i)):hv(s,o,e,i)}});jl=f("$ZodXor",(e,t)=>{Mo.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=>gv(c,o,e,i)):gv(s,o,e,i)}}),Nl=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Mo.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=yn(()=>{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(!Pr(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])=>vv(r,c,u)):vv(r,i,a)}});Ea=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=>xa(p,n,u))):xa(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=>xa(m,n,u))):xa(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(!cr(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"&&ya.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])=>{yv(l,d,r,a,o,e,n)})):yv(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=>_v(c,r))):_v(s,r)}return i.length?Promise.all(i).then(()=>r):r}});Ul=f("$ZodEnum",(e,t)=>{F.init(e,t);let r=ko(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>So.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 Er(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}});Pa=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(`^(${wo(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)=>{Pa.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(`^(${wo(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=>bv(i,t)):bv(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=>xv(i,e)):xv(o,e)}});Gl=f("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Er("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=>ka(a,t.in,n)):ka(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ka(i,t.out,n)):ka(o,t.out,n)}});Lo=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=>wa(a,t,n)):wa(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>wa(a,t,n)):wa(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(kv):kv(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?Po(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Po(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 jo(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await jo(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 Ea({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=>wv(i,r,n,e));wv(o,r,n,e)}})});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()});var Av=h(()=>{N()});function od(){return{localeError:o0()}}var o0,id=h(()=>{N();o0=()=>{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 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 Xv=h(()=>{N()});var ad=h(()=>{N()});var Yv=h(()=>{ad()});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 fy=h(()=>{N()});var sd=h(()=>{N()});var hy=h(()=>{sd()});var gy=h(()=>{N()});var vy=h(()=>{N()});var yy=h(()=>{N()});var _y=h(()=>{N()});var $y=h(()=>{N()});var by=h(()=>{N()});var Oa=h(()=>{Pv();Ov();jv();Nv();Rv();Dv();Zv();Av();id();Uv();Cv();Mv();Lv();qv();Fv();Vv();Jv();Bv();Gv();Kv();Hv();Wv();Xv();Yv();ad();Qv();ey();ty();ry();ny();oy();iy();ay();sy();cy();uy();ly();dy();py();my();fy();hy();sd();gy();vy();yy();_y();$y();by()});function ld(){return new ud}var xy,ud,Ve,qo=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)}};(xy=globalThis).__zod_globalRegistry??(xy.__zod_globalRegistry=ld());Ve=globalThis.__zod_globalRegistry});function dd(e,t){return new e({type:"string",...S(t)})}function ja(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function Fo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Na(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Da(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Za(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function Vo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function Aa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function Ua(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Ca(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Ma(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function La(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function qa(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Va(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Ja(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 Ba(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Ga(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Ka(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Ha(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function Wa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function Xa(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 Nr(e,t){return new Kg({check:"multiple_of",...S(t),value:e})}function Rr(e,t){return new Xg({check:"max_size",...S(t),maximum:e})}function Gt(e,t){return new Yg({check:"min_size",...S(t),minimum:e})}function bn(e,t){return new Qg({check:"size_equals",...S(t),size:e})}function xn(e,t){return new ev({check:"max_length",...S(t),maximum:e})}function lr(e,t){return new tv({check:"min_length",...S(t),minimum:e})}function kn(e,t){return new rv({check:"length_equals",...S(t),length:e})}function Jo(e,t){return new nv({check:"string_format",format:"regex",...S(t),pattern:e})}function Bo(e){return new ov({check:"string_format",format:"lowercase",...S(e)})}function Go(e){return new iv({check:"string_format",format:"uppercase",...S(e)})}function Ko(e,t){return new av({check:"string_format",format:"includes",...S(t),includes:e})}function Ho(e,t){return new sv({check:"string_format",format:"starts_with",...S(t),prefix:e})}function Wo(e,t){return new cv({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Md(e,t,r){return new uv({check:"property",property:e,schema:t,...S(r)})}function Xo(e,t){return new lv({check:"mime_type",mime:e,...S(t)})}function jt(e){return new dv({check:"overwrite",tx:e})}function Yo(e){return jt(t=>t.normalize(e))}function Qo(){return jt(e=>e.trim())}function ei(){return jt(e=>e.toLowerCase())}function ti(){return jt(e=>e.toUpperCase())}function Ya(){return jt(e=>cu(e))}function ky(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=c0(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_n(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(_n(o))}},e(r.value,r)));return t}function c0(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??Lo,c=e.Boolean??Co,u=e.String??jr,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 wn(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 wy=h(()=>{$a();qo();nd();N()});function Qa(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 es(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>
1492
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");let j=m.compile();return(P,z)=>j(p,P,z)},i,a=Er,s=!aa.jitless,u=s&&cu.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?Tv([],g,p,m,d,e):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});Ao=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=>$o(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=>gv(c,o,e,i)):gv(s,o,e,i)}});Ol=f("$ZodXor",(e,t)=>{Ao.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=>vv(c,o,e,i)):vv(s,o,e,i)}}),jl=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ao.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=fn(()=>{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(!Er(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)}}),Nl=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])=>yv(r,c,u)):yv(r,i,a)}});wa=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=>va(p,n,u))):va(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=>va(m,n,u))):va(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});Rl=f("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!cr(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"&&ma.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}}),Dl=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])=>{_v(l,d,r,a,o,e,n)})):_v(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=>$v(c,r))):$v(s,r)}return i.length?Promise.all(i).then(()=>r):r}});Zl=f("$ZodEnum",(e,t)=>{F.init(e,t);let r=_o(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>bo.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}}),Ul=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}}),Ml=f("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(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}});Sa=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(`^(${$o(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=>bv(i,r.value)):bv(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Ll=f("$ZodExactOptional",(e,t)=>{Sa.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)}),ql=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(`^(${$o(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)}),Fl=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=>xv(i,t)):xv(o,t)}});Vl=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))}),Jl=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=>kv(i,e)):kv(o,e)}});Bl=f("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr("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)}}),Gl=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)}}),Kl=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)}),Hl=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=>ya(a,t.in,n)):ya(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ya(i,t.out,n)):ya(o,t.out,n)}});Zo=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=>_a(a,t,n)):_a(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>_a(a,t,n)):_a(i,t,n)}}});Wl=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(wv):wv(o)}});Xl=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||lu.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)}),Yl=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?zo(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?zo(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 To(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await To(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 wa({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)),Ql=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))}),ed=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)}),td=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=>Sv(i,r,n,e));Sv(o,r,n,e)}})});var Ov=h(()=>{N()});var jv=h(()=>{N()});var Nv=h(()=>{N()});var Rv=h(()=>{N()});var Dv=h(()=>{N()});var Av=h(()=>{N()});var Zv=h(()=>{N()});var Cv=h(()=>{N()});function nd(){return{localeError:r0()}}var r0,od=h(()=>{N();r0=()=>{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 ${U(o.values[0])}`:`Invalid option: expected one of ${C(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":""}: ${C(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 Uv=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 Xv=h(()=>{N()});var Yv=h(()=>{N()});var id=h(()=>{N()});var Qv=h(()=>{id()});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 fy=h(()=>{N()});var hy=h(()=>{N()});var ad=h(()=>{N()});var gy=h(()=>{ad()});var vy=h(()=>{N()});var yy=h(()=>{N()});var _y=h(()=>{N()});var $y=h(()=>{N()});var by=h(()=>{N()});var xy=h(()=>{N()});var za=h(()=>{Ov();jv();Nv();Rv();Dv();Av();Zv();Cv();od();Uv();Mv();Lv();qv();Fv();Vv();Jv();Bv();Gv();Kv();Hv();Wv();Xv();Yv();Qv();id();ey();ty();ry();ny();oy();iy();ay();sy();cy();uy();ly();dy();py();my();fy();hy();gy();ad();vy();yy();_y();$y();by();xy()});function ud(){return new cd}var ky,cd,Ve,Co=h(()=>{cd=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)}};(ky=globalThis).__zod_globalRegistry??(ky.__zod_globalRegistry=ud());Ve=globalThis.__zod_globalRegistry});function ld(e,t){return new e({type:"string",...S(t)})}function Ia(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function Uo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function Mo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function Na(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Ra(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Da(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Aa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Za(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Ca(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Ua(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Ma(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function dd(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...S(t)})}function La(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function qa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Fa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Va(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function Ja(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function Ba(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function pd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function md(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function fd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function hd(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function gd(e,t){return new e({type:"number",checks:[],...S(t)})}function vd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function yd(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 $d(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...S(t)})}function bd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...S(t)})}function xd(e,t){return new e({type:"boolean",...S(t)})}function kd(e,t){return new e({type:"bigint",...S(t)})}function wd(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(t)})}function Sd(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(t)})}function zd(e,t){return new e({type:"symbol",...S(t)})}function Id(e,t){return new e({type:"undefined",...S(t)})}function Td(e,t){return new e({type:"null",...S(t)})}function Ed(e){return new e({type:"any"})}function Pd(e){return new e({type:"unknown"})}function Od(e,t){return new e({type:"never",...S(t)})}function jd(e,t){return new e({type:"void",...S(t)})}function Nd(e,t){return new e({type:"date",...S(t)})}function Rd(e,t){return new e({type:"nan",...S(t)})}function Jt(e,t){return new Vu({check:"less_than",...S(t),value:e,inclusive:!1})}function at(e,t){return new Vu({check:"less_than",...S(t),value:e,inclusive:!0})}function Bt(e,t){return new Ju({check:"greater_than",...S(t),value:e,inclusive:!1})}function Je(e,t){return new Ju({check:"greater_than",...S(t),value:e,inclusive:!0})}function Dd(e){return Bt(0,e)}function Ad(e){return Jt(0,e)}function Zd(e){return at(0,e)}function Cd(e){return Je(0,e)}function jr(e,t){return new Hg({check:"multiple_of",...S(t),value:e})}function Nr(e,t){return new Yg({check:"max_size",...S(t),maximum:e})}function Gt(e,t){return new Qg({check:"min_size",...S(t),minimum:e})}function vn(e,t){return new ev({check:"size_equals",...S(t),size:e})}function yn(e,t){return new tv({check:"max_length",...S(t),maximum:e})}function lr(e,t){return new rv({check:"min_length",...S(t),minimum:e})}function _n(e,t){return new nv({check:"length_equals",...S(t),length:e})}function Lo(e,t){return new ov({check:"string_format",format:"regex",...S(t),pattern:e})}function qo(e){return new iv({check:"string_format",format:"lowercase",...S(e)})}function Fo(e){return new av({check:"string_format",format:"uppercase",...S(e)})}function Vo(e,t){return new sv({check:"string_format",format:"includes",...S(t),includes:e})}function Jo(e,t){return new cv({check:"string_format",format:"starts_with",...S(t),prefix:e})}function Bo(e,t){return new uv({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Ud(e,t,r){return new lv({check:"property",property:e,schema:t,...S(r)})}function Go(e,t){return new dv({check:"mime_type",mime:e,...S(t)})}function jt(e){return new pv({check:"overwrite",tx:e})}function Ko(e){return jt(t=>t.normalize(e))}function Ho(){return jt(e=>e.trim())}function Wo(){return jt(e=>e.toLowerCase())}function Xo(){return jt(e=>e.toUpperCase())}function Ga(){return jt(e=>su(e))}function wy(e,t,r){return new e({type:"array",element:t,...S(r)})}function Md(e,t){return new e({type:"file",...S(t)})}function Ld(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function qd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function Fd(e){let t=a0(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(hn(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(hn(o))}},e(r.value,r)));return t}function a0(e,t){let r=new le({check:"custom",...S(t)});return r._zod.check=e,r}function Vd(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 Jd(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 Bd(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??Zo,c=e.Boolean??Do,u=e.String??Or,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 $n(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 Sy=h(()=>{ha();Co();rd();N()});function Ka(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 Ha(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>
1490
1493
 
1491
- 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 ts(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:ri(t,"input",e.processors),output:ri(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 Sy,ri,ni=h(()=>{qo();Sy=(e,t={})=>r=>{let n=Qa({...r,processors:t});return fe(e,n),es(n,e),ts(n,e)},ri=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Qa({...o??{},target:i,io:t,processors:r});return fe(e,a),es(a,e),ts(a,e)}});var u0,zy,Iy,Ty,Ey,Py,Oy,jy,Ny,Ry,Dy,Zy,Ay,Uy,Cy,My,Ly,qy,Fy,Vy,Jy,By,Gy,Ky,Hy,Wy,Kd,Xy,Yy,Qy,e_,t_,r_,n_,o_,i_,a_,s_,Hd,c_,Sn=h(()=>{ni();N();u0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zy=(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=u0[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}))])}},Iy=(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)},Ty=(e,t,r,n)=>{r.type="boolean"},Ey=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Py=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Oy=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ny=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Ry=(e,t,r,n)=>{r.not={}},Dy=(e,t,r,n)=>{},Zy=(e,t,r,n)=>{},Ay=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Uy=(e,t,r,n)=>{let o=e._zod.def,i=ko(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Cy=(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},My=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Ly=(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},qy=(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)},Fy=(e,t,r,n)=>{r.type="boolean"},Vy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},By=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Gy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Ky=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Hy=(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"]})},Wy=(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},Xy=(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},Yy=(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)},Qy=(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)}},e_=(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"}]},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_=(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))},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,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},o_=(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},i_=(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},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,r.readOnly=!0},s_=(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},c_=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o}});var u_=h(()=>{Sn();ni()});var l_=h(()=>{});var be=h(()=>{gn();gu();hu();nd();$a();Ku();N();_a();Oa();qo();Gu();wy();ni();Sn();u_();l_()});var Xd=h(()=>{be()});var rs=h(()=>{be();N();Xd()});var p_=h(()=>{be()});var Yd=h(()=>{be();rs()});var m_=h(()=>{be();rs()});var Qd=h(()=>{be();Xd();rs();p_();be();Sn();Oa();Yd();Yd();m_()});var ep=h(()=>{Qd();Qd()});function zn(e){return!!e._zod}function dr(e,t){return zn(e)?$n(e,t):e.safeParse(t)}function ns(e){if(!e)return;let t;if(zn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function g_(e){if(zn(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 os=h(()=>{bo();ep()});var is={};Et(is,{endsWith:()=>Wo,gt:()=>Bt,gte:()=>Je,includes:()=>Ko,length:()=>kn,lowercase:()=>Bo,lt:()=>Jt,lte:()=>at,maxLength:()=>xn,maxSize:()=>Rr,mime:()=>Xo,minLength:()=>lr,minSize:()=>Gt,multipleOf:()=>Nr,negative:()=>Ad,nonnegative:()=>Cd,nonpositive:()=>Ud,normalize:()=>Yo,overwrite:()=>jt,positive:()=>Zd,property:()=>Md,regex:()=>Jo,size:()=>bn,slugify:()=>Ya,startsWith:()=>Ho,toLowerCase:()=>ei,toUpperCase:()=>ti,trim:()=>Qo,uppercase:()=>Go});var as=h(()=>{be()});var Dr={};Et(Dr,{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,oi=h(()=>{be();ai();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 v_,UA,st,up=h(()=>{be();be();N();v_=(e,t)=>{fa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ga(e,r)},flatten:{value:r=>ha(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,vn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,vn,2)}},isEmpty:{get(){return e.issues.length===0}}})},UA=f("ZodError",v_),st=f("ZodError",v_,{Parent:Error})});var y_,__,$_,b_,x_,k_,w_,S_,z_,I_,T_,E_,lp=h(()=>{be();up();y_=Eo(st),__=Oo(st),$_=No(st),b_=Ro(st),x_=Dg(st),k_=Zg(st),w_=Ag(st),S_=Ug(st),z_=Cg(st),I_=Mg(st),T_=Lg(st),E_=qg(st)});var ii={};Et(ii,{ZodAny:()=>R_,ZodArray:()=>U_,ZodBase64:()=>Sp,ZodBase64URL:()=>zp,ZodBigInt:()=>fs,ZodBigIntFormat:()=>Ep,ZodBoolean:()=>ms,ZodCIDRv4:()=>kp,ZodCIDRv6:()=>wp,ZodCUID:()=>gp,ZodCUID2:()=>vp,ZodCatch:()=>o$,ZodCodec:()=>Zp,ZodCustom:()=>_s,ZodCustomStringFormat:()=>ci,ZodDate:()=>Op,ZodDefault:()=>Y_,ZodDiscriminatedUnion:()=>M_,ZodE164:()=>Ip,ZodEmail:()=>mp,ZodEmoji:()=>fp,ZodEnum:()=>si,ZodExactOptional:()=>H_,ZodFile:()=>G_,ZodFunction:()=>m$,ZodGUID:()=>ss,ZodIPv4:()=>bp,ZodIPv6:()=>xp,ZodIntersection:()=>L_,ZodJWT:()=>Tp,ZodKSUID:()=>$p,ZodLazy:()=>l$,ZodLiteral:()=>B_,ZodMAC:()=>P_,ZodMap:()=>V_,ZodNaN:()=>a$,ZodNanoID:()=>hp,ZodNever:()=>Z_,ZodNonOptional:()=>Rp,ZodNull:()=>N_,ZodNullable:()=>X_,ZodNumber:()=>ps,ZodNumberFormat:()=>In,ZodObject:()=>hs,ZodOptional:()=>Np,ZodPipe:()=>Dp,ZodPrefault:()=>e$,ZodPromise:()=>p$,ZodReadonly:()=>s$,ZodRecord:()=>ys,ZodSet:()=>J_,ZodString:()=>ls,ZodStringFormat:()=>de,ZodSuccess:()=>n$,ZodSymbol:()=>O_,ZodTemplateLiteral:()=>u$,ZodTransform:()=>K_,ZodTuple:()=>q_,ZodType:()=>B,ZodULID:()=>yp,ZodURL:()=>ds,ZodUUID:()=>Kt,ZodUndefined:()=>j_,ZodUnion:()=>gs,ZodUnknown:()=>D_,ZodVoid:()=>A_,ZodXID:()=>_p,ZodXor:()=>C_,_ZodString:()=>pp,_default:()=>Q_,_function:()=>Iz,any:()=>uz,array:()=>Y,base64:()=>B0,base64url:()=>G0,bigint:()=>oz,boolean:()=>ke,catch:()=>i$,check:()=>Tz,cidrv4:()=>V0,cidrv6:()=>J0,codec:()=>wz,cuid:()=>Z0,cuid2:()=>A0,custom:()=>Ap,date:()=>dz,describe:()=>Ez,discriminatedUnion:()=>vs,e164:()=>K0,email:()=>z0,emoji:()=>R0,enum:()=>Ze,exactOptional:()=>W_,file:()=>$z,float32:()=>ez,float64:()=>tz,function:()=>Iz,guid:()=>I0,hash:()=>Q0,hex:()=>Y0,hostname:()=>X0,httpUrl:()=>N0,instanceof:()=>Oz,int:()=>dp,int32:()=>rz,int64:()=>iz,intersection:()=>li,ipv4:()=>L0,ipv6:()=>F0,json:()=>Nz,jwt:()=>H0,keyof:()=>pz,ksuid:()=>M0,lazy:()=>d$,literal:()=>R,looseObject:()=>De,looseRecord:()=>gz,mac:()=>q0,map:()=>vz,meta:()=>Pz,nan:()=>kz,nanoid:()=>D0,nativeEnum:()=>_z,never:()=>Pp,nonoptional:()=>r$,null:()=>ui,nullable:()=>cs,nullish:()=>bz,number:()=>ae,object:()=>E,optional:()=>ge,partialRecord:()=>hz,pipe:()=>us,prefault:()=>t$,preprocess:()=>$s,promise:()=>zz,readonly:()=>c$,record:()=>he,refine:()=>f$,set:()=>yz,strictObject:()=>mz,string:()=>v,stringFormat:()=>W0,stringbool:()=>jz,success:()=>xz,superRefine:()=>h$,symbol:()=>sz,templateLiteral:()=>Sz,transform:()=>jp,tuple:()=>F_,uint32:()=>nz,uint64:()=>az,ulid:()=>U0,undefined:()=>cz,union:()=>ce,unknown:()=>pe,url:()=>j0,uuid:()=>T0,uuidv4:()=>E0,uuidv6:()=>P0,uuidv7:()=>O0,void:()=>lz,xid:()=>C0,xor:()=>fz});function v(e){return dd(ls,e)}function z0(e){return ja(mp,e)}function I0(e){return Fo(ss,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 Za(Kt,e)}function j0(e){return Vo(ds,e)}function N0(e){return Vo(ds,{protocol:/^https?$/,hostname:dt.domain,...b.normalizeParams(e)})}function R0(e){return Aa(fp,e)}function D0(e){return Ua(hp,e)}function Z0(e){return Ca(gp,e)}function A0(e){return Ma(vp,e)}function U0(e){return La(yp,e)}function C0(e){return qa(_p,e)}function M0(e){return Fa($p,e)}function L0(e){return Va(bp,e)}function q0(e){return pd(P_,e)}function F0(e){return Ja(xp,e)}function V0(e){return Ba(kp,e)}function J0(e){return Ga(wp,e)}function B0(e){return Ka(Sp,e)}function G0(e){return Ha(zp,e)}function K0(e){return Wa(Ip,e)}function H0(e){return Xa(Tp,e)}function W0(e,t,r={}){return wn(ci,e,t,r)}function X0(e){return wn(ci,"hostname",dt.hostname,e)}function Y0(e){return wn(ci,"hex",dt.hex,e)}function Q0(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=dt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return wn(ci,n,o,t)}function ae(e){return vd(ps,e)}function dp(e){return yd(In,e)}function ez(e){return _d(In,e)}function tz(e){return $d(In,e)}function rz(e){return bd(In,e)}function nz(e){return xd(In,e)}function ke(e){return kd(ms,e)}function oz(e){return wd(fs,e)}function iz(e){return Sd(Ep,e)}function az(e){return zd(Ep,e)}function sz(e){return Id(O_,e)}function cz(e){return Td(j_,e)}function ui(e){return Ed(N_,e)}function uz(){return Pd(R_)}function pe(){return Od(D_)}function Pp(e){return jd(Z_,e)}function lz(e){return Nd(A_,e)}function dz(e){return Rd(Op,e)}function Y(e,t){return ky(U_,e,t)}function pz(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 hs(r)}function mz(e,t){return new hs({type:"object",shape:e,catchall:Pp(),...b.normalizeParams(t)})}function De(e,t){return new hs({type:"object",shape:e,catchall:pe(),...b.normalizeParams(t)})}function ce(e,t){return new gs({type:"union",options:e,...b.normalizeParams(t)})}function fz(e,t){return new C_({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}function vs(e,t,r){return new M_({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}function li(e,t){return new L_({type:"intersection",left:e,right:t})}function F_(e,t,r){let n=t instanceof F,o=n?r:t,i=n?t:null;return new q_({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}function he(e,t,r){return new ys({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function hz(e,t,r){let n=Fe(e);return n._zod.values=void 0,new ys({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function gz(e,t,r){return new ys({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}function vz(e,t,r){return new V_({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}function yz(e,t){return new J_({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 si({type:"enum",entries:r,...b.normalizeParams(t)})}function _z(e,t){return new si({type:"enum",entries:e,...b.normalizeParams(t)})}function R(e,t){return new B_({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}function $z(e){return Ld(G_,e)}function jp(e){return new K_({type:"transform",transform:e})}function ge(e){return new Np({type:"optional",innerType:e})}function W_(e){return new H_({type:"optional",innerType:e})}function cs(e){return new X_({type:"nullable",innerType:e})}function bz(e){return ge(cs(e))}function Q_(e,t){return new Y_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function t$(e,t){return new e$({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function r$(e,t){return new Rp({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}function xz(e){return new n$({type:"success",innerType:e})}function i$(e,t){return new o$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function kz(e){return Dd(a$,e)}function us(e,t){return new Dp({type:"pipe",in:e,out:t})}function wz(e,t,r){return new Zp({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function c$(e){return new s$({type:"readonly",innerType:e})}function Sz(e,t){return new u$({type:"template_literal",parts:e,...b.normalizeParams(t)})}function d$(e){return new l$({type:"lazy",getter:e})}function zz(e){return new p$({type:"promise",innerType:e})}function Iz(e){return new m$({type:"function",input:Array.isArray(e?.input)?F_(e?.input):e?.input??Y(pe()),output:e?.output??pe()})}function Tz(e){let t=new le({check:"custom"});return t._zod.check=e,t}function Ap(e,t){return qd(_s,e??(()=>!0),t)}function f$(e,t={}){return Fd(_s,e,t)}function h$(e){return Vd(e)}function Oz(e,t={}){let r=new _s({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 Nz(e){let t=d$(()=>ce([v(e),ae(),ke(),ui(),Y(t),he(v(),t)]));return t}function $s(e,t){return us(jp(e),t)}var B,pp,ls,de,mp,ss,Kt,ds,fp,hp,gp,vp,yp,_p,$p,bp,P_,xp,kp,wp,Sp,zp,Ip,Tp,ci,ps,In,ms,fs,Ep,O_,j_,N_,R_,D_,Z_,A_,Op,U_,hs,gs,C_,M_,L_,q_,ys,V_,J_,si,B_,G_,K_,Np,H_,X_,Y_,e$,Rp,n$,o$,a$,Dp,Zp,s$,u$,l$,p$,m$,_s,Ez,Pz,jz,ai=h(()=>{be();be();Sn();ni();as();oi();lp();B=f("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ri(e,"input"),output:ri(e,"output")}}),e.toJSONSchema=Sy(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)=>y_(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>$_(e,r,n),e.parseAsync=async(r,n)=>__(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>b_(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>x_(e,r,n),e.decode=(r,n)=>k_(e,r,n),e.encodeAsync=async(r,n)=>w_(e,r,n),e.decodeAsync=async(r,n)=>S_(e,r,n),e.safeEncode=(r,n)=>z_(e,r,n),e.safeDecode=(r,n)=>I_(e,r,n),e.safeEncodeAsync=async(r,n)=>T_(e,r,n),e.safeDecodeAsync=async(r,n)=>E_(e,r,n),e.refine=(r,n)=>e.check(f$(r,n)),e.superRefine=r=>e.check(h$(r)),e.overwrite=r=>e.check(jt(r)),e.optional=()=>ge(e),e.exactOptional=()=>W_(e),e.nullable=()=>cs(e),e.nullish=()=>ge(cs(e)),e.nonoptional=r=>r$(e,r),e.array=()=>Y(e),e.or=r=>ce([e,r]),e.and=r=>li(e,r),e.transform=r=>us(e,jp(r)),e.default=r=>Q_(e,r),e.prefault=r=>t$(e,r),e.catch=r=>i$(e,r),e.pipe=r=>us(e,r),e.readonly=()=>c$(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)=>{jr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>zy(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(Jo(...n)),e.includes=(...n)=>e.check(Ko(...n)),e.startsWith=(...n)=>e.check(Ho(...n)),e.endsWith=(...n)=>e.check(Wo(...n)),e.min=(...n)=>e.check(lr(...n)),e.max=(...n)=>e.check(xn(...n)),e.length=(...n)=>e.check(kn(...n)),e.nonempty=(...n)=>e.check(lr(1,...n)),e.lowercase=n=>e.check(Bo(n)),e.uppercase=n=>e.check(Go(n)),e.trim=()=>e.check(Qo()),e.normalize=(...n)=>e.check(Yo(...n)),e.toLowerCase=()=>e.check(ei()),e.toUpperCase=()=>e.check(ti()),e.slugify=()=>e.check(Ya())}),ls=f("ZodString",(e,t)=>{jr.init(e,t),pp.init(e,t),e.email=r=>e.check(ja(mp,r)),e.url=r=>e.check(Vo(ds,r)),e.jwt=r=>e.check(Xa(Tp,r)),e.emoji=r=>e.check(Aa(fp,r)),e.guid=r=>e.check(Fo(ss,r)),e.uuid=r=>e.check(Na(Kt,r)),e.uuidv4=r=>e.check(Ra(Kt,r)),e.uuidv6=r=>e.check(Da(Kt,r)),e.uuidv7=r=>e.check(Za(Kt,r)),e.nanoid=r=>e.check(Ua(hp,r)),e.guid=r=>e.check(Fo(ss,r)),e.cuid=r=>e.check(Ca(gp,r)),e.cuid2=r=>e.check(Ma(vp,r)),e.ulid=r=>e.check(La(yp,r)),e.base64=r=>e.check(Ka(Sp,r)),e.base64url=r=>e.check(Ha(zp,r)),e.xid=r=>e.check(qa(_p,r)),e.ksuid=r=>e.check(Fa($p,r)),e.ipv4=r=>e.check(Va(bp,r)),e.ipv6=r=>e.check(Ja(xp,r)),e.cidrv4=r=>e.check(Ba(kp,r)),e.cidrv6=r=>e.check(Ga(wp,r)),e.e164=r=>e.check(Wa(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)});ss=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)});ds=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)});P_=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)});ci=f("ZodCustomStringFormat",(e,t)=>{$l.init(e,t),de.init(e,t)});ps=f("ZodNumber",(e,t)=>{Ia.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Iy(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(Nr(n,o)),e.step=(n,o)=>e.check(Nr(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});In=f("ZodNumberFormat",(e,t)=>{bl.init(e,t),ps.init(e,t)});ms=f("ZodBoolean",(e,t)=>{Co.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ty(e,r,n,o)});fs=f("ZodBigInt",(e,t)=>{Ta.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ey(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(Nr(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),fs.init(e,t)});O_=f("ZodSymbol",(e,t)=>{kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Py(e,r,n,o)});j_=f("ZodUndefined",(e,t)=>{wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jy(e,r,n,o)});N_=f("ZodNull",(e,t)=>{Sl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oy(e,r,n,o)});R_=f("ZodAny",(e,t)=>{zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dy(e,r,n,o)});D_=f("ZodUnknown",(e,t)=>{Il.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zy(e,r,n,o)});Z_=f("ZodNever",(e,t)=>{Tl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o)});A_=f("ZodVoid",(e,t)=>{El.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ny(e,r,n,o)});Op=f("ZodDate",(e,t)=>{Pl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ay(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});U_=f("ZodArray",(e,t)=>{Ol.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hy(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(lr(r,n)),e.nonempty=r=>e.check(lr(1,r)),e.max=(r,n)=>e.check(xn(r,n)),e.length=(r,n)=>e.check(kn(r,n)),e.unwrap=()=>e.element});hs=f("ZodObject",(e,t)=>{Ev.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wy(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])});gs=f("ZodUnion",(e,t)=>{Mo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.options=t.options});C_=f("ZodXor",(e,t)=>{gs.init(e,t),jl.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.options=t.options});M_=f("ZodDiscriminatedUnion",(e,t)=>{gs.init(e,t),Nl.init(e,t)});L_=f("ZodIntersection",(e,t)=>{Rl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xy(e,r,n,o)});q_=f("ZodTuple",(e,t)=>{Ea.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yy(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});ys=f("ZodRecord",(e,t)=>{Dl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qy(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});V_=f("ZodMap",(e,t)=>{Zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gy(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(Rr(...r)),e.size=(...r)=>e.check(bn(...r))});J_=f("ZodSet",(e,t)=>{Al.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ky(e,r,n,o),e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Rr(...r)),e.size=(...r)=>e.check(bn(...r))});si=f("ZodEnum",(e,t)=>{Ul.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Uy(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 si({...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 si({...t,checks:[],...b.normalizeParams(o),entries:i})}});B_=f("ZodLiteral",(e,t)=>{Cl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cy(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]}})});G_=f("ZodFile",(e,t)=>{Ml.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qy(e,r,n,o),e.min=(r,n)=>e.check(Gt(r,n)),e.max=(r,n)=>e.check(Rr(r,n)),e.mime=(r,n)=>e.check(Xo(Array.isArray(r)?r:[r],n))});K_=f("ZodTransform",(e,t)=>{Ll.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>By(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Er(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)=>{Pa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});H_=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});X_=f("ZodNullable",(e,t)=>{Fl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>e_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Y_=f("ZodDefault",(e,t)=>{Vl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>r_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});e$=f("ZodPrefault",(e,t)=>{Jl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>n_(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)=>t_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});n$=f("ZodSuccess",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});o$=f("ZodCatch",(e,t)=>{Kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>o_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});a$=f("ZodNaN",(e,t)=>{Hl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>My(e,r,n,o)});Dp=f("ZodPipe",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>i_(e,r,n,o),e.in=t.in,e.out=t.out});Zp=f("ZodCodec",(e,t)=>{Dp.init(e,t),Lo.init(e,t)});s$=f("ZodReadonly",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>a_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});u$=f("ZodTemplateLiteral",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ly(e,r,n,o)});l$=f("ZodLazy",(e,t)=>{td.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>c_(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});p$=f("ZodPromise",(e,t)=>{ed.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>s_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});m$=f("ZodFunction",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jy(e,r,n,o)});_s=f("ZodCustom",(e,t)=>{rd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vy(e,r,n,o)});Ez=Jd,Pz=Bd;jz=(...e)=>Gd({Codec:Zp,Boolean:ms,String:ls},...e)});var g$,v$=h(()=>{be();be();g$||(g$={})});var BA,y$=h(()=>{qo();as();oi();ai();BA={...ii,...is,iso:Dr}});var _$=h(()=>{be();ai()});var Up=h(()=>{be();ai();as();up();lp();v$();be();id();be();Sn();y$();Oa();oi();oi();_$();Se(od())});var Cp=h(()=>{Up();Up()});var $$=h(()=>{Cp();Cp()});var Lp,b$,pr,xs,Te,x$,k$,dU,Az,Uz,qp,ct,di,w$,Ee,pt,mt,Pe,ks,S$,Fp,z$,I$,Vp,pi,te,Jp,T$,E$,pU,ws,Cz,Ss,Mz,mi,Tn,P$,Lz,qz,Fz,Vz,Jz,Bz,Bp,Gz,Kz,Gp,zs,Hz,Wz,Is,Xz,fi,hi,Yz,gi,En,Qz,vi,Ts,Es,Ps,mU,Os,js,Ns,O$,j$,N$,Kp,R$,yi,Pn,D$,eI,tI,rI,nI,oI,Hp,iI,aI,sI,cI,uI,lI,dI,pI,mI,fI,hI,gI,vI,yI,_I,$I,Wp,Xp,Yp,bI,xI,kI,Qp,wI,SI,zI,II,TI,Z$,em,EI,Rs,fU,PI,_i,OI,hU,$i,jI,tm,NI,RI,DI,ZI,AI,UI,CI,bs,MI,LI,qI,bi,rm,FI,VI,JI,BI,GI,KI,HI,WI,XI,YI,QI,eT,tT,rT,nT,oT,iT,aT,On,sT,cT,uT,lT,dT,pT,mT,nm,fT,gU,vU,yU,_U,$U,bU,G,Mp,jn=h(()=>{$$();Lp="2025-11-25",b$=[Lp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pr="io.modelcontextprotocol/related-task",xs="2.0",Te=Ap(e=>e!==null&&(typeof e=="object"||typeof e=="function")),x$=ce([v(),ae().int()]),k$=v(),dU=De({ttl:ce([ae(),ui()]).optional(),pollInterval:ae().optional()}),Az=E({ttl:ae().optional()}),Uz=E({taskId:v()}),qp=De({progressToken:x$.optional(),[pr]:Uz.optional()}),ct=E({_meta:qp.optional()}),di=ct.extend({task:Az.optional()}),w$=e=>di.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()}),ks=ce([v(),ae().int()]),S$=E({jsonrpc:R(xs),id:ks,...Ee.shape}).strict(),Fp=e=>S$.safeParse(e).success,z$=E({jsonrpc:R(xs),...mt.shape}).strict(),I$=e=>z$.safeParse(e).success,Vp=E({jsonrpc:R(xs),id:ks,result:Pe}).strict(),pi=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(xs),id:ks.optional(),error:E({code:ae().int(),message:v(),data:pe().optional()})}).strict(),T$=e=>Jp.safeParse(e).success,E$=ce([S$,z$,Vp,Jp]),pU=ce([Vp,Jp]),ws=Pe.strict(),Cz=pt.extend({requestId:ks.optional(),reason:v().optional()}),Ss=mt.extend({method:R("notifications/cancelled"),params:Cz}),Mz=E({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Ze(["light","dark"]).optional()}),mi=E({icons:Y(Mz).optional()}),Tn=E({name:v(),title:v().optional()}),P$=Tn.extend({...Tn.shape,...mi.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Lz=li(E({applyDefaults:ke().optional()}),he(v(),pe())),qz=$s(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,li(E({form:Lz.optional(),url:Te.optional()}),he(v(),pe()).optional())),Fz=De({list:Te.optional(),cancel:Te.optional(),requests:De({sampling:De({createMessage:Te.optional()}).optional(),elicitation:De({create:Te.optional()}).optional()}).optional()}),Vz=De({list:Te.optional(),cancel:Te.optional(),requests:De({tools:De({call:Te.optional()}).optional()}).optional()}),Jz=E({experimental:he(v(),Te).optional(),sampling:E({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:qz.optional(),roots:E({listChanged:ke().optional()}).optional(),tasks:Fz.optional()}),Bz=ct.extend({protocolVersion:v(),capabilities:Jz,clientInfo:P$}),Bp=Ee.extend({method:R("initialize"),params:Bz}),Gz=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:Vz.optional()}),Kz=Pe.extend({protocolVersion:v(),capabilities:Gz,serverInfo:P$,instructions:v().optional()}),Gp=mt.extend({method:R("notifications/initialized"),params:pt.optional()}),zs=Ee.extend({method:R("ping"),params:ct.optional()}),Hz=E({progress:ae(),total:ge(ae()),message:ge(v())}),Wz=E({...pt.shape,...Hz.shape,progressToken:x$}),Is=mt.extend({method:R("notifications/progress"),params:Wz}),Xz=ct.extend({cursor:k$.optional()}),fi=Ee.extend({params:Xz.optional()}),hi=Pe.extend({nextCursor:k$.optional()}),Yz=Ze(["working","input_required","completed","failed","cancelled"]),gi=E({taskId:v(),status:Yz,ttl:ce([ae(),ui()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:ge(ae()),statusMessage:ge(v())}),En=Pe.extend({task:gi}),Qz=pt.merge(gi),vi=mt.extend({method:R("notifications/tasks/status"),params:Qz}),Ts=Ee.extend({method:R("tasks/get"),params:ct.extend({taskId:v()})}),Es=Pe.merge(gi),Ps=Ee.extend({method:R("tasks/result"),params:ct.extend({taskId:v()})}),mU=Pe.loose(),Os=fi.extend({method:R("tasks/list")}),js=hi.extend({tasks:Y(gi)}),Ns=Ee.extend({method:R("tasks/cancel"),params:ct.extend({taskId:v()})}),O$=Pe.merge(gi),j$=E({uri:v(),mimeType:ge(v()),_meta:he(v(),pe()).optional()}),N$=j$.extend({text:v()}),Kp=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),R$=j$.extend({blob:Kp}),yi=Ze(["user","assistant"]),Pn=E({audience:Y(yi).optional(),priority:ae().min(0).max(1).optional(),lastModified:Dr.datetime({offset:!0}).optional()}),D$=E({...Tn.shape,...mi.shape,uri:v(),description:ge(v()),mimeType:ge(v()),annotations:Pn.optional(),_meta:ge(De({}))}),eI=E({...Tn.shape,...mi.shape,uriTemplate:v(),description:ge(v()),mimeType:ge(v()),annotations:Pn.optional(),_meta:ge(De({}))}),tI=fi.extend({method:R("resources/list")}),rI=hi.extend({resources:Y(D$)}),nI=fi.extend({method:R("resources/templates/list")}),oI=hi.extend({resourceTemplates:Y(eI)}),Hp=ct.extend({uri:v()}),iI=Hp,aI=Ee.extend({method:R("resources/read"),params:iI}),sI=Pe.extend({contents:Y(ce([N$,R$]))}),cI=mt.extend({method:R("notifications/resources/list_changed"),params:pt.optional()}),uI=Hp,lI=Ee.extend({method:R("resources/subscribe"),params:uI}),dI=Hp,pI=Ee.extend({method:R("resources/unsubscribe"),params:dI}),mI=pt.extend({uri:v()}),fI=mt.extend({method:R("notifications/resources/updated"),params:mI}),hI=E({name:v(),description:ge(v()),required:ge(ke())}),gI=E({...Tn.shape,...mi.shape,description:ge(v()),arguments:ge(Y(hI)),_meta:ge(De({}))}),vI=fi.extend({method:R("prompts/list")}),yI=hi.extend({prompts:Y(gI)}),_I=ct.extend({name:v(),arguments:he(v(),v()).optional()}),$I=Ee.extend({method:R("prompts/get"),params:_I}),Wp=E({type:R("text"),text:v(),annotations:Pn.optional(),_meta:he(v(),pe()).optional()}),Xp=E({type:R("image"),data:Kp,mimeType:v(),annotations:Pn.optional(),_meta:he(v(),pe()).optional()}),Yp=E({type:R("audio"),data:Kp,mimeType:v(),annotations:Pn.optional(),_meta:he(v(),pe()).optional()}),bI=E({type:R("tool_use"),name:v(),id:v(),input:he(v(),pe()),_meta:he(v(),pe()).optional()}),xI=E({type:R("resource"),resource:ce([N$,R$]),annotations:Pn.optional(),_meta:he(v(),pe()).optional()}),kI=D$.extend({type:R("resource_link")}),Qp=ce([Wp,Xp,Yp,kI,xI]),wI=E({role:yi,content:Qp}),SI=Pe.extend({description:v().optional(),messages:Y(wI)}),zI=mt.extend({method:R("notifications/prompts/list_changed"),params:pt.optional()}),II=E({title:v().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),TI=E({taskSupport:Ze(["required","optional","forbidden"]).optional()}),Z$=E({...Tn.shape,...mi.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:II.optional(),execution:TI.optional(),_meta:he(v(),pe()).optional()}),em=fi.extend({method:R("tools/list")}),EI=hi.extend({tools:Y(Z$)}),Rs=Pe.extend({content:Y(Qp).default([]),structuredContent:he(v(),pe()).optional(),isError:ke().optional()}),fU=Rs.or(Pe.extend({toolResult:pe()})),PI=di.extend({name:v(),arguments:he(v(),pe()).optional()}),_i=Ee.extend({method:R("tools/call"),params:PI}),OI=mt.extend({method:R("notifications/tools/list_changed"),params:pt.optional()}),hU=E({autoRefresh:ke().default(!0),debounceMs:ae().int().nonnegative().default(300)}),$i=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),jI=ct.extend({level:$i}),tm=Ee.extend({method:R("logging/setLevel"),params:jI}),NI=pt.extend({level:$i,logger:v().optional(),data:pe()}),RI=mt.extend({method:R("notifications/message"),params:NI}),DI=E({name:v().optional()}),ZI=E({hints:Y(DI).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),AI=E({mode:Ze(["auto","required","none"]).optional()}),UI=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()}),CI=vs("type",[Wp,Xp,Yp]),bs=vs("type",[Wp,Xp,Yp,bI,UI]),MI=E({role:yi,content:ce([bs,Y(bs)]),_meta:he(v(),pe()).optional()}),LI=di.extend({messages:Y(MI),modelPreferences:ZI.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(Z$).optional(),toolChoice:AI.optional()}),qI=Ee.extend({method:R("sampling/createMessage"),params:LI}),bi=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens"]).or(v())),role:yi,content:CI}),rm=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:yi,content:ce([bs,Y(bs)])}),FI=E({type:R("boolean"),title:v().optional(),description:v().optional(),default:ke().optional()}),VI=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()}),JI=E({type:Ze(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),BI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),GI=E({type:R("string"),title:v().optional(),description:v().optional(),oneOf:Y(E({const:v(),title:v()})),default:v().optional()}),KI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),HI=ce([BI,GI]),WI=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()}),XI=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()}),YI=ce([WI,XI]),QI=ce([KI,HI,YI]),eT=ce([QI,FI,VI,JI]),tT=di.extend({mode:R("form").optional(),message:v(),requestedSchema:E({type:R("object"),properties:he(v(),eT),required:Y(v()).optional()})}),rT=di.extend({mode:R("url"),message:v(),elicitationId:v(),url:v().url()}),nT=ce([tT,rT]),oT=Ee.extend({method:R("elicitation/create"),params:nT}),iT=pt.extend({elicitationId:v()}),aT=mt.extend({method:R("notifications/elicitation/complete"),params:iT}),On=Pe.extend({action:Ze(["accept","decline","cancel"]),content:$s(e=>e===null?void 0:e,he(v(),ce([v(),ae(),ke(),Y(v())])).optional())}),sT=E({type:R("ref/resource"),uri:v()}),cT=E({type:R("ref/prompt"),name:v()}),uT=ct.extend({ref:ce([cT,sT]),argument:E({name:v(),value:v()}),context:E({arguments:he(v(),v()).optional()}).optional()}),lT=Ee.extend({method:R("completion/complete"),params:uT}),dT=Pe.extend({completion:De({values:Y(v()).max(100),total:ge(ae().int()),hasMore:ge(ke())})}),pT=E({uri:v().startsWith("file://"),name:v().optional(),_meta:he(v(),pe()).optional()}),mT=Ee.extend({method:R("roots/list"),params:ct.optional()}),nm=Pe.extend({roots:Y(pT)}),fT=mt.extend({method:R("notifications/roots/list_changed"),params:pt.optional()}),gU=ce([zs,Bp,lT,tm,$I,vI,tI,nI,aI,lI,pI,_i,em,Ts,Ps,Os,Ns]),vU=ce([Ss,Is,Gp,fT,vi]),yU=ce([ws,bi,rm,On,nm,Es,js,En]),_U=ce([zs,qI,oT,mT,Ts,Ps,Os,Ns]),$U=ce([Ss,Is,RI,fI,cI,OI,zI,vi,aT]),bU=ce([ws,Kz,dT,SI,yI,rI,oI,sI,Rs,EI,Es,js,En]),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 mr(e){return e==="completed"||e==="failed"||e==="cancelled"}var A$=h(()=>{});var Ds=h(()=>{});var om=h(()=>{Ds()});var fr=h(()=>{});var Zs=h(()=>{});var ft=h(()=>{Zs()});var im=h(()=>{bo();fr();we()});var am=h(()=>{fr()});var sm=h(()=>{});var As=h(()=>{we()});var cm=h(()=>{we()});var um=h(()=>{fr()});var lm=h(()=>{we()});var dm=h(()=>{we();ft()});var pm=h(()=>{});var mm=h(()=>{we()});var fm=h(()=>{});var tC,Us=h(()=>{fr();tC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});var Cs=h(()=>{bo();we();Us();As();ft()});var hm=h(()=>{we();Cs();ft()});var gm=h(()=>{});var vm=h(()=>{ft()});var ym=h(()=>{});var Ms=h(()=>{we()});var _m=h(()=>{we();Ms()});var $m=h(()=>{fr()});var bm=h(()=>{we()});var xm=h(()=>{we();ft()});var km=h(()=>{we()});var wm=h(()=>{we()});var Sm=h(()=>{fr();we()});var zm=h(()=>{we()});var Im=h(()=>{ft()});var Tm=h(()=>{ft()});var Em=h(()=>{we()});var Pm=h(()=>{bo();ft();im();am();sm();As();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();wm();Cs();Sm();Us();zm();Im();Ms();Tm();Em()});var we=h(()=>{Ds();Pm();Zs();ft()});var U$=h(()=>{});var Om=h(()=>{we();om();ft()});var C$=h(()=>{Ds();om();fr();Zs();we();U$();ft();im();am();sm();As();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();wm();Em();Cs();Sm();Us();zm();Im();Ms();Tm();Pm();Om();Om()});function jm(e){let r=ns(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=g_(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Nm(e,t){let r=dr(e,t);if(!r.success)throw r.error;return r.data}var M$=h(()=>{ep();os();C$()});function L$(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function q$(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];L$(a)&&L$(i)?r[o]={...a,...i}:r[o]=i}return r}var $T,Ls,F$=h(()=>{os();jn();A$();M$();$T=6e4,Ls=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(Ss,r=>{this._oncancel(r)}),this.setNotificationHandler(Is,r=>{this._onprogress(r)}),this.setRequestHandler(zs,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ts,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(Ps,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(!mr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(mr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[pr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Os,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(Ns,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(mr(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),pi(i)||T$(i)?this._onresponse(i):Fp(i)?this._onrequest(i,a):I$(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?.[pr]?.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=w$(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),pi(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(pi(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),pi(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,En,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},mr(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||{},[pr]: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=dr(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},Es,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},js,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},O$,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||{},[pr]: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||{},[pr]: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||{},[pr]: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=vi.parse({method:"notifications/tasks/status",params:s});await this.notification(c),mr(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(mr(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=vi.parse({method:"notifications/tasks/status",params:c});await this.notification(u),mr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}}});var Si=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 ki=class{};ie._CodeOrName=ki;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Zr=class extends ki{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=Zr;var ht=class extends ki{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 Zr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=ht;ie.nil=new ht("");function V$(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._=V$;var Rm=new ht("+");function J$(e,...t){let r=[wi(e[0])],n=0;for(;n<t.length;)r.push(Rm),Dm(r,t[n]),r.push(Rm,wi(e[++n]));return bT(r),new ht(r)}ie.str=J$;function Dm(e,t){t instanceof ht?e.push(...t._items):t instanceof Zr?e.push(t):e.push(wT(t))}ie.addCodeArg=Dm;function bT(e){let t=1;for(;t<e.length-1;){if(e[t]===Rm){let r=xT(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function xT(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Zr||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 Zr))return`"${e}${t.slice(1)}`}function kT(e,t){return t.emptyStr()?e:e.emptyStr()?t:J$`${e}${t}`}ie.strConcat=kT;function wT(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wi(Array.isArray(e)?e.join(","):e)}function ST(e){return new ht(wi(e))}ie.stringify=ST;function wi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=wi;function zT(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new ht(`.${e}`):V$`[${e}]`}ie.getProperty=zT;function IT(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=IT;function TT(e){return new ht(e.toString())}ie.regexpCode=TT});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=Si(),Zm=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},qs;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(qs||(Ye.UsedValueState=qs={}));Ye.varKinds={const:new Xe.Name("const"),let:new Xe.Name("let"),var:new Xe.Name("var")};var Fs=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=Fs;var Vs=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=Vs;var ET=(0,Xe._)`\n`,Am=class extends Fs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ET:Xe.nil}}get(){return this._scope}name(t){return new Vs(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,qs.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,qs.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=Si(),wt=Um(),hr=Si();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return hr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return hr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return hr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return hr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return hr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return hr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return hr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return hr.Name}});var Ks=Um();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Ks.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Ks.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Ks.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Ks.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=Rn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},Js=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=Rn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return Gs(t,this.rhs)}},Mm=class extends Js{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=Rn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},zi=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)||(PT(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Cr(t,r.names),{})}},Xt=class extends zi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Jm=class extends zi{},Nn=class extends Xt{};Nn.kind="else";var Ar=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 Nn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(B$(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=Rn(this.condition,t,r),this}get names(){let t=super.names;return Gs(t,this.condition),this.else&&Cr(t,this.else.names),t}};Ar.kind="if";var Ur=class extends Xt{};Ur.kind="for";var Bm=class extends Ur{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=Rn(this.iteration,t,r),this}get names(){return Cr(super.names,this.iteration.names)}},Gm=class extends Ur{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=Gs(super.names,this.from);return Gs(t,this.to)}},Bs=class extends Ur{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=Rn(this.iterable,t,r),this}get names(){return Cr(super.names,this.iterable.names)}},Ii=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)}};Ii.kind="func";var Ti=class extends zi{render(t){return"return "+super.render(t)}};Ti.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&&Cr(t,this.catch.names),this.finally&&Cr(t,this.finally.names),t}},Ei=class extends Xt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ei.kind="catch";var Pi=class extends Xt{render(t){return"finally"+super.render(t)}};Pi.kind="finally";var Hm=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
1492
- `:""},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 Js(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 Ar(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 Ar(t))}else(){return this._elseNode(new Nn)}endIf(){return this._endBlockNode(Ar,Nn)}_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 Bs("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 Bs("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Ur)}label(t){return this._leafNode(new Lm(t))}break(t){return this._leafNode(new qm(t))}return(t){let r=new Ti;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ti)}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 Ei(i),r(i)}return n&&(this._currNode=o.finally=new Pi,this.code(n)),this._endBlockNode(Ei,Pi)}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 Ii(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Ii)}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 Ar))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 Cr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Gs(e,t){return t instanceof re._CodeOrName?Cr(e,t.names):e}function Rn(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 PT(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function B$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Wm(e)}`}X.not=B$;var OT=G$(X.operators.AND);function jT(...e){return e.reduce(OT)}X.and=jT;var NT=G$(X.operators.OR);function RT(...e){return e.reduce(NT)}X.or=RT;function G$(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(),DT=Si();function ZT(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=ZT;function AT(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(W$(e,t),!X$(t,e.self.RULES.all))}Q.alwaysValidSchema=AT;function W$(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]||eb(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=W$;function X$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=X$;function UT(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=UT;function CT({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=CT;function MT(e){return Y$(decodeURIComponent(e))}Q.unescapeFragment=MT;function LT(e){return encodeURIComponent(Ym(e))}Q.escapeFragment=LT;function Ym(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Ym;function Y$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=Y$;function qT(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=qT;function K$({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:K$({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:Q$}),items:K$({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 Q$(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=Q$;function Qm(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=Qm;var H$={};function FT(e,t){return e.scopeValue("func",{ref:t,code:H$[t.code]||(H$[t.code]=new DT._Code(t.code))})}Q.useFunc=FT;var Xm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Xm||(Q.Type=Xm={}));function VT(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=VT;function eb(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=eb});var Yt=I(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var Ae=H(),JT={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=JT});var Oi=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(),Hs=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 BT(e,t=Ue.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=nb(e,t,r);n??(a||s)?tb(i,c):rb(o,(0,oe._)`[${c}]`)}Ue.reportError=BT;function GT(e,t=Ue.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=nb(e,t,r);tb(o,s),i||a||rb(n,Ge.default.vErrors)}Ue.reportExtraError=GT;function KT(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=KT;function HT({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=HT;function tb(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 rb(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 Mr={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 nb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:WT(e,t,r)}function WT(e,t,r={}){let{gen:n,it:o}=e,i=[XT(o,r),YT(e,r)];return QT(e,t,i),n.object(...i)}function XT({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Hs.getErrorPath)(t,Hs.Type.Str)}`:e;return[Ge.default.instancePath,(0,oe.strConcat)(Ge.default.instancePath,r)]}function YT({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,Hs.getErrorPath)(r,Hs.Type.Str)}`),[Mr.schemaPath,o]}function QT(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([Mr.keyword,o],[Mr.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Mr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Mr.schema,a],[Mr.parentSchema,(0,oe._)`${l}${d}`],[Ge.default.data,i]),u&&n.push([Mr.propertyName,u])}});var ib=I(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.boolOrEmptySchema=Dn.topBoolOrEmptySchema=void 0;var eE=Oi(),tE=H(),rE=Yt(),nE={message:"boolean schema is false"};function oE(e){let{gen:t,schema:r,validateName:n}=e;r===!1?ob(e,!1):typeof r=="object"&&r.$async===!0?t.return(rE.default.data):(t.assign((0,tE._)`${n}.errors`,null),t.return(!0))}Dn.topBoolOrEmptySchema=oE;function iE(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),ob(e)):r.var(t,!0)}Dn.boolOrEmptySchema=iE;function ob(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,eE.reportError)(o,nE,void 0,t)}});var tf=I(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.getRules=Zn.isJSONType=void 0;var aE=["string","number","integer","boolean","null","object","array"],sE=new Set(aE);function cE(e){return typeof e=="string"&&sE.has(e)}Zn.isJSONType=cE;function uE(){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:{}}}Zn.getRules=uE});var rf=I(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.shouldUseRule=gr.shouldUseGroup=gr.schemaHasRulesForType=void 0;function lE({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&ab(e,n)}gr.schemaHasRulesForType=lE;function ab(e,t){return t.rules.some(r=>sb(e,r))}gr.shouldUseGroup=ab;function sb(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))}gr.shouldUseRule=sb});var ji=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 dE=tf(),pE=rf(),mE=Oi(),K=H(),cb=ne(),An;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(An||(Ce.DataType=An={}));function fE(e){let t=ub(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=fE;function ub(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(dE.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ce.getJSONTypes=ub;function hE(e,t){let{gen:r,data:n,opts:o}=e,i=gE(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,pE.schemaHasRulesForType)(e,t[0]));if(a){let s=of(t,n,o.strictNumbers,An.Wrong);r.if(s,()=>{i.length?vE(e,t,i):af(e)})}return a}Ce.coerceAndCheckDataType=hE;var lb=new Set(["string","number","integer","boolean","null"]);function gE(e,t){return t?e.filter(r=>lb.has(r)||t==="array"&&r==="array"):[]}function vE(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)(lb.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),yE(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
1494
+ 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 Wa(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:Yo(t,"input",e.processors),output:Yo(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 zy,Yo,Qo=h(()=>{Co();zy=(e,t={})=>r=>{let n=Ka({...r,processors:t});return fe(e,n),Ha(n,e),Wa(n,e)},Yo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Ka({...o??{},target:i,io:t,processors:r});return fe(e,a),Ha(a,e),Wa(a,e)}});var s0,Iy,Ty,Ey,Py,Oy,jy,Ny,Ry,Dy,Ay,Zy,Cy,Uy,My,Ly,qy,Fy,Vy,Jy,By,Gy,Ky,Hy,Wy,Xy,Gd,Yy,Qy,e_,t_,r_,n_,o_,i_,a_,s_,c_,Kd,u_,bn=h(()=>{Qo();N();s0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Iy=(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=s0[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}))])}},Ty=(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)},Ey=(e,t,r,n)=>{r.type="boolean"},Py=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Oy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},jy=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ny=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ry=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Dy=(e,t,r,n)=>{r.not={}},Ay=(e,t,r,n)=>{},Zy=(e,t,r,n)=>{},Cy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Uy=(e,t,r,n)=>{let o=e._zod.def,i=_o(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},My=(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},Ly=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},qy=(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},Fy=(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)},Vy=(e,t,r,n)=>{r.type="boolean"},Jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},By=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Gy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ky=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Hy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Wy=(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"]})},Xy=(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)},Gd=(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},Yy=(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},Qy=(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)},e_=(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)}},t_=(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"}]},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},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,r.default=JSON.parse(JSON.stringify(o.defaultValue))},o_=(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)))},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;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},a_=(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},s_=(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},c_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Kd=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},u_=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o}});var l_=h(()=>{bn();Qo()});var d_=h(()=>{});var be=h(()=>{pn();hu();fu();rd();ha();Gu();N();fa();za();Co();Bu();Sy();Qo();bn();l_();d_()});var Wd=h(()=>{be()});var Xa=h(()=>{be();N();Wd()});var m_=h(()=>{be()});var Xd=h(()=>{be();Xa()});var f_=h(()=>{be();Xa()});var Yd=h(()=>{be();Wd();Xa();m_();be();bn();za();Xd();Xd();f_()});var Qd=h(()=>{Yd();Yd()});function xn(e){return!!e._zod}function dr(e,t){return xn(e)?gn(e,t):e.safeParse(t)}function Ya(e){if(!e)return;let t;if(xn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function v_(e){if(xn(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 Qa=h(()=>{vo();Qd()});var es={};Et(es,{endsWith:()=>Bo,gt:()=>Bt,gte:()=>Je,includes:()=>Vo,length:()=>_n,lowercase:()=>qo,lt:()=>Jt,lte:()=>at,maxLength:()=>yn,maxSize:()=>Nr,mime:()=>Go,minLength:()=>lr,minSize:()=>Gt,multipleOf:()=>jr,negative:()=>Ad,nonnegative:()=>Cd,nonpositive:()=>Zd,normalize:()=>Ko,overwrite:()=>jt,positive:()=>Dd,property:()=>Ud,regex:()=>Lo,size:()=>vn,slugify:()=>Ga,startsWith:()=>Jo,toLowerCase:()=>Wo,toUpperCase:()=>Xo,trim:()=>Ho,uppercase:()=>Fo});var ts=h(()=>{be()});var Rr={};Et(Rr,{ZodISODate:()=>rp,ZodISODateTime:()=>ep,ZodISODuration:()=>ap,ZodISOTime:()=>op,date:()=>np,datetime:()=>tp,duration:()=>sp,time:()=>ip});function tp(e){return pd(ep,e)}function np(e){return md(rp,e)}function ip(e){return fd(op,e)}function sp(e){return hd(ap,e)}var ep,rp,op,ap,ei=h(()=>{be();ri();ep=f("ZodISODateTime",(e,t)=>{al.init(e,t),de.init(e,t)});rp=f("ZodISODate",(e,t)=>{sl.init(e,t),de.init(e,t)});op=f("ZodISOTime",(e,t)=>{cl.init(e,t),de.init(e,t)});ap=f("ZodISODuration",(e,t)=>{ul.init(e,t),de.init(e,t)})});var y_,LZ,st,cp=h(()=>{be();be();N();y_=(e,t)=>{ua.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>da(e,r)},flatten:{value:r=>la(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,mn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,mn,2)}},isEmpty:{get(){return e.issues.length===0}}})},LZ=f("ZodError",y_),st=f("ZodError",y_,{Parent:Error})});var __,$_,b_,x_,k_,w_,S_,z_,I_,T_,E_,P_,up=h(()=>{be();cp();__=So(st),$_=Io(st),b_=Eo(st),x_=Po(st),k_=Ag(st),w_=Zg(st),S_=Cg(st),z_=Ug(st),I_=Mg(st),T_=Lg(st),E_=qg(st),P_=Fg(st)});var ti={};Et(ti,{ZodAny:()=>D_,ZodArray:()=>U_,ZodBase64:()=>wp,ZodBase64URL:()=>Sp,ZodBigInt:()=>us,ZodBigIntFormat:()=>Tp,ZodBoolean:()=>cs,ZodCIDRv4:()=>xp,ZodCIDRv6:()=>kp,ZodCUID:()=>hp,ZodCUID2:()=>gp,ZodCatch:()=>i$,ZodCodec:()=>Dp,ZodCustom:()=>fs,ZodCustomStringFormat:()=>oi,ZodDate:()=>Pp,ZodDefault:()=>Q_,ZodDiscriminatedUnion:()=>L_,ZodE164:()=>zp,ZodEmail:()=>pp,ZodEmoji:()=>mp,ZodEnum:()=>ni,ZodExactOptional:()=>W_,ZodFile:()=>K_,ZodFunction:()=>f$,ZodGUID:()=>rs,ZodIPv4:()=>$p,ZodIPv6:()=>bp,ZodIntersection:()=>q_,ZodJWT:()=>Ip,ZodKSUID:()=>_p,ZodLazy:()=>d$,ZodLiteral:()=>G_,ZodMAC:()=>O_,ZodMap:()=>J_,ZodNaN:()=>s$,ZodNanoID:()=>fp,ZodNever:()=>Z_,ZodNonOptional:()=>Np,ZodNull:()=>R_,ZodNullable:()=>Y_,ZodNumber:()=>ss,ZodNumberFormat:()=>kn,ZodObject:()=>ls,ZodOptional:()=>jp,ZodPipe:()=>Rp,ZodPrefault:()=>t$,ZodPromise:()=>m$,ZodReadonly:()=>c$,ZodRecord:()=>ms,ZodSet:()=>B_,ZodString:()=>is,ZodStringFormat:()=>de,ZodSuccess:()=>o$,ZodSymbol:()=>j_,ZodTemplateLiteral:()=>l$,ZodTransform:()=>H_,ZodTuple:()=>F_,ZodType:()=>B,ZodULID:()=>vp,ZodURL:()=>as,ZodUUID:()=>Kt,ZodUndefined:()=>N_,ZodUnion:()=>ds,ZodUnknown:()=>A_,ZodVoid:()=>C_,ZodXID:()=>yp,ZodXor:()=>M_,_ZodString:()=>dp,_default:()=>e$,_function:()=>Sz,any:()=>sz,array:()=>Y,base64:()=>V0,base64url:()=>J0,bigint:()=>rz,boolean:()=>ke,catch:()=>a$,check:()=>zz,cidrv4:()=>q0,cidrv6:()=>F0,codec:()=>xz,cuid:()=>R0,cuid2:()=>D0,custom:()=>Ap,date:()=>uz,describe:()=>Iz,discriminatedUnion:()=>ps,e164:()=>B0,email:()=>w0,emoji:()=>j0,enum:()=>Ae,exactOptional:()=>X_,file:()=>yz,float32:()=>Y0,float64:()=>Q0,function:()=>Sz,guid:()=>S0,hash:()=>X0,hex:()=>W0,hostname:()=>H0,httpUrl:()=>O0,instanceof:()=>Ez,int:()=>lp,int32:()=>ez,int64:()=>nz,intersection:()=>ai,ipv4:()=>U0,ipv6:()=>L0,json:()=>Oz,jwt:()=>G0,keyof:()=>lz,ksuid:()=>C0,lazy:()=>p$,literal:()=>R,looseObject:()=>De,looseRecord:()=>fz,mac:()=>M0,map:()=>hz,meta:()=>Tz,nan:()=>bz,nanoid:()=>N0,nativeEnum:()=>vz,never:()=>Ep,nonoptional:()=>n$,null:()=>ii,nullable:()=>ns,nullish:()=>_z,number:()=>ae,object:()=>E,optional:()=>ge,partialRecord:()=>mz,pipe:()=>os,prefault:()=>r$,preprocess:()=>hs,promise:()=>wz,readonly:()=>u$,record:()=>he,refine:()=>h$,set:()=>gz,strictObject:()=>dz,string:()=>v,stringFormat:()=>K0,stringbool:()=>Pz,success:()=>$z,superRefine:()=>g$,symbol:()=>iz,templateLiteral:()=>kz,transform:()=>Op,tuple:()=>V_,uint32:()=>tz,uint64:()=>oz,ulid:()=>A0,undefined:()=>az,union:()=>ce,unknown:()=>pe,url:()=>P0,uuid:()=>z0,uuidv4:()=>I0,uuidv6:()=>T0,uuidv7:()=>E0,void:()=>cz,xid:()=>Z0,xor:()=>pz});function v(e){return ld(is,e)}function w0(e){return Ia(pp,e)}function S0(e){return Uo(rs,e)}function z0(e){return Ta(Kt,e)}function I0(e){return Ea(Kt,e)}function T0(e){return Pa(Kt,e)}function E0(e){return Oa(Kt,e)}function P0(e){return Mo(as,e)}function O0(e){return Mo(as,{protocol:/^https?$/,hostname:dt.domain,...b.normalizeParams(e)})}function j0(e){return ja(mp,e)}function N0(e){return Na(fp,e)}function R0(e){return Ra(hp,e)}function D0(e){return Da(gp,e)}function A0(e){return Aa(vp,e)}function Z0(e){return Za(yp,e)}function C0(e){return Ca(_p,e)}function U0(e){return Ua($p,e)}function M0(e){return dd(O_,e)}function L0(e){return Ma(bp,e)}function q0(e){return La(xp,e)}function F0(e){return qa(kp,e)}function V0(e){return Fa(wp,e)}function J0(e){return Va(Sp,e)}function B0(e){return Ja(zp,e)}function G0(e){return Ba(Ip,e)}function K0(e,t,r={}){return $n(oi,e,t,r)}function H0(e){return $n(oi,"hostname",dt.hostname,e)}function W0(e){return $n(oi,"hex",dt.hex,e)}function X0(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=dt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return $n(oi,n,o,t)}function ae(e){return gd(ss,e)}function lp(e){return vd(kn,e)}function Y0(e){return yd(kn,e)}function Q0(e){return _d(kn,e)}function ez(e){return $d(kn,e)}function tz(e){return bd(kn,e)}function ke(e){return xd(cs,e)}function rz(e){return kd(us,e)}function nz(e){return wd(Tp,e)}function oz(e){return Sd(Tp,e)}function iz(e){return zd(j_,e)}function az(e){return Id(N_,e)}function ii(e){return Td(R_,e)}function sz(){return Ed(D_)}function pe(){return Pd(A_)}function Ep(e){return Od(Z_,e)}function cz(e){return jd(C_,e)}function uz(e){return Nd(Pp,e)}function Y(e,t){return wy(U_,e,t)}function lz(e){let t=e._zod.def.shape;return Ae(Object.keys(t))}function E(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new ls(r)}function dz(e,t){return new ls({type:"object",shape:e,catchall:Ep(),...b.normalizeParams(t)})}function De(e,t){return new ls({type:"object",shape:e,catchall:pe(),...b.normalizeParams(t)})}function ce(e,t){return new ds({type:"union",options:e,...b.normalizeParams(t)})}function pz(e,t){return new M_({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}function ps(e,t,r){return new L_({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}function ai(e,t){return new q_({type:"intersection",left:e,right:t})}function V_(e,t,r){let n=t instanceof F,o=n?r:t,i=n?t:null;return new F_({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}function he(e,t,r){return new ms({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function mz(e,t,r){let n=Fe(e);return n._zod.values=void 0,new ms({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function fz(e,t,r){return new ms({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}function hz(e,t,r){return new J_({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}function gz(e,t){return new B_({type:"set",valueType:e,...b.normalizeParams(t)})}function Ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ni({type:"enum",entries:r,...b.normalizeParams(t)})}function vz(e,t){return new ni({type:"enum",entries:e,...b.normalizeParams(t)})}function R(e,t){return new G_({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}function yz(e){return Md(K_,e)}function Op(e){return new H_({type:"transform",transform:e})}function ge(e){return new jp({type:"optional",innerType:e})}function X_(e){return new W_({type:"optional",innerType:e})}function ns(e){return new Y_({type:"nullable",innerType:e})}function _z(e){return ge(ns(e))}function e$(e,t){return new Q_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function r$(e,t){return new t$({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function n$(e,t){return new Np({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}function $z(e){return new o$({type:"success",innerType:e})}function a$(e,t){return new i$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function bz(e){return Rd(s$,e)}function os(e,t){return new Rp({type:"pipe",in:e,out:t})}function xz(e,t,r){return new Dp({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function u$(e){return new c$({type:"readonly",innerType:e})}function kz(e,t){return new l$({type:"template_literal",parts:e,...b.normalizeParams(t)})}function p$(e){return new d$({type:"lazy",getter:e})}function wz(e){return new m$({type:"promise",innerType:e})}function Sz(e){return new f$({type:"function",input:Array.isArray(e?.input)?V_(e?.input):e?.input??Y(pe()),output:e?.output??pe()})}function zz(e){let t=new le({check:"custom"});return t._zod.check=e,t}function Ap(e,t){return Ld(fs,e??(()=>!0),t)}function h$(e,t={}){return qd(fs,e,t)}function g$(e){return Fd(e)}function Ez(e,t={}){let r=new fs({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 Oz(e){let t=p$(()=>ce([v(e),ae(),ke(),ii(),Y(t),he(v(),t)]));return t}function hs(e,t){return os(Op(e),t)}var B,dp,is,de,pp,rs,Kt,as,mp,fp,hp,gp,vp,yp,_p,$p,O_,bp,xp,kp,wp,Sp,zp,Ip,oi,ss,kn,cs,us,Tp,j_,N_,R_,D_,A_,Z_,C_,Pp,U_,ls,ds,M_,L_,q_,F_,ms,J_,B_,ni,G_,K_,H_,jp,W_,Y_,Q_,t$,Np,o$,i$,s$,Rp,Dp,c$,l$,d$,m$,f$,fs,Iz,Tz,Pz,ri=h(()=>{be();be();bn();Qo();ts();ei();up();B=f("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yo(e,"input"),output:Yo(e,"output")}}),e.toJSONSchema=zy(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)=>__(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>b_(e,r,n),e.parseAsync=async(r,n)=>$_(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>x_(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>k_(e,r,n),e.decode=(r,n)=>w_(e,r,n),e.encodeAsync=async(r,n)=>S_(e,r,n),e.decodeAsync=async(r,n)=>z_(e,r,n),e.safeEncode=(r,n)=>I_(e,r,n),e.safeDecode=(r,n)=>T_(e,r,n),e.safeEncodeAsync=async(r,n)=>E_(e,r,n),e.safeDecodeAsync=async(r,n)=>P_(e,r,n),e.refine=(r,n)=>e.check(h$(r,n)),e.superRefine=r=>e.check(g$(r)),e.overwrite=r=>e.check(jt(r)),e.optional=()=>ge(e),e.exactOptional=()=>X_(e),e.nullable=()=>ns(e),e.nullish=()=>ge(ns(e)),e.nonoptional=r=>n$(e,r),e.array=()=>Y(e),e.or=r=>ce([e,r]),e.and=r=>ai(e,r),e.transform=r=>os(e,Op(r)),e.default=r=>e$(e,r),e.prefault=r=>r$(e,r),e.catch=r=>a$(e,r),e.pipe=r=>os(e,r),e.readonly=()=>u$(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)),dp=f("_ZodString",(e,t)=>{Or.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Iy(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(Lo(...n)),e.includes=(...n)=>e.check(Vo(...n)),e.startsWith=(...n)=>e.check(Jo(...n)),e.endsWith=(...n)=>e.check(Bo(...n)),e.min=(...n)=>e.check(lr(...n)),e.max=(...n)=>e.check(yn(...n)),e.length=(...n)=>e.check(_n(...n)),e.nonempty=(...n)=>e.check(lr(1,...n)),e.lowercase=n=>e.check(qo(n)),e.uppercase=n=>e.check(Fo(n)),e.trim=()=>e.check(Ho()),e.normalize=(...n)=>e.check(Ko(...n)),e.toLowerCase=()=>e.check(Wo()),e.toUpperCase=()=>e.check(Xo()),e.slugify=()=>e.check(Ga())}),is=f("ZodString",(e,t)=>{Or.init(e,t),dp.init(e,t),e.email=r=>e.check(Ia(pp,r)),e.url=r=>e.check(Mo(as,r)),e.jwt=r=>e.check(Ba(Ip,r)),e.emoji=r=>e.check(ja(mp,r)),e.guid=r=>e.check(Uo(rs,r)),e.uuid=r=>e.check(Ta(Kt,r)),e.uuidv4=r=>e.check(Ea(Kt,r)),e.uuidv6=r=>e.check(Pa(Kt,r)),e.uuidv7=r=>e.check(Oa(Kt,r)),e.nanoid=r=>e.check(Na(fp,r)),e.guid=r=>e.check(Uo(rs,r)),e.cuid=r=>e.check(Ra(hp,r)),e.cuid2=r=>e.check(Da(gp,r)),e.ulid=r=>e.check(Aa(vp,r)),e.base64=r=>e.check(Fa(wp,r)),e.base64url=r=>e.check(Va(Sp,r)),e.xid=r=>e.check(Za(yp,r)),e.ksuid=r=>e.check(Ca(_p,r)),e.ipv4=r=>e.check(Ua($p,r)),e.ipv6=r=>e.check(Ma(bp,r)),e.cidrv4=r=>e.check(La(xp,r)),e.cidrv6=r=>e.check(qa(kp,r)),e.e164=r=>e.check(Ja(zp,r)),e.datetime=r=>e.check(tp(r)),e.date=r=>e.check(np(r)),e.time=r=>e.check(ip(r)),e.duration=r=>e.check(sp(r))});de=f("ZodStringFormat",(e,t)=>{se.init(e,t),dp.init(e,t)}),pp=f("ZodEmail",(e,t)=>{Xu.init(e,t),de.init(e,t)});rs=f("ZodGUID",(e,t)=>{Hu.init(e,t),de.init(e,t)});Kt=f("ZodUUID",(e,t)=>{Wu.init(e,t),de.init(e,t)});as=f("ZodURL",(e,t)=>{Yu.init(e,t),de.init(e,t)});mp=f("ZodEmoji",(e,t)=>{Qu.init(e,t),de.init(e,t)});fp=f("ZodNanoID",(e,t)=>{el.init(e,t),de.init(e,t)});hp=f("ZodCUID",(e,t)=>{tl.init(e,t),de.init(e,t)});gp=f("ZodCUID2",(e,t)=>{rl.init(e,t),de.init(e,t)});vp=f("ZodULID",(e,t)=>{nl.init(e,t),de.init(e,t)});yp=f("ZodXID",(e,t)=>{ol.init(e,t),de.init(e,t)});_p=f("ZodKSUID",(e,t)=>{il.init(e,t),de.init(e,t)});$p=f("ZodIPv4",(e,t)=>{ll.init(e,t),de.init(e,t)});O_=f("ZodMAC",(e,t)=>{pl.init(e,t),de.init(e,t)});bp=f("ZodIPv6",(e,t)=>{dl.init(e,t),de.init(e,t)});xp=f("ZodCIDRv4",(e,t)=>{ml.init(e,t),de.init(e,t)});kp=f("ZodCIDRv6",(e,t)=>{fl.init(e,t),de.init(e,t)});wp=f("ZodBase64",(e,t)=>{hl.init(e,t),de.init(e,t)});Sp=f("ZodBase64URL",(e,t)=>{gl.init(e,t),de.init(e,t)});zp=f("ZodE164",(e,t)=>{vl.init(e,t),de.init(e,t)});Ip=f("ZodJWT",(e,t)=>{yl.init(e,t),de.init(e,t)});oi=f("ZodCustomStringFormat",(e,t)=>{_l.init(e,t),de.init(e,t)});ss=f("ZodNumber",(e,t)=>{xa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ty(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(lp(n)),e.safe=n=>e.check(lp(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(jr(n,o)),e.step=(n,o)=>e.check(jr(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});kn=f("ZodNumberFormat",(e,t)=>{$l.init(e,t),ss.init(e,t)});cs=f("ZodBoolean",(e,t)=>{Do.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ey(e,r,n,o)});us=f("ZodBigInt",(e,t)=>{ka.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Py(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(jr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Tp=f("ZodBigIntFormat",(e,t)=>{bl.init(e,t),us.init(e,t)});j_=f("ZodSymbol",(e,t)=>{xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oy(e,r,n,o)});N_=f("ZodUndefined",(e,t)=>{kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ny(e,r,n,o)});R_=f("ZodNull",(e,t)=>{wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jy(e,r,n,o)});D_=f("ZodAny",(e,t)=>{Sl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ay(e,r,n,o)});A_=f("ZodUnknown",(e,t)=>{zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zy(e,r,n,o)});Z_=f("ZodNever",(e,t)=>{Il.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dy(e,r,n,o)});C_=f("ZodVoid",(e,t)=>{Tl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o)});Pp=f("ZodDate",(e,t)=>{El.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Cy(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});U_=f("ZodArray",(e,t)=>{Pl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wy(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(lr(r,n)),e.nonempty=r=>e.check(lr(1,r)),e.max=(r,n)=>e.check(yn(r,n)),e.length=(r,n)=>e.check(_n(r,n)),e.unwrap=()=>e.element});ls=f("ZodObject",(e,t)=>{Pv.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xy(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ae(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:Ep()}),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(jp,e,r[0]),e.required=(...r)=>b.required(Np,e,r[0])});ds=f("ZodUnion",(e,t)=>{Ao.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gd(e,r,n,o),e.options=t.options});M_=f("ZodXor",(e,t)=>{ds.init(e,t),Ol.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gd(e,r,n,o),e.options=t.options});L_=f("ZodDiscriminatedUnion",(e,t)=>{ds.init(e,t),jl.init(e,t)});q_=f("ZodIntersection",(e,t)=>{Nl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yy(e,r,n,o)});F_=f("ZodTuple",(e,t)=>{wa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qy(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});ms=f("ZodRecord",(e,t)=>{Rl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>e_(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});J_=f("ZodMap",(e,t)=>{Dl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ky(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(Nr(...r)),e.size=(...r)=>e.check(vn(...r))});B_=f("ZodSet",(e,t)=>{Al.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hy(e,r,n,o),e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Nr(...r)),e.size=(...r)=>e.check(vn(...r))});ni=f("ZodEnum",(e,t)=>{Zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Uy(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 ni({...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 ni({...t,checks:[],...b.normalizeParams(o),entries:i})}});G_=f("ZodLiteral",(e,t)=>{Cl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>My(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]}})});K_=f("ZodFile",(e,t)=>{Ul.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fy(e,r,n,o),e.min=(r,n)=>e.check(Gt(r,n)),e.max=(r,n)=>e.check(Nr(r,n)),e.mime=(r,n)=>e.check(Go(Array.isArray(r)?r:[r],n))});H_=f("ZodTransform",(e,t)=>{Ml.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gy(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(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)}});jp=f("ZodOptional",(e,t)=>{Sa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});W_=f("ZodExactOptional",(e,t)=>{Ll.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Y_=f("ZodNullable",(e,t)=>{ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>t_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Q_=f("ZodDefault",(e,t)=>{Fl.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.removeDefault=e.unwrap});t$=f("ZodPrefault",(e,t)=>{Vl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>o_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Np=f("ZodNonOptional",(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});o$=f("ZodSuccess",(e,t)=>{Bl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});i$=f("ZodCatch",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>i_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});s$=f("ZodNaN",(e,t)=>{Kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ly(e,r,n,o)});Rp=f("ZodPipe",(e,t)=>{Hl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>a_(e,r,n,o),e.in=t.in,e.out=t.out});Dp=f("ZodCodec",(e,t)=>{Rp.init(e,t),Zo.init(e,t)});c$=f("ZodReadonly",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>s_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});l$=f("ZodTemplateLiteral",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qy(e,r,n,o)});d$=f("ZodLazy",(e,t)=>{ed.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>u_(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});m$=f("ZodPromise",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>c_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});f$=f("ZodFunction",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>By(e,r,n,o)});fs=f("ZodCustom",(e,t)=>{td.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jy(e,r,n,o)});Iz=Vd,Tz=Jd;Pz=(...e)=>Bd({Codec:Dp,Boolean:cs,String:is},...e)});var v$,y$=h(()=>{be();be();v$||(v$={})});var HZ,_$=h(()=>{Co();ts();ei();ri();HZ={...ti,...es,iso:Rr}});var $$=h(()=>{be();ri()});var Zp=h(()=>{be();ri();ts();cp();up();y$();be();od();be();bn();_$();za();ei();ei();$$();Se(nd())});var Cp=h(()=>{Zp();Zp()});var b$=h(()=>{Cp();Cp()});var Mp,x$,pr,vs,Te,k$,w$,fC,Dz,Az,Lp,ct,si,S$,Ee,pt,mt,Pe,ys,z$,qp,I$,T$,Fp,ci,te,Vp,E$,P$,hC,_s,Zz,$s,Cz,ui,wn,O$,Uz,Mz,Lz,qz,Fz,Vz,Jp,Jz,Bz,Bp,bs,Gz,Kz,xs,Hz,li,di,Wz,pi,Sn,Xz,mi,ks,ws,Ss,gC,zs,Is,Ts,j$,N$,R$,Gp,D$,fi,zn,A$,Yz,Qz,eI,tI,rI,Kp,nI,oI,iI,aI,sI,cI,uI,lI,dI,pI,mI,fI,hI,gI,vI,yI,Hp,Wp,Xp,_I,$I,bI,Yp,xI,kI,wI,SI,zI,Z$,Qp,II,Es,vC,TI,hi,EI,yC,gi,PI,em,OI,jI,NI,RI,DI,AI,ZI,gs,CI,UI,MI,vi,tm,LI,qI,FI,VI,JI,BI,GI,KI,HI,WI,XI,YI,QI,eT,tT,rT,nT,oT,In,iT,aT,sT,cT,uT,lT,dT,rm,pT,_C,$C,bC,xC,kC,wC,G,Up,Tn=h(()=>{b$();Mp="2025-11-25",x$=[Mp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pr="io.modelcontextprotocol/related-task",vs="2.0",Te=Ap(e=>e!==null&&(typeof e=="object"||typeof e=="function")),k$=ce([v(),ae().int()]),w$=v(),fC=De({ttl:ce([ae(),ii()]).optional(),pollInterval:ae().optional()}),Dz=E({ttl:ae().optional()}),Az=E({taskId:v()}),Lp=De({progressToken:k$.optional(),[pr]:Az.optional()}),ct=E({_meta:Lp.optional()}),si=ct.extend({task:Dz.optional()}),S$=e=>si.safeParse(e).success,Ee=E({method:v(),params:ct.loose().optional()}),pt=E({_meta:Lp.optional()}),mt=E({method:v(),params:pt.loose().optional()}),Pe=De({_meta:Lp.optional()}),ys=ce([v(),ae().int()]),z$=E({jsonrpc:R(vs),id:ys,...Ee.shape}).strict(),qp=e=>z$.safeParse(e).success,I$=E({jsonrpc:R(vs),...mt.shape}).strict(),T$=e=>I$.safeParse(e).success,Fp=E({jsonrpc:R(vs),id:ys,result:Pe}).strict(),ci=e=>Fp.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={}));Vp=E({jsonrpc:R(vs),id:ys.optional(),error:E({code:ae().int(),message:v(),data:pe().optional()})}).strict(),E$=e=>Vp.safeParse(e).success,P$=ce([z$,I$,Fp,Vp]),hC=ce([Fp,Vp]),_s=Pe.strict(),Zz=pt.extend({requestId:ys.optional(),reason:v().optional()}),$s=mt.extend({method:R("notifications/cancelled"),params:Zz}),Cz=E({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Ae(["light","dark"]).optional()}),ui=E({icons:Y(Cz).optional()}),wn=E({name:v(),title:v().optional()}),O$=wn.extend({...wn.shape,...ui.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Uz=ai(E({applyDefaults:ke().optional()}),he(v(),pe())),Mz=hs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ai(E({form:Uz.optional(),url:Te.optional()}),he(v(),pe()).optional())),Lz=De({list:Te.optional(),cancel:Te.optional(),requests:De({sampling:De({createMessage:Te.optional()}).optional(),elicitation:De({create:Te.optional()}).optional()}).optional()}),qz=De({list:Te.optional(),cancel:Te.optional(),requests:De({tools:De({call:Te.optional()}).optional()}).optional()}),Fz=E({experimental:he(v(),Te).optional(),sampling:E({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:Mz.optional(),roots:E({listChanged:ke().optional()}).optional(),tasks:Lz.optional()}),Vz=ct.extend({protocolVersion:v(),capabilities:Fz,clientInfo:O$}),Jp=Ee.extend({method:R("initialize"),params:Vz}),Jz=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:qz.optional()}),Bz=Pe.extend({protocolVersion:v(),capabilities:Jz,serverInfo:O$,instructions:v().optional()}),Bp=mt.extend({method:R("notifications/initialized"),params:pt.optional()}),bs=Ee.extend({method:R("ping"),params:ct.optional()}),Gz=E({progress:ae(),total:ge(ae()),message:ge(v())}),Kz=E({...pt.shape,...Gz.shape,progressToken:k$}),xs=mt.extend({method:R("notifications/progress"),params:Kz}),Hz=ct.extend({cursor:w$.optional()}),li=Ee.extend({params:Hz.optional()}),di=Pe.extend({nextCursor:w$.optional()}),Wz=Ae(["working","input_required","completed","failed","cancelled"]),pi=E({taskId:v(),status:Wz,ttl:ce([ae(),ii()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:ge(ae()),statusMessage:ge(v())}),Sn=Pe.extend({task:pi}),Xz=pt.merge(pi),mi=mt.extend({method:R("notifications/tasks/status"),params:Xz}),ks=Ee.extend({method:R("tasks/get"),params:ct.extend({taskId:v()})}),ws=Pe.merge(pi),Ss=Ee.extend({method:R("tasks/result"),params:ct.extend({taskId:v()})}),gC=Pe.loose(),zs=li.extend({method:R("tasks/list")}),Is=di.extend({tasks:Y(pi)}),Ts=Ee.extend({method:R("tasks/cancel"),params:ct.extend({taskId:v()})}),j$=Pe.merge(pi),N$=E({uri:v(),mimeType:ge(v()),_meta:he(v(),pe()).optional()}),R$=N$.extend({text:v()}),Gp=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D$=N$.extend({blob:Gp}),fi=Ae(["user","assistant"]),zn=E({audience:Y(fi).optional(),priority:ae().min(0).max(1).optional(),lastModified:Rr.datetime({offset:!0}).optional()}),A$=E({...wn.shape,...ui.shape,uri:v(),description:ge(v()),mimeType:ge(v()),annotations:zn.optional(),_meta:ge(De({}))}),Yz=E({...wn.shape,...ui.shape,uriTemplate:v(),description:ge(v()),mimeType:ge(v()),annotations:zn.optional(),_meta:ge(De({}))}),Qz=li.extend({method:R("resources/list")}),eI=di.extend({resources:Y(A$)}),tI=li.extend({method:R("resources/templates/list")}),rI=di.extend({resourceTemplates:Y(Yz)}),Kp=ct.extend({uri:v()}),nI=Kp,oI=Ee.extend({method:R("resources/read"),params:nI}),iI=Pe.extend({contents:Y(ce([R$,D$]))}),aI=mt.extend({method:R("notifications/resources/list_changed"),params:pt.optional()}),sI=Kp,cI=Ee.extend({method:R("resources/subscribe"),params:sI}),uI=Kp,lI=Ee.extend({method:R("resources/unsubscribe"),params:uI}),dI=pt.extend({uri:v()}),pI=mt.extend({method:R("notifications/resources/updated"),params:dI}),mI=E({name:v(),description:ge(v()),required:ge(ke())}),fI=E({...wn.shape,...ui.shape,description:ge(v()),arguments:ge(Y(mI)),_meta:ge(De({}))}),hI=li.extend({method:R("prompts/list")}),gI=di.extend({prompts:Y(fI)}),vI=ct.extend({name:v(),arguments:he(v(),v()).optional()}),yI=Ee.extend({method:R("prompts/get"),params:vI}),Hp=E({type:R("text"),text:v(),annotations:zn.optional(),_meta:he(v(),pe()).optional()}),Wp=E({type:R("image"),data:Gp,mimeType:v(),annotations:zn.optional(),_meta:he(v(),pe()).optional()}),Xp=E({type:R("audio"),data:Gp,mimeType:v(),annotations:zn.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()}),$I=E({type:R("resource"),resource:ce([R$,D$]),annotations:zn.optional(),_meta:he(v(),pe()).optional()}),bI=A$.extend({type:R("resource_link")}),Yp=ce([Hp,Wp,Xp,bI,$I]),xI=E({role:fi,content:Yp}),kI=Pe.extend({description:v().optional(),messages:Y(xI)}),wI=mt.extend({method:R("notifications/prompts/list_changed"),params:pt.optional()}),SI=E({title:v().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),zI=E({taskSupport:Ae(["required","optional","forbidden"]).optional()}),Z$=E({...wn.shape,...ui.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:SI.optional(),execution:zI.optional(),_meta:he(v(),pe()).optional()}),Qp=li.extend({method:R("tools/list")}),II=di.extend({tools:Y(Z$)}),Es=Pe.extend({content:Y(Yp).default([]),structuredContent:he(v(),pe()).optional(),isError:ke().optional()}),vC=Es.or(Pe.extend({toolResult:pe()})),TI=si.extend({name:v(),arguments:he(v(),pe()).optional()}),hi=Ee.extend({method:R("tools/call"),params:TI}),EI=mt.extend({method:R("notifications/tools/list_changed"),params:pt.optional()}),yC=E({autoRefresh:ke().default(!0),debounceMs:ae().int().nonnegative().default(300)}),gi=Ae(["debug","info","notice","warning","error","critical","alert","emergency"]),PI=ct.extend({level:gi}),em=Ee.extend({method:R("logging/setLevel"),params:PI}),OI=pt.extend({level:gi,logger:v().optional(),data:pe()}),jI=mt.extend({method:R("notifications/message"),params:OI}),NI=E({name:v().optional()}),RI=E({hints:Y(NI).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),DI=E({mode:Ae(["auto","required","none"]).optional()}),AI=E({type:R("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(Yp).default([]),structuredContent:E({}).loose().optional(),isError:ke().optional(),_meta:he(v(),pe()).optional()}),ZI=ps("type",[Hp,Wp,Xp]),gs=ps("type",[Hp,Wp,Xp,_I,AI]),CI=E({role:fi,content:ce([gs,Y(gs)]),_meta:he(v(),pe()).optional()}),UI=si.extend({messages:Y(CI),modelPreferences:RI.optional(),systemPrompt:v().optional(),includeContext:Ae(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:Y(v()).optional(),metadata:Te.optional(),tools:Y(Z$).optional(),toolChoice:DI.optional()}),MI=Ee.extend({method:R("sampling/createMessage"),params:UI}),vi=Pe.extend({model:v(),stopReason:ge(Ae(["endTurn","stopSequence","maxTokens"]).or(v())),role:fi,content:ZI}),tm=Pe.extend({model:v(),stopReason:ge(Ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:fi,content:ce([gs,Y(gs)])}),LI=E({type:R("boolean"),title:v().optional(),description:v().optional(),default:ke().optional()}),qI=E({type:R("string"),title:v().optional(),description:v().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ae(["email","uri","date","date-time"]).optional(),default:v().optional()}),FI=E({type:Ae(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),VI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),JI=E({type:R("string"),title:v().optional(),description:v().optional(),oneOf:Y(E({const:v(),title:v()})),default:v().optional()}),BI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),GI=ce([VI,JI]),KI=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()}),HI=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()}),WI=ce([KI,HI]),XI=ce([BI,GI,WI]),YI=ce([XI,LI,qI,FI]),QI=si.extend({mode:R("form").optional(),message:v(),requestedSchema:E({type:R("object"),properties:he(v(),YI),required:Y(v()).optional()})}),eT=si.extend({mode:R("url"),message:v(),elicitationId:v(),url:v().url()}),tT=ce([QI,eT]),rT=Ee.extend({method:R("elicitation/create"),params:tT}),nT=pt.extend({elicitationId:v()}),oT=mt.extend({method:R("notifications/elicitation/complete"),params:nT}),In=Pe.extend({action:Ae(["accept","decline","cancel"]),content:hs(e=>e===null?void 0:e,he(v(),ce([v(),ae(),ke(),Y(v())])).optional())}),iT=E({type:R("ref/resource"),uri:v()}),aT=E({type:R("ref/prompt"),name:v()}),sT=ct.extend({ref:ce([aT,iT]),argument:E({name:v(),value:v()}),context:E({arguments:he(v(),v()).optional()}).optional()}),cT=Ee.extend({method:R("completion/complete"),params:sT}),uT=Pe.extend({completion:De({values:Y(v()).max(100),total:ge(ae().int()),hasMore:ge(ke())})}),lT=E({uri:v().startsWith("file://"),name:v().optional(),_meta:he(v(),pe()).optional()}),dT=Ee.extend({method:R("roots/list"),params:ct.optional()}),rm=Pe.extend({roots:Y(lT)}),pT=mt.extend({method:R("notifications/roots/list_changed"),params:pt.optional()}),_C=ce([bs,Jp,cT,em,yI,hI,Qz,tI,oI,cI,lI,hi,Qp,ks,Ss,zs,Ts]),$C=ce([$s,xs,Bp,pT,mi]),bC=ce([_s,vi,tm,In,rm,ws,Is,Sn]),xC=ce([bs,MI,rT,dT,ks,Ss,zs,Ts]),kC=ce([$s,xs,jI,pI,aI,EI,wI,mi,oT]),wC=ce([_s,Bz,uT,kI,gI,eI,rI,iI,Es,II,ws,Is,Sn]),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 Up(o.elicitations,r)}return new e(t,r,n)}},Up=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 mr(e){return e==="completed"||e==="failed"||e==="cancelled"}var C$=h(()=>{});var Ps=h(()=>{});var nm=h(()=>{Ps()});var fr=h(()=>{});var Os=h(()=>{});var ft=h(()=>{Os()});var om=h(()=>{vo();fr();we()});var im=h(()=>{fr()});var am=h(()=>{});var js=h(()=>{we()});var sm=h(()=>{we()});var cm=h(()=>{fr()});var um=h(()=>{we()});var lm=h(()=>{we();ft()});var dm=h(()=>{});var pm=h(()=>{we()});var mm=h(()=>{});var oU,Ns=h(()=>{fr();oU=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});var Rs=h(()=>{vo();we();Ns();js();ft()});var fm=h(()=>{we();Rs();ft()});var hm=h(()=>{});var gm=h(()=>{ft()});var vm=h(()=>{});var Ds=h(()=>{we()});var ym=h(()=>{we();Ds()});var _m=h(()=>{fr()});var $m=h(()=>{we()});var bm=h(()=>{we();ft()});var xm=h(()=>{we()});var km=h(()=>{we()});var wm=h(()=>{fr();we()});var Sm=h(()=>{we()});var zm=h(()=>{ft()});var Im=h(()=>{ft()});var Tm=h(()=>{we()});var Em=h(()=>{vo();ft();om();im();am();js();sm();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();Rs();wm();Ns();Sm();zm();Ds();Im();Tm()});var we=h(()=>{Ps();Em();Os();ft()});var U$=h(()=>{});var Pm=h(()=>{we();nm();ft()});var M$=h(()=>{Ps();nm();fr();Os();we();U$();ft();om();im();am();js();sm();cm();um();lm();dm();pm();mm();fm();hm();gm();vm();ym();_m();$m();bm();xm();km();Tm();Rs();wm();Ns();Sm();zm();Ds();Im();Em();Pm();Pm()});function Om(e){let r=Ya(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=v_(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function jm(e,t){let r=dr(e,t);if(!r.success)throw r.error;return r.data}var L$=h(()=>{Qd();Qa();M$()});function q$(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function F$(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];q$(a)&&q$(i)?r[o]={...a,...i}:r[o]=i}return r}var yT,As,V$=h(()=>{Qa();Tn();C$();L$();yT=6e4,As=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($s,r=>{this._oncancel(r)}),this.setNotificationHandler(xs,r=>{this._onprogress(r)}),this.setRequestHandler(bs,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ks,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(Ss,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(!mr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(mr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[pr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(zs,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(Ts,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(mr(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),ci(i)||E$(i)?this._onresponse(i):qp(i)?this._onrequest(i,a):T$(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?.[pr]?.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=S$(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),ci(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(ci(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),ci(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,Sn,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},mr(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||{},[pr]: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=dr(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??yT,_=()=>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},ws,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},Is,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},j$,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||{},[pr]: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||{},[pr]: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||{},[pr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Om(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=jm(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=Om(t);this._notificationHandlers.set(n,o=>{let i=jm(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"&&qp(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=mi.parse({method:"notifications/tasks/status",params:s});await this.notification(c),mr(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(mr(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=mi.parse({method:"notifications/tasks/status",params:c});await this.notification(u),mr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}}});var bi=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 _i=class{};ie._CodeOrName=_i;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Dr=class extends _i{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=Dr;var ht=class extends _i{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 Dr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=ht;ie.nil=new ht("");function J$(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Rm(r,t[n]),r.push(e[++n]);return new ht(r)}ie._=J$;var Nm=new ht("+");function B$(e,...t){let r=[$i(e[0])],n=0;for(;n<t.length;)r.push(Nm),Rm(r,t[n]),r.push(Nm,$i(e[++n]));return _T(r),new ht(r)}ie.str=B$;function Rm(e,t){t instanceof ht?e.push(...t._items):t instanceof Dr?e.push(t):e.push(xT(t))}ie.addCodeArg=Rm;function _T(e){let t=1;for(;t<e.length-1;){if(e[t]===Nm){let r=$T(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function $T(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Dr||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 Dr))return`"${e}${t.slice(1)}`}function bT(e,t){return t.emptyStr()?e:e.emptyStr()?t:B$`${e}${t}`}ie.strConcat=bT;function xT(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:$i(Array.isArray(e)?e.join(","):e)}function kT(e){return new ht($i(e))}ie.stringify=kT;function $i(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=$i;function wT(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new ht(`.${e}`):J$`[${e}]`}ie.getProperty=wT;function ST(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=ST;function zT(e){return new ht(e.toString())}ie.regexpCode=zT});var Zm=I(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.ValueScope=Ye.ValueScopeName=Ye.Scope=Ye.varKinds=Ye.UsedValueState=void 0;var Xe=bi(),Dm=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Zs;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Zs||(Ye.UsedValueState=Zs={}));Ye.varKinds={const:new Xe.Name("const"),let:new Xe.Name("let"),var:new Xe.Name("var")};var Cs=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=Cs;var Us=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=Us;var IT=(0,Xe._)`\n`,Am=class extends Cs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?IT:Xe.nil}}get(){return this._scope}name(t){return new Us(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,Zs.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 Dm(u);c.set(u,Zs.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=bi(),wt=Zm(),hr=bi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return hr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return hr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return hr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return hr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return hr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return hr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return hr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return hr.Name}});var Fs=Zm();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Fs.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Fs.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Fs.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Fs.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=Pn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},Ms=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=Pn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return qs(t,this.rhs)}},Um=class extends Ms{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Mm=class extends Wt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Lm=class extends Wt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},qm=class extends Wt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Fm=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=Pn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},xi=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)||(TT(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Cr(t,r.names),{})}},Xt=class extends xi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Vm=class extends xi{},En=class extends Xt{};En.kind="else";var Ar=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 En(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(G$(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=Pn(this.condition,t,r),this}get names(){let t=super.names;return qs(t,this.condition),this.else&&Cr(t,this.else.names),t}};Ar.kind="if";var Zr=class extends Xt{};Zr.kind="for";var Jm=class extends Zr{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=Pn(this.iteration,t,r),this}get names(){return Cr(super.names,this.iteration.names)}},Bm=class extends Zr{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=qs(super.names,this.from);return qs(t,this.to)}},Ls=class extends Zr{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=Pn(this.iterable,t,r),this}get names(){return Cr(super.names,this.iterable.names)}},ki=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)}};ki.kind="func";var wi=class extends xi{render(t){return"return "+super.render(t)}};wi.kind="return";var Gm=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&&Cr(t,this.catch.names),this.finally&&Cr(t,this.finally.names),t}},Si=class extends Xt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Si.kind="catch";var zi=class extends Xt{render(t){return"finally"+super.render(t)}};zi.kind="finally";var Km=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
1495
+ `:""},this._extScope=t,this._scope=new wt.Scope({parent:t}),this._nodes=[new Vm]}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 Ms(t,r,n))}add(t,r){return this._leafNode(new Um(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==re.nil&&this._leafNode(new Fm(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 Ar(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 Ar(t))}else(){return this._elseNode(new En)}endIf(){return this._endBlockNode(Ar,En)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Jm(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 Bm(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 Ls("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 Ls("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Zr)}label(t){return this._leafNode(new Mm(t))}break(t){return this._leafNode(new Lm(t))}return(t){let r=new wi;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(wi)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Gm;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Si(i),r(i)}return n&&(this._currNode=o.finally=new zi,this.code(n)),this._endBlockNode(Si,zi)}throw(t){return this._leafNode(new qm(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 ki(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ki)}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 Ar))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=Km;function Cr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function qs(e,t){return t instanceof re._CodeOrName?Cr(e,t.names):e}function Pn(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 TT(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function G$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Hm(e)}`}X.not=G$;var ET=K$(X.operators.AND);function PT(...e){return e.reduce(ET)}X.and=PT;var OT=K$(X.operators.OR);function jT(...e){return e.reduce(OT)}X.or=jT;function K$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${Hm(t)} ${e} ${Hm(r)}`}function Hm(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(),NT=bi();function RT(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=RT;function DT(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(X$(e,t),!Y$(t,e.self.RULES.all))}Q.alwaysValidSchema=DT;function X$(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]||tb(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=X$;function Y$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=Y$;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 ZT({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=ZT;function CT(e){return Q$(decodeURIComponent(e))}Q.unescapeFragment=CT;function UT(e){return encodeURIComponent(Xm(e))}Q.escapeFragment=UT;function Xm(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Xm;function Q$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=Q$;function MT(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=MT;function H$({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:H$({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} || {}`),Ym(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:eb}),items:H$({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 eb(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&Ym(e,r,t),r}Q.evaluatedPropsToName=eb;function Ym(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=Ym;var W$={};function LT(e,t){return e.scopeValue("func",{ref:t,code:W$[t.code]||(W$[t.code]=new NT._Code(t.code))})}Q.useFunc=LT;var Wm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Wm||(Q.Type=Wm={}));function qT(e,t,r){if(e instanceof me.Name){let n=t===Wm.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():"/"+Xm(e)}Q.getErrorPath=qT;function tb(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=tb});var Yt=I(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var Ze=H(),FT={data:new Ze.Name("data"),valCxt:new Ze.Name("valCxt"),instancePath:new Ze.Name("instancePath"),parentData:new Ze.Name("parentData"),parentDataProperty:new Ze.Name("parentDataProperty"),rootData:new Ze.Name("rootData"),dynamicAnchors:new Ze.Name("dynamicAnchors"),vErrors:new Ze.Name("vErrors"),errors:new Ze.Name("errors"),this:new Ze.Name("this"),self:new Ze.Name("self"),scope:new Ze.Name("scope"),json:new Ze.Name("json"),jsonPos:new Ze.Name("jsonPos"),jsonLen:new Ze.Name("jsonLen"),jsonPart:new Ze.Name("jsonPart")};Qm.default=FT});var Ii=I(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.extendErrors=Ce.resetErrorsCount=Ce.reportExtraError=Ce.reportError=Ce.keyword$DataError=Ce.keywordError=void 0;var oe=H(),Vs=ne(),Ge=Yt();Ce.keywordError={message:({keyword:e})=>(0,oe.str)`must pass "${e}" keyword validation`};Ce.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 VT(e,t=Ce.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=ob(e,t,r);n??(a||s)?rb(i,c):nb(o,(0,oe._)`[${c}]`)}Ce.reportError=VT;function JT(e,t=Ce.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=ob(e,t,r);rb(o,s),i||a||nb(n,Ge.default.vErrors)}Ce.reportExtraError=JT;function BT(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)))}Ce.resetErrorsCount=BT;function GT({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))})}Ce.extendErrors=GT;function rb(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 nb(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 Ur={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 ob(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:KT(e,t,r)}function KT(e,t,r={}){let{gen:n,it:o}=e,i=[HT(o,r),WT(e,r)];return XT(e,t,i),n.object(...i)}function HT({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Vs.getErrorPath)(t,Vs.Type.Str)}`:e;return[Ge.default.instancePath,(0,oe.strConcat)(Ge.default.instancePath,r)]}function WT({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,Vs.getErrorPath)(r,Vs.Type.Str)}`),[Ur.schemaPath,o]}function XT(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([Ur.keyword,o],[Ur.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Ur.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Ur.schema,a],[Ur.parentSchema,(0,oe._)`${l}${d}`],[Ge.default.data,i]),u&&n.push([Ur.propertyName,u])}});var ab=I(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.boolOrEmptySchema=On.topBoolOrEmptySchema=void 0;var YT=Ii(),QT=H(),eE=Yt(),tE={message:"boolean schema is false"};function rE(e){let{gen:t,schema:r,validateName:n}=e;r===!1?ib(e,!1):typeof r=="object"&&r.$async===!0?t.return(eE.default.data):(t.assign((0,QT._)`${n}.errors`,null),t.return(!0))}On.topBoolOrEmptySchema=rE;function nE(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),ib(e)):r.var(t,!0)}On.boolOrEmptySchema=nE;function ib(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,YT.reportError)(o,tE,void 0,t)}});var ef=I(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.getRules=jn.isJSONType=void 0;var oE=["string","number","integer","boolean","null","object","array"],iE=new Set(oE);function aE(e){return typeof e=="string"&&iE.has(e)}jn.isJSONType=aE;function sE(){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:{}}}jn.getRules=sE});var tf=I(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.shouldUseRule=gr.shouldUseGroup=gr.schemaHasRulesForType=void 0;function cE({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&sb(e,n)}gr.schemaHasRulesForType=cE;function sb(e,t){return t.rules.some(r=>cb(e,r))}gr.shouldUseGroup=sb;function cb(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))}gr.shouldUseRule=cb});var Ti=I(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.reportTypeError=Ue.checkDataTypes=Ue.checkDataType=Ue.coerceAndCheckDataType=Ue.getJSONTypes=Ue.getSchemaTypes=Ue.DataType=void 0;var uE=ef(),lE=tf(),dE=Ii(),K=H(),ub=ne(),Nn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Nn||(Ue.DataType=Nn={}));function pE(e){let t=lb(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}Ue.getSchemaTypes=pE;function lb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(uE.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ue.getJSONTypes=lb;function mE(e,t){let{gen:r,data:n,opts:o}=e,i=fE(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,lE.schemaHasRulesForType)(e,t[0]));if(a){let s=nf(t,n,o.strictNumbers,Nn.Wrong);r.if(s,()=>{i.length?hE(e,t,i):of(e)})}return a}Ue.coerceAndCheckDataType=mE;var db=new Set(["string","number","integer","boolean","null"]);function fE(e,t){return t?e.filter(r=>db.has(r)||t==="array"&&r==="array"):[]}function hE(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(nf(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,K._)`${s} !== undefined`);for(let u of r)(db.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),of(e),n.endIf(),n.if((0,K._)`${s} !== undefined`,()=>{n.assign(o,s),gE(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
1493
1496
  || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,K._)`+${o}`);return;case"integer":n.elseIf((0,K._)`${a} === "boolean" || ${o} === null
1494
1497
  || (${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"
1495
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function yE({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=An.Correct){let o=n===An.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===An.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,cb.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 _E={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,mE.reportError)(t,_E)}Ce.reportTypeError=af;function $E(e){let{gen:t,data:r,schema:n}=e,o=(0,cb.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var pb=I(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.assignDefaults=void 0;var Un=H(),bE=ne();function xE(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)db(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>db(e,i,o.default))}Ws.assignDefaults=xE;function db(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,Un._)`${i}${(0,Un.getProperty)(t)}`;if(o){(0,bE.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,Un._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,Un._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,Un._)`${s} = ${(0,Un.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(),vr=Yt(),kE=ne();function wE(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=wE;function SE({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=SE;function zE(e,t){e.setParams({missingProperty:t},!0),e.error()}ue.reportMissingProp=zE;function mb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}ue.hasPropFunc=mb;function cf(e,t,r){return(0,ve._)`${mb(e)}.call(${t}, ${r})`}ue.isOwnProperty=cf;function IE(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=IE;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 fb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ue.allSchemaProperties=fb;function TE(e,t){return fb(t).filter(r=>!(0,sf.alwaysValidSchema)(e,t[r]))}ue.schemaProperties=TE;function EE({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=[[vr.default.instancePath,(0,ve.strConcat)(vr.default.instancePath,i)],[vr.default.parentData,a.parentData],[vr.default.parentDataProperty,a.parentDataProperty],[vr.default.rootData,vr.default.rootData]];a.opts.dynamicRef&&d.push([vr.default.dynamicAnchors,vr.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=EE;var PE=(0,ve._)`new RegExp`;function OE({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"?PE:(0,kE.useFunc)(e,o)}(${r}, ${n})`})}ue.usePattern=OE;function jE(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=jE;function NE(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=NE});var vb=I(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;var Ke=H(),Lr=Yt(),RE=gt(),DE=Oi();function ZE(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=gb(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=ZE;function AE(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;CE(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=gb(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&&hb(e),_(()=>e.error());else{let x=t.async?m():g();t.modifying&&hb(e),_(()=>UE(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?Lr.default.this:Lr.default.self,P=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${x}${(0,RE.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=AE;function hb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ke._)`${n.parentData}[${n.parentDataProperty}]`))}function UE(e,t){let{gen:r}=e;r.if((0,Ke._)`Array.isArray(${t})`,()=>{r.assign(Lr.default.vErrors,(0,Ke._)`${Lr.default.vErrors} === null ? ${t} : ${Lr.default.vErrors}.concat(${t})`).assign(Lr.default.errors,(0,Ke._)`${Lr.default.vErrors}.length`),(0,DE.extendErrors)(e)},()=>e.error())}function CE({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function gb(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 ME(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=ME;function LE({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=LE});var _b=I(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendSubschemaMode=yr.extendSubschemaData=yr.getSubschema=void 0;var Rt=H(),yb=ne();function qE(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,yb.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')}yr.getSubschema=qE;function FE(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,yb.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]}}yr.extendSubschemaData=FE;function VE(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}yr.extendSubschemaMode=VE});var lf=I((gL,$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 xb=I((vL,bb)=>{"use strict";var _r=bb.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(){};Xs(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 Xs(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++)Xs(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)Xs(e,t,r,d[m],o+"/"+l+"/"+JE(m),i,o,l,n,m)}else(l in _r.keywords||e.allKeys&&!(l in _r.skipKeywords))&&Xs(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function JE(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ni=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 BE=ne(),GE=lf(),KE=xb(),HE=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function WE(e,t=!0){return typeof e=="boolean"?!0:t===!0?!df(e):t?kb(e)<=t:!1}Qe.inlineRef=WE;var XE=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function df(e){for(let t in e){if(XE.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 kb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!HE.has(r)&&(typeof e[r]=="object"&&(0,BE.eachItem)(e[r],n=>t+=kb(n)),t===1/0))return 1/0}return t}function wb(e,t="",r){r!==!1&&(t=Cn(t));let n=e.parse(t);return Sb(e,n)}Qe.getFullPath=wb;function Sb(e,t){return e.serialize(t).split("#")[0]+"#"}Qe._getFullPath=Sb;var YE=/#\/?$/;function Cn(e){return e?e.replace(YE,""):""}Qe.normalizeId=Cn;function QE(e,t,r){return r=Cn(r),e.resolve(t,r)}Qe.resolveUrl=QE;var eP=/^[a-z_][-a-z0-9._]*$/i;function tP(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Cn(e[r]||t),i={"":o},a=wb(n,o,!1),s={},c=new Set;return KE(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=Cn(_?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!==Cn(y)&&(P[0]==="#"?(u(d,s[P],P),s[P]=d):this.refs[P]=y),P}function j(P){if(typeof P=="string"){if(!eP.test(P))throw new Error(`invalid anchor "${P}"`);x.call(this,`#${P}`)}}}),s;function u(d,p,m){if(p!==void 0&&!GE(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Qe.getSchemaRefs=tP});var Zi=I($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getData=$r.KeywordCxt=$r.validateFunctionCode=void 0;var Pb=ib(),zb=ji(),mf=rf(),Ys=ji(),rP=pb(),Di=vb(),pf=_b(),D=H(),q=Yt(),nP=Ni(),Qt=ne(),Ri=Oi();function oP(e){if(Nb(e)&&(Rb(e),jb(e))){sP(e);return}Ob(e,()=>(0,Pb.topBoolOrEmptySchema)(e))}$r.validateFunctionCode=oP;function Ob({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"; ${Ib(r,o)}`),aP(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${iP(o)}`,n.$async,()=>e.code(Ib(r,o)).code(i))}function iP(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 aP(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 sP(e){let{schema:t,opts:r,gen:n}=e;Ob(e,()=>{r.$comment&&t.$comment&&Zb(e),pP(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&cP(e),Db(e),hP(e)})}function cP(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 Ib(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 uP(e,t){if(Nb(e)&&(Rb(e),jb(e))){lP(e,t);return}(0,Pb.boolOrEmptySchema)(e,t)}function jb({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 Nb(e){return typeof e.schema!="boolean"}function lP(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Zb(e),mP(e),fP(e);let i=n.const("_errs",q.default.errors);Db(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function Rb(e){(0,Qt.checkUnknownRules)(e),dP(e)}function Db(e,t){if(e.opts.jtd)return Tb(e,[],!1,t);let r=(0,zb.getSchemaTypes)(e.schema),n=(0,zb.coerceAndCheckDataType)(e,r);Tb(e,r,!n,t)}function dP(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 pP(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 mP(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,nP.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function fP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Zb({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 hP(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&&gP(e),t.return((0,D._)`${q.default.errors} === 0`))}function gP({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 Tb(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(()=>Ub(e,"$ref",l.all.$ref.definition));return}c.jtd||vP(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,Ys.checkDataType)(p.type,a,c.strictNumbers)),Eb(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Ys.reportTypeError)(e)),o.endIf()):Eb(e,p),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Eb(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,rP.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,mf.shouldUseRule)(n,i)&&Ub(e,i.keyword,i.definition,t.type)})}function vP(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(yP(e,t),e.opts.allowUnionTypes||_P(e,t),$P(e,e.dataTypes))}function yP(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Ab(e.dataTypes,r)||ff(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),xP(e,t)}}function _P(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=>bP(t,a))&&ff(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function bP(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Ab(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function xP(e,t){let r=[];for(let n of e.dataTypes)Ab(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 Qs=class{constructor(t,r,n){if((0,Di.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",Cb(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Di.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?Ri.reportExtraError:Ri.reportError)(this,this.def.error,r)}$dataError(){(0,Ri.reportError)(this,this.def.$dataError||Ri.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ri.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,Ys.checkDataTypes)(c,r,i.opts.strictNumbers,Ys.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 uP(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}};$r.KeywordCxt=Qs;function Ub(e,t,r,n){let o=new Qs(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Di.funcKeywordCode)(o,r):"macro"in r?(0,Di.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Di.funcKeywordCode)(o,r)}var kP=/^\/(?:[^~]|~0|~1)*$/,wP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Cb(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!kP.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=wP.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}`}}$r.getData=Cb});var ec=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 Ai=I(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var vf=Ni(),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 rc=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(),SP=ec(),qr=Yt(),zt=Ni(),Mb=ne(),zP=Zi(),Mn=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=Mn;function bf(e){let t=Lb.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:SP.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:qr.default.data,parentData:qr.default.parentData,parentDataProperty:qr.default.parentDataProperty,dataNames:[qr.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,zP.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(qr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${qr.default.self}`,`${qr.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 IP(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=PP.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 Mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=TP.call(this,i)}vt.resolveRef=IP;function TP(e){return(0,zt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bf.call(this,e)}function Lb(e){for(let t of this._compilations)if(EP(t,e))return t}vt.getCompilingSchema=Lb;function EP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function PP(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||tc.call(this,e,t)}function tc(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=tc.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 Mn({schema:s,schemaId:c,root:e,baseId:o})}return $f.call(this,r,a)}}vt.resolveSchema=tc;var OP=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,Mb.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!OP.has(s)&&u&&(t=(0,zt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Mb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,zt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=tc.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new Mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var qb=I((kL,jP)=>{jP.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((wL,Bb)=>{"use strict";var NP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Vb=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 RP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Fb(e){return e.length=0,!0}function DP(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 ZP(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=DP;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=Fb}else{o.push(u);continue}}return o.length&&(s===Fb?r.zone=o.join(""):a?n.push(o.join("")):n.push(xf(o))),r.address=n.join(""),r}function Jb(e){if(AP(e,":")<2)return{host:e,isIPV6:!1};let t=ZP(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 AP(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function UP(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 CP(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 MP(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Vb(r)){let n=Jb(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}Bb.exports={nonSimpleDomain:RP,recomposeAuthority:MP,normalizeComponentEncoding:CP,removeDotSegments:UP,isIPv4:Vb,isUUID:NP,normalizeIPv6:Jb,stringArrayToHexStripped:xf}});var Xb=I((SL,Wb)=>{"use strict";var{isUUID:LP}=kf(),qP=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,FP=["http","https","ws","wss","urn","urn:uuid"];function VP(e){return FP.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 Gb(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Kb(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 JP(e){return e.secure=wf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function BP(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 GP(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(qP);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 KP(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 HP(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!LP(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function WP(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Hb={scheme:"http",domainHost:!0,parse:Gb,serialize:Kb},XP={scheme:"https",domainHost:Hb.domainHost,parse:Gb,serialize:Kb},nc={scheme:"ws",domainHost:!0,parse:JP,serialize:BP},YP={scheme:"wss",domainHost:nc.domainHost,parse:nc.parse,serialize:nc.serialize},QP={scheme:"urn",parse:GP,serialize:KP,skipNormalize:!0},eO={scheme:"urn:uuid",parse:HP,serialize:WP,skipNormalize:!0},oc={http:Hb,https:XP,ws:nc,wss:YP,urn:QP,"urn:uuid":eO};Object.setPrototypeOf(oc,null);function Sf(e){return e&&(oc[e]||oc[e.toLowerCase()])||void 0}Wb.exports={wsIsSecure:wf,SCHEMES:oc,isValidSchemeName:VP,getSchemeHandler:Sf}});var ex=I((zL,ac)=>{"use strict";var{normalizeIPv6:tO,removeDotSegments:Ui,recomposeAuthority:rO,normalizeComponentEncoding:ic,isIPv4:nO,nonSimpleDomain:oO}=kf(),{SCHEMES:iO,getSchemeHandler:Yb}=Xb();function aO(e,t){return typeof e=="string"?e=Dt(er(e,t),t):typeof e=="object"&&(e=er(Dt(e,t),t)),e}function sO(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Qb(er(e,n),er(t,n),n,!0);return n.skipEscape=!0,Dt(o,n)}function Qb(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=Ui(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=Ui(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Ui(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=Ui(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 cO(e,t,r){return typeof e=="string"?(e=unescape(e),e=Dt(ic(er(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Dt(ic(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Dt(ic(er(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Dt(ic(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=Yb(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=rO(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=Ui(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 uO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(uO);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(nO(n.host)===!1){let c=tO(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=Yb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&oO(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:iO,normalize:aO,resolve:sO,resolveComponent:Qb,equal:cO,serialize:Dt,parse:er};ac.exports=zf;ac.exports.default=zf;ac.exports.fastUri=zf});var rx=I(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var tx=ex();tx.code='require("ajv/dist/runtime/uri").default';If.default=tx});var lx=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 lO=Zi();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return lO.KeywordCxt}});var Ln=H();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Ln._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Ln.str}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Ln.stringify}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Ln.nil}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Ln.Name}});Object.defineProperty(je,"CodeGen",{enumerable:!0,get:function(){return Ln.CodeGen}});var dO=ec(),sx=Ai(),pO=tf(),Ci=rc(),mO=H(),Mi=Ni(),sc=ji(),Ef=ne(),nx=qb(),fO=rx(),cx=(e,t)=>new RegExp(e,t);cx.code="new RegExp";var hO=["removeAdditional","useDefaults","coerceTypes"],gO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vO={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."},yO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ox=200;function _O(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,kr=(t=e.code)===null||t===void 0?void 0:t.optimize,Gr=kr===!0||kr===void 0?1:kr||0,tr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:cx,Yi=(o=e.uriResolver)!==null&&o!==void 0?o:fO.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:Gr,regExp:tr}:{optimize:Gr,regExp:tr},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:ox,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:ox,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:Yi}}var Li=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,..._O(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new mO.ValueScope({scope:{},prefixes:gO,es5:r,lines:n}),this.logger=SO(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,pO.getRules)(),ix.call(this,vO,t,"NOT SUPPORTED"),ix.call(this,yO,t,"DEPRECATED","warn"),this._metaOpts=kO.call(this),t.formats&&bO.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&xO.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=nx;n==="id"&&(o={...nx},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 sx.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,Mi.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=ax.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ci.SchemaEnv({schema:{},schemaId:n});if(r=Ci.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=ax.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,Mi.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(IO.call(this,n,r),!r)return(0,Ef.eachItem)(n,i=>Tf.call(this,i)),this;EO.call(this,r);let o={...r,type:(0,sc.getJSONTypes)(r.type),schemaType:(0,sc.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]=ux(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,Mi.normalizeId)(a||n);let u=Mi.getSchemaRefs.call(this,t,n);return c=new Ci.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):Ci.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{Ci.compileSchema.call(this,t)}finally{this.opts=r}}};Li.ValidationError=dO.default;Li.MissingRefError=sx.default;je.default=Li;function ix(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 ax(e){return e=(0,Mi.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 bO(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function xO(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 kO(){let e={...this.opts};for(let t of hO)delete e[t];return e}var wO={log(){},warn(){},error(){}};function SO(e){if(e===!1)return wO;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 zO=/^[a-z_$][a-z0-9_$:-]*$/i;function IO(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(!zO.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,sc.getJSONTypes)(t.type),schemaType:(0,sc.getJSONTypes)(t.schemaType)}};t.before?TO.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 TO(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 EO(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ux(t)),e.validateSchema=this.compile(t,!0))}var PO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ux(e){return{anyOf:[e,PO]}}});var dx=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var OO={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pf.default=OO});var hx=I(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.callRef=Fr.getValidate=void 0;var jO=Ai(),px=gt(),et=H(),qn=Yt(),mx=rc(),cc=ne(),NO={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=mx.resolveRef.call(c,u,o,r);if(l===void 0)throw new jO.default(n.opts.uriResolver,o,r);if(l instanceof mx.SchemaEnv)return p(l);return m(l);function d(){if(i===u)return uc(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return uc(e,(0,et._)`${g}.validate`,u,u.$async)}function p(g){let y=fx(e,g);uc(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 fx(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,et._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Fr.getValidate=fx;function uc(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?qn.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,px.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,px.callValidateCode)(e,t,u),()=>m(t),()=>p(t))}function p(g){let y=(0,et._)`${g}.errors`;o.assign(qn.default.vErrors,(0,et._)`${qn.default.vErrors} === null ? ${y} : ${qn.default.vErrors}.concat(${y})`),o.assign(qn.default.errors,(0,et._)`${qn.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=cc.mergeEvaluated.props(o,_.props,i.props));else{let x=o.var("props",(0,et._)`${g}.evaluated.props`);i.props=cc.mergeEvaluated.props(o,x,i.props,et.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=cc.mergeEvaluated.items(o,_.items,i.items));else{let x=o.var("items",(0,et._)`${g}.evaluated.items`);i.items=cc.mergeEvaluated.items(o,x,i.items,et.Name)}}}Fr.callRef=uc;Fr.default=NO});var gx=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var RO=dx(),DO=hx(),ZO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",RO.default,DO.default];Of.default=ZO});var vx=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var lc=H(),br=lc.operators,dc={maximum:{okStr:"<=",ok:br.LTE,fail:br.GT},minimum:{okStr:">=",ok:br.GTE,fail:br.LT},exclusiveMaximum:{okStr:"<",ok:br.LT,fail:br.GTE},exclusiveMinimum:{okStr:">",ok:br.GT,fail:br.LTE}},AO={message:({keyword:e,schemaCode:t})=>(0,lc.str)`must be ${dc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,lc._)`{comparison: ${dc[e].okStr}, limit: ${t}}`},UO={keyword:Object.keys(dc),type:"number",schemaType:"number",$data:!0,error:AO,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,lc._)`${r} ${dc[t].fail} ${n} || isNaN(${r})`)}};jf.default=UO});var yx=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var qi=H(),CO={message:({schemaCode:e})=>(0,qi.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,qi._)`{multipleOf: ${e}}`},MO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:CO,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,qi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,qi._)`${a} !== parseInt(${a})`;e.fail$data((0,qi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Nf.default=MO});var $x=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});function _x(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=_x;_x.code='require("ajv/dist/runtime/ucs2length").default'});var bx=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var Vr=H(),LO=ne(),qO=$x(),FO={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Vr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Vr._)`{limit: ${e}}`},VO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:FO,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Vr.operators.GT:Vr.operators.LT,a=o.opts.unicode===!1?(0,Vr._)`${r}.length`:(0,Vr._)`${(0,LO.useFunc)(e.gen,qO.default)}(${r})`;e.fail$data((0,Vr._)`${a} ${i} ${n}`)}};Df.default=VO});var xx=I(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var JO=gt(),BO=ne(),Fn=H(),GO={message:({schemaCode:e})=>(0,Fn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Fn._)`{pattern: ${e}}`},KO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:GO,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,Fn._)`new RegExp`:(0,BO.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Fn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,Fn._)`!${l}`)}else{let c=(0,JO.usePattern)(e,o);e.fail$data((0,Fn._)`!${c}.test(${r})`)}}};Zf.default=KO});var kx=I(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});var Fi=H(),HO={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Fi.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Fi._)`{limit: ${e}}`},WO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:HO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Fi.operators.GT:Fi.operators.LT;e.fail$data((0,Fi._)`Object.keys(${r}).length ${o} ${n}`)}};Af.default=WO});var wx=I(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var Vi=gt(),Ji=H(),XO=ne(),YO={message:({params:{missingProperty:e}})=>(0,Ji.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ji._)`{missingProperty: ${e}}`},QO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:YO,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,XO.checkStrictMode)(a,x,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Ji.nil,d);else for(let m of r)(0,Vi.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,Vi.checkMissingProp)(e,r,m)),(0,Vi.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,Vi.noPropertyInData)(t,o,m,s.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(g,(0,Vi.propertyInData)(t,o,m,s.ownProperties)),t.if((0,Ji.not)(g),()=>{e.error(),t.break()})},Ji.nil)}}};Uf.default=QO});var Sx=I(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var Bi=H(),ej={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Bi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Bi._)`{limit: ${e}}`},tj={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ej,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Bi.operators.GT:Bi.operators.LT;e.fail$data((0,Bi._)`${r}.length ${o} ${n}`)}};Cf.default=tj});var pc=I(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var zx=lf();zx.code='require("ajv/dist/runtime/equal").default';Mf.default=zx});var Ix=I(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});var Lf=ji(),Ne=H(),rj=ne(),nj=pc(),oj={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}}`},ij={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:oj,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,rj.useFunc)(t,nj.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=ij});var Tx=I(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});var Ff=H(),aj=ne(),sj=pc(),cj={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ff._)`{allowedValue: ${e}}`},uj={keyword:"const",$data:!0,error:cj,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,aj.useFunc)(t,sj.default)}(${r}, ${o})`):e.fail((0,Ff._)`${i} !== ${r}`)}};Vf.default=uj});var Ex=I(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var Gi=H(),lj=ne(),dj=pc(),pj={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Gi._)`{allowedValues: ${e}}`},mj={keyword:"enum",schemaType:"array",$data:!0,error:pj,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,lj.useFunc)(t,dj.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,Gi.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,Gi._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function p(m,g){let y=o[g];return typeof y=="object"&&y!==null?(0,Gi._)`${u()}(${r}, ${m}[${g}])`:(0,Gi._)`${r} === ${y}`}}};Jf.default=mj});var Px=I(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});var fj=vx(),hj=yx(),gj=bx(),vj=xx(),yj=kx(),_j=wx(),$j=Sx(),bj=Ix(),xj=Tx(),kj=Ex(),wj=[fj.default,hj.default,gj.default,vj.default,yj.default,_j.default,$j.default,bj.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},xj.default,kj.default];Bf.default=wj});var Kf=I(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.validateAdditionalItems=void 0;var Jr=H(),Gf=ne(),Sj={message:({params:{len:e}})=>(0,Jr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Jr._)`{limit: ${e}}`},zj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Sj,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}Ox(e,n)}};function Ox(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Jr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Jr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Gf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Jr._)`${s} <= ${t.length}`);r.if((0,Jr.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,Jr.not)(u),()=>r.break())})}}Ki.validateAdditionalItems=Ox;Ki.default=zj});var Hf=I(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateTuple=void 0;var jx=H(),mc=ne(),Ij=gt(),Tj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Nx(e,"additionalItems",t);r.items=!0,!(0,mc.alwaysValidSchema)(r,t)&&e.ok((0,Ij.validateArray)(e))}};function Nx(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=mc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,jx._)`${i}.length`);r.forEach((d,p)=>{(0,mc.alwaysValidSchema)(s,d)||(n.if((0,jx._)`${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,mc.checkStrictMode)(s,_,p.strictTuples)}}}Hi.validateTuple=Nx;Hi.default=Tj});var Rx=I(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var Ej=Hf(),Pj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Ej.validateTuple)(e,"items")};Wf.default=Pj});var Zx=I(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var Dx=H(),Oj=ne(),jj=gt(),Nj=Kf(),Rj={message:({params:{len:e}})=>(0,Dx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Dx._)`{limit: ${e}}`},Dj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Rj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Oj.alwaysValidSchema)(n,t)&&(o?(0,Nj.validateAdditionalItems)(e,o):e.ok((0,jj.validateArray)(e)))}};Xf.default=Dj});var Ax=I(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});var yt=H(),fc=ne(),Zj={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}}`},Aj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Zj,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,fc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,fc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,fc.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:fc.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=Aj});var Mx=I(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.validateSchemaDeps=Zt.validatePropertyDeps=Zt.error=void 0;var Qf=H(),Uj=ne(),Wi=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},
1498
+ || ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function gE({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,K._)`${t} !== undefined`,()=>e.assign((0,K._)`${t}[${r}]`,n))}function rf(e,t,r,n=Nn.Correct){let o=n===Nn.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===Nn.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)}}Ue.checkDataType=rf;function nf(e,t,r,n){if(e.length===1)return rf(e[0],t,r,n);let o,i=(0,ub.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,rf(a,t,r,n));return o}Ue.checkDataTypes=nf;var vE={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,K._)`{type: ${e}}`:(0,K._)`{type: ${t}}`};function of(e){let t=yE(e);(0,dE.reportError)(t,vE)}Ue.reportTypeError=of;function yE(e){let{gen:t,data:r,schema:n}=e,o=(0,ub.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var mb=I(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.assignDefaults=void 0;var Rn=H(),_E=ne();function $E(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)pb(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>pb(e,i,o.default))}Js.assignDefaults=$E;function pb(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,Rn._)`${i}${(0,Rn.getProperty)(t)}`;if(o){(0,_E.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,Rn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,Rn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,Rn._)`${s} = ${(0,Rn.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(),af=ne(),vr=Yt(),bE=ne();function xE(e,t){let{gen:r,data:n,it:o}=e;r.if(cf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ve._)`${t}`},!0),e.error()})}ue.checkReportMissingProp=xE;function kE({gen:e,data:t,it:{opts:r}},n,o){return(0,ve.or)(...n.map(i=>(0,ve.and)(cf(e,t,i,r.ownProperties),(0,ve._)`${o} = ${i}`)))}ue.checkMissingProp=kE;function wE(e,t){e.setParams({missingProperty:t},!0),e.error()}ue.reportMissingProp=wE;function fb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}ue.hasPropFunc=fb;function sf(e,t,r){return(0,ve._)`${fb(e)}.call(${t}, ${r})`}ue.isOwnProperty=sf;function SE(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} !== undefined`;return n?(0,ve._)`${o} && ${sf(e,t,r)}`:o}ue.propertyInData=SE;function cf(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} === undefined`;return n?(0,ve.or)(o,(0,ve.not)(sf(e,t,r))):o}ue.noPropertyInData=cf;function hb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ue.allSchemaProperties=hb;function zE(e,t){return hb(t).filter(r=>!(0,af.alwaysValidSchema)(e,t[r]))}ue.schemaProperties=zE;function IE({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=[[vr.default.instancePath,(0,ve.strConcat)(vr.default.instancePath,i)],[vr.default.parentData,a.parentData],[vr.default.parentDataProperty,a.parentDataProperty],[vr.default.rootData,vr.default.rootData]];a.opts.dynamicRef&&d.push([vr.default.dynamicAnchors,vr.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=IE;var TE=(0,ve._)`new RegExp`;function EE({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"?TE:(0,bE.useFunc)(e,o)}(${r}, ${n})`})}ue.usePattern=EE;function PE(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:af.Type.Num},i),t.if((0,ve.not)(i),s)})}}ue.validateArray=PE;function OE(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,af.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=OE});var yb=I(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;var Ke=H(),Mr=Yt(),jE=gt(),NE=Ii();function RE(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=vb(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=RE;function DE(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;ZE(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=vb(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&&gb(e),_(()=>e.error());else{let x=t.async?m():g();t.modifying&&gb(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?Mr.default.this:Mr.default.self,P=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${x}${(0,jE.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=DE;function gb(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(Mr.default.vErrors,(0,Ke._)`${Mr.default.vErrors} === null ? ${t} : ${Mr.default.vErrors}.concat(${t})`).assign(Mr.default.errors,(0,Ke._)`${Mr.default.vErrors}.length`),(0,NE.extendErrors)(e)},()=>e.error())}function ZE({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function vb(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 UE({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=UE});var $b=I(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendSubschemaMode=yr.extendSubschemaData=yr.getSubschema=void 0;var Rt=H(),_b=ne();function ME(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,_b.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')}yr.getSubschema=ME;function LE(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,_b.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]}}yr.extendSubschemaData=LE;function qE(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}yr.extendSubschemaMode=qE});var uf=I((_L,bb)=>{"use strict";bb.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 kb=I(($L,xb)=>{"use strict";var _r=xb.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(){};Bs(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 Bs(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++)Bs(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)Bs(e,t,r,d[m],o+"/"+l+"/"+FE(m),i,o,l,n,m)}else(l in _r.keywords||e.allKeys&&!(l in _r.skipKeywords))&&Bs(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function FE(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ei=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 VE=ne(),JE=uf(),BE=kb(),GE=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function KE(e,t=!0){return typeof e=="boolean"?!0:t===!0?!lf(e):t?wb(e)<=t:!1}Qe.inlineRef=KE;var HE=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function lf(e){for(let t in e){if(HE.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(lf)||typeof r=="object"&&lf(r))return!0}return!1}function wb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!GE.has(r)&&(typeof e[r]=="object"&&(0,VE.eachItem)(e[r],n=>t+=wb(n)),t===1/0))return 1/0}return t}function Sb(e,t="",r){r!==!1&&(t=Dn(t));let n=e.parse(t);return zb(e,n)}Qe.getFullPath=Sb;function zb(e,t){return e.serialize(t).split("#")[0]+"#"}Qe._getFullPath=zb;var WE=/#\/?$/;function Dn(e){return e?e.replace(WE,""):""}Qe.normalizeId=Dn;function XE(e,t,r){return r=Dn(r),e.resolve(t,r)}Qe.resolveUrl=XE;var YE=/^[a-z_][-a-z0-9._]*$/i;function QE(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Dn(e[r]||t),i={"":o},a=Sb(n,o,!1),s={},c=new Set;return BE(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=Dn(_?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!==Dn(y)&&(P[0]==="#"?(u(d,s[P],P),s[P]=d):this.refs[P]=y),P}function j(P){if(typeof P=="string"){if(!YE.test(P))throw new Error(`invalid anchor "${P}"`);x.call(this,`#${P}`)}}}),s;function u(d,p,m){if(p!==void 0&&!JE(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Qe.getSchemaRefs=QE});var ji=I($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getData=$r.KeywordCxt=$r.validateFunctionCode=void 0;var Ob=ab(),Ib=Ti(),pf=tf(),Gs=Ti(),eP=mb(),Oi=yb(),df=$b(),D=H(),q=Yt(),tP=Ei(),Qt=ne(),Pi=Ii();function rP(e){if(Rb(e)&&(Db(e),Nb(e))){iP(e);return}jb(e,()=>(0,Ob.topBoolOrEmptySchema)(e))}$r.validateFunctionCode=rP;function jb({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"; ${Tb(r,o)}`),oP(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${nP(o)}`,n.$async,()=>e.code(Tb(r,o)).code(i))}function nP(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 oP(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 iP(e){let{schema:t,opts:r,gen:n}=e;jb(e,()=>{r.$comment&&t.$comment&&Zb(e),lP(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&aP(e),Ab(e),mP(e)})}function aP(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 Tb(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 sP(e,t){if(Rb(e)&&(Db(e),Nb(e))){cP(e,t);return}(0,Ob.boolOrEmptySchema)(e,t)}function Nb({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 Rb(e){return typeof e.schema!="boolean"}function cP(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Zb(e),dP(e),pP(e);let i=n.const("_errs",q.default.errors);Ab(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function Db(e){(0,Qt.checkUnknownRules)(e),uP(e)}function Ab(e,t){if(e.opts.jtd)return Eb(e,[],!1,t);let r=(0,Ib.getSchemaTypes)(e.schema),n=(0,Ib.coerceAndCheckDataType)(e,r);Eb(e,r,!n,t)}function uP(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 lP(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 dP(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,tP.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function pP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Zb({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 mP(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&&fP(e),t.return((0,D._)`${q.default.errors} === 0`))}function fP({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 Eb(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(()=>Ub(e,"$ref",l.all.$ref.definition));return}c.jtd||hP(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,pf.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Gs.checkDataType)(p.type,a,c.strictNumbers)),Pb(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Gs.reportTypeError)(e)),o.endIf()):Pb(e,p),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Pb(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,eP.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,pf.shouldUseRule)(n,i)&&Ub(e,i.keyword,i.definition,t.type)})}function hP(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(gP(e,t),e.opts.allowUnionTypes||vP(e,t),yP(e,e.dataTypes))}function gP(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Cb(e.dataTypes,r)||mf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),$P(e,t)}}function vP(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&mf(e,"use allowUnionTypes to allow union type keyword")}function yP(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,pf.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>_P(t,a))&&mf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function _P(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Cb(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function $P(e,t){let r=[];for(let n of e.dataTypes)Cb(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function mf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Qt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ks=class{constructor(t,r,n){if((0,Oi.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",Mb(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Oi.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?Pi.reportExtraError:Pi.reportError)(this,this.def.error,r)}$dataError(){(0,Pi.reportError)(this,this.def.$dataError||Pi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Pi.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,Gs.checkDataTypes)(c,r,i.opts.strictNumbers,Gs.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,df.getSubschema)(this.it,t);(0,df.extendSubschemaData)(n,this.it,t),(0,df.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return sP(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}};$r.KeywordCxt=Ks;function Ub(e,t,r,n){let o=new Ks(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Oi.funcKeywordCode)(o,r):"macro"in r?(0,Oi.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Oi.funcKeywordCode)(o,r)}var bP=/^\/(?:[^~]|~0|~1)*$/,xP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Mb(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!bP.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=xP.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}`}}$r.getData=Mb});var Hs=I(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var ff=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};hf.default=ff});var Ni=I(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var gf=Ei(),vf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,gf.resolveUrl)(t,r,n),this.missingSchema=(0,gf.normalizeId)((0,gf.getFullPath)(t,this.missingRef))}};yf.default=vf});var Xs=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(),kP=Hs(),Lr=Yt(),zt=Ei(),Lb=ne(),wP=ji(),An=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=An;function $f(e){let t=qb.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:kP.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:Lr.default.data,parentData:Lr.default.parentData,parentDataProperty:Lr.default.parentDataProperty,dataNames:[Lr.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,wP.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Lr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Lr.default.self}`,`${Lr.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=$f;function SP(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=TP.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 An({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=zP.call(this,i)}vt.resolveRef=SP;function zP(e){return(0,zt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:$f.call(this,e)}function qb(e){for(let t of this._compilations)if(IP(t,e))return t}vt.getCompilingSchema=qb;function IP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function TP(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ws.call(this,e,t)}function Ws(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=Ws.call(this,e,a);return typeof s?.schema!="object"?void 0:_f.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||$f.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 An({schema:s,schemaId:c,root:e,baseId:o})}return _f.call(this,r,a)}}vt.resolveSchema=Ws;var EP=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,Lb.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!EP.has(s)&&u&&(t=(0,zt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Lb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,zt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Ws.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new An({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Fb=I((zL,PP)=>{PP.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 xf=I((IL,Gb)=>{"use strict";var OP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Jb=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 bf(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 jP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Vb(e){return e.length=0,!0}function NP(e,t,r){if(e.length){let n=bf(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function RP(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=NP;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=Vb}else{o.push(u);continue}}return o.length&&(s===Vb?r.zone=o.join(""):a?n.push(o.join("")):n.push(bf(o))),r.address=n.join(""),r}function Bb(e){if(DP(e,":")<2)return{host:e,isIPV6:!1};let t=RP(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 DP(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 ZP(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(!Jb(r)){let n=Bb(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}Gb.exports={nonSimpleDomain:jP,recomposeAuthority:CP,normalizeComponentEncoding:ZP,removeDotSegments:AP,isIPv4:Jb,isUUID:OP,normalizeIPv6:Bb,stringArrayToHexStripped:bf}});var Yb=I((TL,Xb)=>{"use strict";var{isUUID:UP}=xf(),MP=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,LP=["http","https","ws","wss","urn","urn:uuid"];function qP(e){return LP.indexOf(e)!==-1}function kf(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 Kb(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Hb(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 FP(e){return e.secure=kf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function VP(e){if((e.port===(kf(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 JP(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(MP);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=wf(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function BP(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=wf(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 GP(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!UP(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function KP(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Wb={scheme:"http",domainHost:!0,parse:Kb,serialize:Hb},HP={scheme:"https",domainHost:Wb.domainHost,parse:Kb,serialize:Hb},Ys={scheme:"ws",domainHost:!0,parse:FP,serialize:VP},WP={scheme:"wss",domainHost:Ys.domainHost,parse:Ys.parse,serialize:Ys.serialize},XP={scheme:"urn",parse:JP,serialize:BP,skipNormalize:!0},YP={scheme:"urn:uuid",parse:GP,serialize:KP,skipNormalize:!0},Qs={http:Wb,https:HP,ws:Ys,wss:WP,urn:XP,"urn:uuid":YP};Object.setPrototypeOf(Qs,null);function wf(e){return e&&(Qs[e]||Qs[e.toLowerCase()])||void 0}Xb.exports={wsIsSecure:kf,SCHEMES:Qs,isValidSchemeName:qP,getSchemeHandler:wf}});var tx=I((EL,tc)=>{"use strict";var{normalizeIPv6:QP,removeDotSegments:Ri,recomposeAuthority:eO,normalizeComponentEncoding:ec,isIPv4:tO,nonSimpleDomain:rO}=xf(),{SCHEMES:nO,getSchemeHandler:Qb}=Yb();function oO(e,t){return typeof e=="string"?e=Dt(er(e,t),t):typeof e=="object"&&(e=er(Dt(e,t),t)),e}function iO(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=ex(er(e,n),er(t,n),n,!0);return n.skipEscape=!0,Dt(o,n)}function ex(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=Ri(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=Ri(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Ri(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=Ri(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 aO(e,t,r){return typeof e=="string"?(e=unescape(e),e=Dt(ec(er(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Dt(ec(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Dt(ec(er(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Dt(ec(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=Qb(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=eO(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=Ri(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 sO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(sO);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(tO(n.host)===!1){let c=QP(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=Qb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&rO(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 Sf={SCHEMES:nO,normalize:oO,resolve:iO,resolveComponent:ex,equal:aO,serialize:Dt,parse:er};tc.exports=Sf;tc.exports.default=Sf;tc.exports.fastUri=Sf});var nx=I(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});var rx=tx();rx.code='require("ajv/dist/runtime/uri").default';zf.default=rx});var dx=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 cO=ji();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return cO.KeywordCxt}});var Zn=H();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Zn._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Zn.str}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Zn.stringify}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Zn.nil}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Zn.Name}});Object.defineProperty(je,"CodeGen",{enumerable:!0,get:function(){return Zn.CodeGen}});var uO=Hs(),cx=Ni(),lO=ef(),Di=Xs(),dO=H(),Ai=Ei(),rc=Ti(),Tf=ne(),ox=Fb(),pO=nx(),ux=(e,t)=>new RegExp(e,t);ux.code="new RegExp";var mO=["removeAdditional","useDefaults","coerceTypes"],fO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),hO={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."},gO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ix=200;function vO(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 Ut=e.strict,kr=(t=e.code)===null||t===void 0?void 0:t.optimize,Br=kr===!0||kr===void 0?1:kr||0,tr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:ux,Hi=(o=e.uriResolver)!==null&&o!==void 0?o:pO.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Ut)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Ut)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ut)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Ut)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:Ut)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Br,regExp:tr}:{optimize:Br,regExp:tr},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:ix,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:ix,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:Hi}}var Zi=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...vO(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new dO.ValueScope({scope:{},prefixes:fO,es5:r,lines:n}),this.logger=kO(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,lO.getRules)(),ax.call(this,hO,t,"NOT SUPPORTED"),ax.call(this,gO,t,"DEPRECATED","warn"),this._metaOpts=bO.call(this),t.formats&&_O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&$O.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),yO.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=ox;n==="id"&&(o={...ox},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 cx.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,Ai.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=sx.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Di.SchemaEnv({schema:{},schemaId:n});if(r=Di.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=sx.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,Ai.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(SO.call(this,n,r),!r)return(0,Tf.eachItem)(n,i=>If.call(this,i)),this;IO.call(this,r);let o={...r,type:(0,rc.getJSONTypes)(r.type),schemaType:(0,rc.getJSONTypes)(r.schemaType)};return(0,Tf.eachItem)(n,o.type.length===0?i=>If.call(this,i,o):i=>o.type.forEach(a=>If.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]=lx(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,Ai.normalizeId)(a||n);let u=Ai.getSchemaRefs.call(this,t,n);return c=new Di.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):Di.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{Di.compileSchema.call(this,t)}finally{this.opts=r}}};Zi.ValidationError=uO.default;Zi.MissingRefError=cx.default;je.default=Zi;function ax(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 sx(e){return e=(0,Ai.normalizeId)(e),this.schemas[e]||this.refs[e]}function yO(){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 $O(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 bO(){let e={...this.opts};for(let t of mO)delete e[t];return e}var xO={log(){},warn(){},error(){}};function kO(e){if(e===!1)return xO;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 wO=/^[a-z_$][a-z0-9_$:-]*$/i;function SO(e,t){let{RULES:r}=this;if((0,Tf.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!wO.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 If(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,rc.getJSONTypes)(t.type),schemaType:(0,rc.getJSONTypes)(t.schemaType)}};t.before?zO.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 zO(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 IO(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=lx(t)),e.validateSchema=this.compile(t,!0))}var TO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function lx(e){return{anyOf:[e,TO]}}});var px=I(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});var EO={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ef.default=EO});var gx=I(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.callRef=qr.getValidate=void 0;var PO=Ni(),mx=gt(),et=H(),Cn=Yt(),fx=Xs(),nc=ne(),OO={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=fx.resolveRef.call(c,u,o,r);if(l===void 0)throw new PO.default(n.opts.uriResolver,o,r);if(l instanceof fx.SchemaEnv)return p(l);return m(l);function d(){if(i===u)return oc(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return oc(e,(0,et._)`${g}.validate`,u,u.$async)}function p(g){let y=hx(e,g);oc(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 hx(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,et._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qr.getValidate=hx;function oc(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?Cn.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,mx.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,mx.callValidateCode)(e,t,u),()=>m(t),()=>p(t))}function p(g){let y=(0,et._)`${g}.errors`;o.assign(Cn.default.vErrors,(0,et._)`${Cn.default.vErrors} === null ? ${y} : ${Cn.default.vErrors}.concat(${y})`),o.assign(Cn.default.errors,(0,et._)`${Cn.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=nc.mergeEvaluated.props(o,_.props,i.props));else{let x=o.var("props",(0,et._)`${g}.evaluated.props`);i.props=nc.mergeEvaluated.props(o,x,i.props,et.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=nc.mergeEvaluated.items(o,_.items,i.items));else{let x=o.var("items",(0,et._)`${g}.evaluated.items`);i.items=nc.mergeEvaluated.items(o,x,i.items,et.Name)}}}qr.callRef=oc;qr.default=OO});var vx=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var jO=px(),NO=gx(),RO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",jO.default,NO.default];Pf.default=RO});var yx=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var ic=H(),br=ic.operators,ac={maximum:{okStr:"<=",ok:br.LTE,fail:br.GT},minimum:{okStr:">=",ok:br.GTE,fail:br.LT},exclusiveMaximum:{okStr:"<",ok:br.LT,fail:br.GTE},exclusiveMinimum:{okStr:">",ok:br.GT,fail:br.LTE}},DO={message:({keyword:e,schemaCode:t})=>(0,ic.str)`must be ${ac[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ic._)`{comparison: ${ac[e].okStr}, limit: ${t}}`},AO={keyword:Object.keys(ac),type:"number",schemaType:"number",$data:!0,error:DO,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ic._)`${r} ${ac[t].fail} ${n} || isNaN(${r})`)}};Of.default=AO});var _x=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var Ci=H(),ZO={message:({schemaCode:e})=>(0,Ci.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Ci._)`{multipleOf: ${e}}`},CO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZO,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,Ci._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Ci._)`${a} !== parseInt(${a})`;e.fail$data((0,Ci._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};jf.default=CO});var bx=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});function $x(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}Nf.default=$x;$x.code='require("ajv/dist/runtime/ucs2length").default'});var xx=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});var Fr=H(),UO=ne(),MO=bx(),LO={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Fr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Fr._)`{limit: ${e}}`},qO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:LO,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Fr.operators.GT:Fr.operators.LT,a=o.opts.unicode===!1?(0,Fr._)`${r}.length`:(0,Fr._)`${(0,UO.useFunc)(e.gen,MO.default)}(${r})`;e.fail$data((0,Fr._)`${a} ${i} ${n}`)}};Rf.default=qO});var kx=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var FO=gt(),VO=ne(),Un=H(),JO={message:({schemaCode:e})=>(0,Un.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Un._)`{pattern: ${e}}`},BO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:JO,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,Un._)`new RegExp`:(0,VO.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Un._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,Un._)`!${l}`)}else{let c=(0,FO.usePattern)(e,o);e.fail$data((0,Un._)`!${c}.test(${r})`)}}};Df.default=BO});var wx=I(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});var Ui=H(),GO={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Ui.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Ui._)`{limit: ${e}}`},KO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:GO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Ui.operators.GT:Ui.operators.LT;e.fail$data((0,Ui._)`Object.keys(${r}).length ${o} ${n}`)}};Af.default=KO});var Sx=I(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var Mi=gt(),Li=H(),HO=ne(),WO={message:({params:{missingProperty:e}})=>(0,Li.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Li._)`{missingProperty: ${e}}`},XO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:WO,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,HO.checkStrictMode)(a,x,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Li.nil,d);else for(let m of r)(0,Mi.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,Mi.checkMissingProp)(e,r,m)),(0,Mi.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,Mi.noPropertyInData)(t,o,m,s.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(g,(0,Mi.propertyInData)(t,o,m,s.ownProperties)),t.if((0,Li.not)(g),()=>{e.error(),t.break()})},Li.nil)}}};Zf.default=XO});var zx=I(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var qi=H(),YO={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,qi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,qi._)`{limit: ${e}}`},QO={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:YO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?qi.operators.GT:qi.operators.LT;e.fail$data((0,qi._)`${r}.length ${o} ${n}`)}};Cf.default=QO});var sc=I(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var Ix=uf();Ix.code='require("ajv/dist/runtime/equal").default';Uf.default=Ix});var Tx=I(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});var Mf=Ti(),Ne=H(),ej=ne(),tj=sc(),rj={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}}`},nj={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rj,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,Mf.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,Mf.checkDataTypes)(u,_,s.opts.strictNumbers,Mf.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,ej.useFunc)(t,tj.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)})))}}};Lf.default=nj});var Ex=I(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var qf=H(),oj=ne(),ij=sc(),aj={message:"must be equal to constant",params:({schemaCode:e})=>(0,qf._)`{allowedValue: ${e}}`},sj={keyword:"const",$data:!0,error:aj,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,qf._)`!${(0,oj.useFunc)(t,ij.default)}(${r}, ${o})`):e.fail((0,qf._)`${i} !== ${r}`)}};Ff.default=sj});var Px=I(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});var Fi=H(),cj=ne(),uj=sc(),lj={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Fi._)`{allowedValues: ${e}}`},dj={keyword:"enum",schemaType:"array",$data:!0,error:lj,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,cj.useFunc)(t,uj.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,Fi.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,Fi._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function p(m,g){let y=o[g];return typeof y=="object"&&y!==null?(0,Fi._)`${u()}(${r}, ${m}[${g}])`:(0,Fi._)`${r} === ${y}`}}};Vf.default=dj});var Ox=I(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var pj=yx(),mj=_x(),fj=xx(),hj=kx(),gj=wx(),vj=Sx(),yj=zx(),_j=Tx(),$j=Ex(),bj=Px(),xj=[pj.default,mj.default,fj.default,hj.default,gj.default,vj.default,yj.default,_j.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$j.default,bj.default];Jf.default=xj});var Gf=I(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.validateAdditionalItems=void 0;var Vr=H(),Bf=ne(),kj={message:({params:{len:e}})=>(0,Vr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Vr._)`{limit: ${e}}`},wj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:kj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Bf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}jx(e,n)}};function jx(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Vr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Vr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Bf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Vr._)`${s} <= ${t.length}`);r.if((0,Vr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Bf.Type.Num},u),a.allErrors||r.if((0,Vr.not)(u),()=>r.break())})}}Vi.validateAdditionalItems=jx;Vi.default=wj});var Kf=I(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.validateTuple=void 0;var Nx=H(),cc=ne(),Sj=gt(),zj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Rx(e,"additionalItems",t);r.items=!0,!(0,cc.alwaysValidSchema)(r,t)&&e.ok((0,Sj.validateArray)(e))}};function Rx(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=cc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,Nx._)`${i}.length`);r.forEach((d,p)=>{(0,cc.alwaysValidSchema)(s,d)||(n.if((0,Nx._)`${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,cc.checkStrictMode)(s,_,p.strictTuples)}}}Ji.validateTuple=Rx;Ji.default=zj});var Dx=I(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});var Ij=Kf(),Tj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Ij.validateTuple)(e,"items")};Hf.default=Tj});var Zx=I(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var Ax=H(),Ej=ne(),Pj=gt(),Oj=Gf(),jj={message:({params:{len:e}})=>(0,Ax.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ax._)`{limit: ${e}}`},Nj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:jj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Ej.alwaysValidSchema)(n,t)&&(o?(0,Oj.validateAdditionalItems)(e,o):e.ok((0,Pj.validateArray)(e)))}};Wf.default=Nj});var Cx=I(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var yt=H(),uc=ne(),Rj={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}}`},Dj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Rj,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,uc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,uc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,uc.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:uc.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)))}}};Xf.default=Dj});var Lx=I(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.validateSchemaDeps=At.validatePropertyDeps=At.error=void 0;var Yf=H(),Aj=ne(),Bi=gt();At.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Yf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Yf._)`{property: ${e},
1496
1499
  missingProperty: ${n},
1497
1500
  depsCount: ${t},
1498
- deps: ${r}}`};var Cj={keyword:"dependencies",type:"object",schemaType:"object",error:Zt.error,code(e){let[t,r]=Mj(e);Ux(e,t),Cx(e,r)}};function Mj({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 Ux(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,Wi.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,Wi.checkReportMissingProp)(e,u)}):(r.if((0,Qf._)`${c} && (${(0,Wi.checkMissingProp)(e,s,i)})`),(0,Wi.reportMissingProp)(e,i),r.else())}}Zt.validatePropertyDeps=Ux;function Cx(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,Uj.alwaysValidSchema)(i,t[s])||(r.if((0,Wi.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=Cx;Zt.default=Cj});var qx=I(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var Lx=H(),Lj=ne(),qj={message:"property name must be valid",params:({params:e})=>(0,Lx._)`{propertyName: ${e.propertyName}}`},Fj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:qj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Lj.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,Lx.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};eh.default=Fj});var rh=I(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var hc=gt(),It=H(),Vj=Yt(),gc=ne(),Jj={message:"must NOT have additional properties",params:({params:e})=>(0,It._)`{additionalProperty: ${e.additionalProperty}}`},Bj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jj,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,gc.alwaysValidSchema)(a,r))return;let u=(0,hc.allSchemaProperties)(n.properties),l=(0,hc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,It._)`${i} === ${Vj.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,gc.schemaRefOrVal)(a,n.properties,"properties");x=(0,hc.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,hc.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,gc.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:gc.Type.Str};j===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(P,x)}}};th.default=Bj});var Jx=I(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var Gj=Zi(),Fx=gt(),nh=ne(),Vx=rh(),Kj={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&&Vx.default.code(new Gj.KeywordCxt(i,Vx.default,"additionalProperties"));let a=(0,Fx.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,Fx.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=Kj});var Hx=I(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var Bx=gt(),vc=H(),Gx=ne(),Kx=ne(),Hj={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,Bx.allSchemaProperties)(r),c=s.filter(y=>(0,Gx.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 vc.Name)&&(i.props=(0,Kx.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,Gx.checkStrictMode)(i,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",n,_=>{t.if((0,vc._)`${(0,Bx.usePattern)(e,y)}.test(${_})`,()=>{let x=c.includes(y);x||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:Kx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,vc._)`${d}[${_}]`,!0):!x&&!i.allErrors&&t.if((0,vc.not)(l),()=>t.break())})})}}};ih.default=Hj});var Wx=I(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Wj=ne(),Xj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Wj.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=Xj});var Xx=I(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var Yj=gt(),Qj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Yj.validateUnion,error:{message:"must match a schema in anyOf"}};sh.default=Qj});var Yx=I(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var yc=H(),eN=ne(),tN={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,yc._)`{passingSchemas: ${e.passing}}`},rN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:tN,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,eN.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,yc._)`${c} && ${a}`).assign(a,!1).assign(s,(0,yc._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,yc.Name)})})}}};ch.default=rN});var Qx=I(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});var nN=ne(),oN={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,nN.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};uh.default=oN});var rk=I(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var _c=H(),tk=ne(),iN={message:({params:e})=>(0,_c.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,_c._)`{failingKeyword: ${e.ifClause}}`},aN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:iN,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,tk.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=ek(n,"then"),i=ek(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,_c.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,_c._)`${l}`):e.setParams({ifClause:l})}}}};function ek(e,t){let r=e.schema[t];return r!==void 0&&!(0,tk.alwaysValidSchema)(e,r)}lh.default=aN});var nk=I(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var sN=ne(),cN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,sN.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};dh.default=cN});var ok=I(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var uN=Kf(),lN=Rx(),dN=Hf(),pN=Zx(),mN=Ax(),fN=Mx(),hN=qx(),gN=rh(),vN=Jx(),yN=Hx(),_N=Wx(),$N=Xx(),bN=Yx(),xN=Qx(),kN=rk(),wN=nk();function SN(e=!1){let t=[_N.default,$N.default,bN.default,xN.default,kN.default,wN.default,hN.default,gN.default,fN.default,vN.default,yN.default];return e?t.push(lN.default,pN.default):t.push(uN.default,dN.default),t.push(mN.default),t}ph.default=SN});var ik=I(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var xe=H(),zN={message:({schemaCode:e})=>(0,xe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,xe._)`{format: ${e}}`},IN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:zN,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=IN});var ak=I(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});var TN=ik(),EN=[TN.default];fh.default=EN});var sk=I(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.contentVocabulary=Vn.metadataVocabulary=void 0;Vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var uk=I(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});var PN=gx(),ON=Px(),jN=ok(),NN=ak(),ck=sk(),RN=[PN.default,ON.default,(0,jN.default)(),NN.default,ck.metadataVocabulary,ck.contentVocabulary];hh.default=RN});var dk=I($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.DiscrError=void 0;var lk;(function(e){e.Tag="tag",e.Mapping="mapping"})(lk||($c.DiscrError=lk={}))});var mk=I(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});var Jn=H(),gh=dk(),pk=rc(),DN=Ai(),ZN=ne(),AN={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,Jn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},UN={keyword:"discriminator",type:"object",schemaType:"object",error:AN,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,Jn._)`${r}${(0,Jn.getProperty)(s)}`);t.if((0,Jn._)`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,Jn._)`${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,Jn.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,ZN.schemaHasRulesButRef)(k,i.self.RULES)){let Ie=k.$ref;if(k=pk.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ie),k instanceof pk.SchemaEnv&&(k=k.schema),k===void 0)throw new DN.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=UN});var fk=I((f2,CN)=>{CN.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 MN=lx(),LN=uk(),qN=mk(),hk=fk(),FN=["/properties"],bc="http://json-schema.org/draft-07/schema",Bn=class extends MN.default{_addVocabularies(){super._addVocabularies(),LN.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(qN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(hk,FN):hk;this.addMetaSchema(t,bc,!1),this.refs["http://json-schema.org/schema"]=bc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(bc)?bc:void 0)}};ye.Ajv=Bn;yh.exports=ye=Bn;yh.exports.Ajv=Bn;Object.defineProperty(ye,"__esModule",{value:!0});ye.default=Bn;var VN=Zi();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return VN.KeywordCxt}});var Gn=H();Object.defineProperty(ye,"_",{enumerable:!0,get:function(){return Gn._}});Object.defineProperty(ye,"str",{enumerable:!0,get:function(){return Gn.str}});Object.defineProperty(ye,"stringify",{enumerable:!0,get:function(){return Gn.stringify}});Object.defineProperty(ye,"nil",{enumerable:!0,get:function(){return Gn.nil}});Object.defineProperty(ye,"Name",{enumerable:!0,get:function(){return Gn.Name}});Object.defineProperty(ye,"CodeGen",{enumerable:!0,get:function(){return Gn.CodeGen}});var JN=ec();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return JN.default}});var BN=Ai();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return BN.default}})});var kk=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(_k,kh),time:At(bh(!0),wh),"date-time":At(gk(!0),bk),"iso-time":At(bh(),$k),"iso-date-time":At(gk(),xk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:YN,"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:iR,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:QN,int32:{type:"number",validate:rR},int64:{type:"number",validate:nR},float:{type:"number",validate:yk},double:{type:"number",validate:yk},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,bk),"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,xk),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 GN(e){return e%4===0&&(e%100!==0||e%400===0)}var KN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,HN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function _k(e){let t=KN.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&&GN(r)?29:HN[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 gk(e){let t=bh(e);return function(n){let o=n.split(xh);return o.length===2&&_k(o[0])&&t(o[1])}}function bk(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function xk(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 WN=/\/|:/,XN=/^(?:[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 YN(e){return WN.test(e)&&XN.test(e)}var vk=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function QN(e){return vk.lastIndex=0,vk.test(e)}var eR=-(2**31),tR=2**31-1;function rR(e){return Number.isInteger(e)&&e<=tR&&e>=eR}function nR(e){return Number.isInteger(e)}function yk(){return!0}var oR=/[^\\]\\Z/;function iR(e){if(oR.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var wk=I(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.formatLimitDefinition=void 0;var aR=_h(),Tt=H(),xr=Tt.operators,xc={formatMaximum:{okStr:"<=",ok:xr.LTE,fail:xr.GT},formatMinimum:{okStr:">=",ok:xr.GTE,fail:xr.LT},formatExclusiveMaximum:{okStr:"<",ok:xr.LT,fail:xr.GTE},formatExclusiveMinimum:{okStr:">",ok:xr.GT,fail:xr.LTE}},sR={message:({keyword:e,schemaCode:t})=>(0,Tt.str)`should be ${xc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Tt._)`{comparison: ${xc[e].okStr}, limit: ${t}}`};Kn.formatLimitDefinition={keyword:Object.keys(xc),type:"string",schemaType:"string",$data:!0,error:sR,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 aR.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}) ${xc[o].fail} 0`}},dependencies:["format"]};var cR=e=>(e.addKeyword(Kn.formatLimitDefinition),e);Kn.default=cR});var Tk=I((Xi,Ik)=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Hn=kk(),uR=wk(),Sh=H(),Sk=new Sh.Name("fullFormats"),lR=new Sh.Name("fastFormats"),zh=(e,t={keywords:!0})=>{if(Array.isArray(t))return zk(e,t,Hn.fullFormats,Sk),e;let[r,n]=t.mode==="fast"?[Hn.fastFormats,lR]:[Hn.fullFormats,Sk],o=t.formats||Hn.formatNames;return zk(e,o,r,n),t.keywords&&(0,uR.default)(e),e};zh.get=(e,t="full")=>{let n=(t==="fast"?Hn.fastFormats:Hn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function zk(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])}Ik.exports=Xi=zh;Object.defineProperty(Xi,"__esModule",{value:!0});Xi.default=zh});function dR(){let e=new Ek.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Pk.default)(e),e}var Ek,Pk,kc,Ok=h(()=>{Ek=Yn(_h(),1),Pk=Yn(Tk(),1);kc=class{constructor(t){this._ajv=t??dR()}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 wc,jk=h(()=>{jn();wc=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},bi,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},On,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 Nk(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 Rk(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 Dk=h(()=>{});var Sc,Zk=h(()=>{F$();jn();Ok();os();jk();Dk();Sc=class extends Ls{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 kc,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 wc(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=q$(this._capabilities,t)}setRequestHandler(t,r){let o=ns(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(zn(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=dr(_i,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=dr(En,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=dr(Rs,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){Rk(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Nk(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:b$.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"},ws)}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},bi,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},On,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},On,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 pR(e){return E$.parse(JSON.parse(e))}function Ak(e){return JSON.stringify(e)+`
1499
- `}var zc,Uk=h(()=>{jn();zc=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
1500
- `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),pR(r)}clear(){this._buffer=void 0}}});var Ih,Ic,Ck=h(()=>{Ih=Yn(require("node:process"),1);Uk();Ic=class{constructor(t=Ih.default.stdin,r=Ih.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new zc,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=Ak(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}}});var Bk={};Et(Bk,{runMcpServer:()=>fR});function mR(e=20){if(!(0,Tc.existsSync)(Mk))return[];try{return(0,Tc.readFileSync)(Mk,"utf-8").split(`
1501
- `).filter(n=>n.length>0).slice(-e)}catch{return[]}}async function qk(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:mR(20)}}async function Fk(e){if(e.endsWith(".jsonl")){let t=await Yr(e);return Wh(t)}return Bun.file(e).text()}async function fR(e=!1){let t=wr(),r=!1,n=await Xr();r=!0;let o=new Sc({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(_i,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 no(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 Fk(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 qk(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 to(),process.exit(0)}if(process.on("SIGTERM",i),process.on("SIGINT",i),e)console.error(`[mcp] Starting HTTP MCP server on port ${Lk}`),Bun.serve({port:Lk,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 no(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 Fk(m.path)}]}:d={content:[{type:"text",text:JSON.stringify({error:`Session not found: ${p}`})}],isError:!0}}else if(u==="status"){let p=await qk(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 Ic;await o.connect(a),console.error("[mcp] qrec MCP server running on stdio")}}var Vk,Jk,Tc,Mk,Lk,Gk=h(()=>{"use strict";Zk();Ck();jn();ea();na();ra();Vc();Fc();oa();Vk=require("path"),Jk=require("os"),Tc=require("fs"),Mk=(0,Vk.join)((0,Jk.homedir)(),".qrec","qrec.log"),Lk=3031});ea();Cc();ra();Fc();var Ph=require("path"),Ec=require("os"),Br=require("fs"),[,,Kk,..._t]=process.argv,Hk=(0,Ph.join)((0,Ec.homedir)(),".qrec","qrec.log"),Th=(0,Ph.join)((0,Ec.homedir)(),".qrec");function hR(e=20){if(!(0,Br.existsSync)(Hk))return[];try{return(0,Br.readFileSync)(Hk,"utf-8").split(`
1502
- `).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 gR(){switch(Kk){case"--version":case"-v":console.log("qrec 0.2.3"),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}
1503
- `);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,Br.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,Br.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,Ec.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=wr();try{await ia(o,e,{force:t,sessions:r,seed:n})}finally{o.close(),await to()}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(()=>(hg(),Nw)));break}case"stop":{await qc();break}case"mcp":{let e=_t.includes("--http"),{runMcpServer:t}=await Promise.resolve().then(()=>(Gk(),Bk));await t(e);break}case"status":{let e=wr();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=hR(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: ${Kk}`),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)}}gR().catch(e=>{console.error("Fatal error:",e),process.exit(1)});
1501
+ deps: ${r}}`};var Zj={keyword:"dependencies",type:"object",schemaType:"object",error:At.error,code(e){let[t,r]=Cj(e);Ux(e,t),Mx(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 Ux(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,Bi.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,Bi.checkReportMissingProp)(e,u)}):(r.if((0,Yf._)`${c} && (${(0,Bi.checkMissingProp)(e,s,i)})`),(0,Bi.reportMissingProp)(e,i),r.else())}}At.validatePropertyDeps=Ux;function Mx(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,Bi.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))}At.validateSchemaDeps=Mx;At.default=Zj});var Fx=I(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});var qx=H(),Uj=ne(),Mj={message:"property name must be valid",params:({params:e})=>(0,qx._)`{propertyName: ${e.propertyName}}`},Lj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Mj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Uj.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,qx.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Qf.default=Lj});var th=I(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var lc=gt(),It=H(),qj=Yt(),dc=ne(),Fj={message:"must NOT have additional properties",params:({params:e})=>(0,It._)`{additionalProperty: ${e.additionalProperty}}`},Vj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Fj,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,dc.alwaysValidSchema)(a,r))return;let u=(0,lc.allSchemaProperties)(n.properties),l=(0,lc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,It._)`${i} === ${qj.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,dc.schemaRefOrVal)(a,n.properties,"properties");x=(0,lc.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,lc.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,dc.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:dc.Type.Str};j===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(P,x)}}};eh.default=Vj});var Bx=I(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});var Jj=ji(),Vx=gt(),rh=ne(),Jx=th(),Bj={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&&Jx.default.code(new Jj.KeywordCxt(i,Jx.default,"additionalProperties"));let a=(0,Vx.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=rh.mergeEvaluated.props(t,(0,rh.toHash)(a),i.props));let s=a.filter(d=>!(0,rh.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,Vx.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)}}};nh.default=Bj});var Wx=I(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var Gx=gt(),pc=H(),Kx=ne(),Hx=ne(),Gj={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,Gx.allSchemaProperties)(r),c=s.filter(y=>(0,Kx.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 pc.Name)&&(i.props=(0,Hx.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,Kx.checkStrictMode)(i,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",n,_=>{t.if((0,pc._)`${(0,Gx.usePattern)(e,y)}.test(${_})`,()=>{let x=c.includes(y);x||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:Hx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,pc._)`${d}[${_}]`,!0):!x&&!i.allErrors&&t.if((0,pc.not)(l),()=>t.break())})})}}};oh.default=Gj});var Xx=I(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var Kj=ne(),Hj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Kj.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"}};ih.default=Hj});var Yx=I(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Wj=gt(),Xj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wj.validateUnion,error:{message:"must match a schema in anyOf"}};ah.default=Xj});var Qx=I(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var mc=H(),Yj=ne(),Qj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,mc._)`{passingSchemas: ${e.passing}}`},eN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Qj,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,Yj.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,mc._)`${c} && ${a}`).assign(a,!1).assign(s,(0,mc._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,mc.Name)})})}}};sh.default=eN});var ek=I(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var tN=ne(),rN={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,tN.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};ch.default=rN});var nk=I(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});var fc=H(),rk=ne(),nN={message:({params:e})=>(0,fc.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,fc._)`{failingKeyword: ${e.ifClause}}`},oN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:nN,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,rk.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=tk(n,"then"),i=tk(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,fc.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,fc._)`${l}`):e.setParams({ifClause:l})}}}};function tk(e,t){let r=e.schema[t];return r!==void 0&&!(0,rk.alwaysValidSchema)(e,r)}uh.default=oN});var ok=I(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var iN=ne(),aN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,iN.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};lh.default=aN});var ik=I(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var sN=Gf(),cN=Dx(),uN=Kf(),lN=Zx(),dN=Cx(),pN=Lx(),mN=Fx(),fN=th(),hN=Bx(),gN=Wx(),vN=Xx(),yN=Yx(),_N=Qx(),$N=ek(),bN=nk(),xN=ok();function kN(e=!1){let t=[vN.default,yN.default,_N.default,$N.default,bN.default,xN.default,mN.default,fN.default,pN.default,hN.default,gN.default];return e?t.push(cN.default,lN.default):t.push(sN.default,uN.default),t.push(dN.default),t}dh.default=kN});var ak=I(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var xe=H(),wN={message:({schemaCode:e})=>(0,xe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,xe._)`{format: ${e}}`},SN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:wN,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})`}}}};ph.default=SN});var sk=I(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var zN=ak(),IN=[zN.default];mh.default=IN});var ck=I(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.contentVocabulary=Mn.metadataVocabulary=void 0;Mn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Mn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var lk=I(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});var TN=vx(),EN=Ox(),PN=ik(),ON=sk(),uk=ck(),jN=[TN.default,EN.default,(0,PN.default)(),ON.default,uk.metadataVocabulary,uk.contentVocabulary];fh.default=jN});var pk=I(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.DiscrError=void 0;var dk;(function(e){e.Tag="tag",e.Mapping="mapping"})(dk||(hc.DiscrError=dk={}))});var fk=I(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});var Ln=H(),hh=pk(),mk=Xs(),NN=Ni(),RN=ne(),DN={message:({params:{discrError:e,tagName:t}})=>e===hh.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Ln._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},AN={keyword:"discriminator",type:"object",schemaType:"object",error:DN,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,Ln._)`${r}${(0,Ln.getProperty)(s)}`);t.if((0,Ln._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:hh.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,Ln._)`${u} === ${g}`),t.assign(c,d(m[g]));t.else(),e.error(!1,{discrError:hh.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,Ln.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,RN.schemaHasRulesButRef)(k,i.self.RULES)){let Ie=k.$ref;if(k=mk.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ie),k instanceof mk.SchemaEnv&&(k=k.schema),k===void 0)throw new NN.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}}}};gh.default=AN});var hk=I((v2,ZN)=>{ZN.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 yh=I((ye,vh)=>{"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=dx(),UN=lk(),MN=fk(),gk=hk(),LN=["/properties"],gc="http://json-schema.org/draft-07/schema",qn=class extends CN.default{_addVocabularies(){super._addVocabularies(),UN.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(MN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(gk,LN):gk;this.addMetaSchema(t,gc,!1),this.refs["http://json-schema.org/schema"]=gc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(gc)?gc:void 0)}};ye.Ajv=qn;vh.exports=ye=qn;vh.exports.Ajv=qn;Object.defineProperty(ye,"__esModule",{value:!0});ye.default=qn;var qN=ji();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return qN.KeywordCxt}});var Fn=H();Object.defineProperty(ye,"_",{enumerable:!0,get:function(){return Fn._}});Object.defineProperty(ye,"str",{enumerable:!0,get:function(){return Fn.str}});Object.defineProperty(ye,"stringify",{enumerable:!0,get:function(){return Fn.stringify}});Object.defineProperty(ye,"nil",{enumerable:!0,get:function(){return Fn.nil}});Object.defineProperty(ye,"Name",{enumerable:!0,get:function(){return Fn.Name}});Object.defineProperty(ye,"CodeGen",{enumerable:!0,get:function(){return Fn.CodeGen}});var FN=Hs();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return FN.default}});var VN=Ni();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return VN.default}})});var wk=I(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.formatNames=Ct.fastFormats=Ct.fullFormats=void 0;function Zt(e,t){return{validate:e,compare:t}}Ct.fullFormats={date:Zt($k,xh),time:Zt($h(!0),kh),"date-time":Zt(vk(!0),xk),"iso-time":Zt($h(),bk),"iso-date-time":Zt(vk(),kk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:WN,"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:nR,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:XN,int32:{type:"number",validate:eR},int64:{type:"number",validate:tR},float:{type:"number",validate:_k},double:{type:"number",validate:_k},password:!0,binary:!0};Ct.fastFormats={...Ct.fullFormats,date:Zt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,xh),time:Zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,kh),"date-time":Zt(/^\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,xk),"iso-time":Zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bk),"iso-date-time":Zt(/^\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,kk),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};Ct.formatNames=Object.keys(Ct.fullFormats);function JN(e){return e%4===0&&(e%100!==0||e%400===0)}var BN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,GN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function $k(e){let t=BN.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&&JN(r)?29:GN[n])}function xh(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 $h(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 kh(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 bk(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 bh=/t|\s/i;function vk(e){let t=$h(e);return function(n){let o=n.split(bh);return o.length===2&&$k(o[0])&&t(o[1])}}function xk(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function kk(e,t){if(!(e&&t))return;let[r,n]=e.split(bh),[o,i]=t.split(bh),a=xh(r,o);if(a!==void 0)return a||kh(n,i)}var KN=/\/|:/,HN=/^(?:[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 WN(e){return KN.test(e)&&HN.test(e)}var yk=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function XN(e){return yk.lastIndex=0,yk.test(e)}var YN=-(2**31),QN=2**31-1;function eR(e){return Number.isInteger(e)&&e<=QN&&e>=YN}function tR(e){return Number.isInteger(e)}function _k(){return!0}var rR=/[^\\]\\Z/;function nR(e){if(rR.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Sk=I(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.formatLimitDefinition=void 0;var oR=yh(),Tt=H(),xr=Tt.operators,vc={formatMaximum:{okStr:"<=",ok:xr.LTE,fail:xr.GT},formatMinimum:{okStr:">=",ok:xr.GTE,fail:xr.LT},formatExclusiveMaximum:{okStr:"<",ok:xr.LT,fail:xr.GTE},formatExclusiveMinimum:{okStr:">",ok:xr.GT,fail:xr.LTE}},iR={message:({keyword:e,schemaCode:t})=>(0,Tt.str)`should be ${vc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Tt._)`{comparison: ${vc[e].okStr}, limit: ${t}}`};Vn.formatLimitDefinition={keyword:Object.keys(vc),type:"string",schemaType:"string",$data:!0,error:iR,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 oR.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}) ${vc[o].fail} 0`}},dependencies:["format"]};var aR=e=>(e.addKeyword(Vn.formatLimitDefinition),e);Vn.default=aR});var Ek=I((Gi,Tk)=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});var Jn=wk(),sR=Sk(),wh=H(),zk=new wh.Name("fullFormats"),cR=new wh.Name("fastFormats"),Sh=(e,t={keywords:!0})=>{if(Array.isArray(t))return Ik(e,t,Jn.fullFormats,zk),e;let[r,n]=t.mode==="fast"?[Jn.fastFormats,cR]:[Jn.fullFormats,zk],o=t.formats||Jn.formatNames;return Ik(e,o,r,n),t.keywords&&(0,sR.default)(e),e};Sh.get=(e,t="full")=>{let n=(t==="fast"?Jn.fastFormats:Jn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Ik(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,wh._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}Tk.exports=Gi=Sh;Object.defineProperty(Gi,"__esModule",{value:!0});Gi.default=Sh});function uR(){let e=new Pk.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ok.default)(e),e}var Pk,Ok,yc,jk=h(()=>{Pk=Kn(yh(),1),Ok=Kn(Ek(),1);yc=class{constructor(t){this._ajv=t??uR()}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 _c,Nk=h(()=>{Tn();_c=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},vi,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},In,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 Rk(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 Dk(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 Ak=h(()=>{});var $c,Zk=h(()=>{V$();Tn();jk();Qa();Nk();Ak();$c=class extends As{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(gi.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 yc,this.setRequestHandler(Jp,n=>this._oninitialize(n)),this.setNotificationHandler(Bp,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(em,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=gi.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new _c(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=F$(this._capabilities,t)}setRequestHandler(t,r){let o=Ya(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(xn(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=dr(hi,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=dr(Sn,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=dr(Es,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){Dk(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Rk(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:x$.includes(r)?r:Mp,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"},_s)}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},tm,r):this.request({method:"sampling/createMessage",params:t},vi,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},In,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},In,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},rm,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 lR(e){return P$.parse(JSON.parse(e))}function Ck(e){return JSON.stringify(e)+`
1502
+ `}var bc,Uk=h(()=>{Tn();bc=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
1503
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),lR(r)}clear(){this._buffer=void 0}}});var zh,xc,Mk=h(()=>{zh=Kn(require("node:process"),1);Uk();xc=class{constructor(t=zh.default.stdin,r=zh.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new bc,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=Ck(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}}});var Vk={};Et(Vk,{runMcpServer:()=>vR});async function pR(e,t){let r=await fetch(`${wc}/search`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,k:t})});if(!r.ok){let n=await r.json().catch(()=>({})),o=r.status===503?"qrec daemon not ready yet (model still loading)":`Daemon returned ${r.status}`;throw new Error(n.error??o)}return r.json()}async function mR(e){let t=await fetch(`${wc}/sessions/${e}/markdown`);if(t.status===404)throw new Error(`Session not found: ${e}`);if(!t.ok)throw new Error(`Daemon returned ${t.status}`);return t.text()}async function fR(){let e=await fetch(`${wc}/health`);if(!e.ok)throw new Error(`Daemon returned ${e.status}`);return e.json()}async function hR(e){let t=await fetch(`${wc}/query_db`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:e})});if(!t.ok){let r=await t.json().catch(()=>({}));throw new Error(r.error??`Daemon returned ${t.status}`)}return t.json()}function gR(e){let t=String(e);return t.includes("ECONNREFUSED")||t.includes("fetch failed")||t.includes("Connection refused")||t.includes("Unable to connect")}function Ki(e){return{content:[{type:"text",text:JSON.stringify({error:e})}],isError:!0}}async function kc(e,t){try{return{content:[{type:"text",text:t(await e())}]}}catch(r){return Ki(gR(r)?dR:String(r))}}async function Fk(e,t){if(e==="search"){let r=String(t?.query??"").trim();if(!r)return Ki("Missing required field: query");let n=typeof t?.k=="number"?t.k:10;return kc(()=>pR(r,n),o=>JSON.stringify(o))}if(e==="get"){let r=String(t?.session_id??"").trim();return r?kc(()=>mR(r),n=>String(n)):Ki("Missing required field: session_id")}if(e==="status")return kc(fR,r=>JSON.stringify(r));if(e==="query_db"){let r=String(t?.sql??"").trim();return r?kc(()=>hR(r),n=>JSON.stringify(n)):Ki("Missing required field: sql")}return Ki(`Unknown tool: ${e}`)}async function vR(e=!1){let t=new $c({name:"qrec",version:"0.1.0"},{capabilities:{tools:{}}});if(t.setRequestHandler(Qp,async()=>({tools:qk})),t.setRequestHandler(hi,async r=>{let{name:n,arguments:o}=r.params;return Fk(n,o??{})}),process.on("SIGTERM",()=>process.exit(0)),process.on("SIGINT",()=>process.exit(0)),e)console.error(`[mcp] Starting HTTP MCP server on port ${Lk}`),Bun.serve({port:Lk,async fetch(r){if(r.method!=="POST")return Response.json({error:"Method not allowed"},{status:405});let n;try{n=await r.json()}catch{return Response.json({jsonrpc:"2.0",error:{code:-32700,message:"Parse error"},id:null},{status:400})}if(n.method==="tools/list")return Response.json({jsonrpc:"2.0",result:{tools:qk},id:n.id});if(n.method==="tools/call"){let o=n.params,i=o?.name??"",a=o?.arguments??{},s=await Fk(i,a);return Response.json({jsonrpc:"2.0",result:s,id:n.id})}return Response.json({jsonrpc:"2.0",error:{code:-32601,message:"Method not found"},id:n.id},{status:404})}}),await new Promise(()=>{});else{let r=new xc;await t.connect(r),console.error("[mcp] qrec MCP server running on stdio (proxying to daemon at localhost:3030)")}}var wc,Lk,dR,qk,Jk=h(()=>{"use strict";Zk();Mk();Tn();wc="http://localhost:3030",Lk=3031,dR="qrec daemon is not running. Start it with: qrec serve --daemon";qk=[{name:"search",description:"Search indexed Claude Code sessions using hybrid BM25 + vector search",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query (use concrete nouns: function names, error messages, feature names)"},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 from search results"}},required:["session_id"]}},{name:"status",description:"Get qrec daemon health and index status",inputSchema:{type:"object",properties:{}}},{name:"query_db",description:`Run a read-only SQL SELECT query against the qrec SQLite database.
1504
+ Use for structured/temporal/project questions (dates, project names, counts, listings).
1505
+ Prefer over search when the question is about: dates, project names, counts, or listing sessions.
1506
+
1507
+ Schema:
1508
+ sessions(id TEXT, path TEXT, project TEXT, date TEXT, title TEXT, hash TEXT, indexed_at INTEGER)
1509
+ chunks(id TEXT, session_id TEXT, seq INTEGER, pos INTEGER, text TEXT, created_at INTEGER)
1510
+ query_audit(id INTEGER, query TEXT, k INTEGER, result_count INTEGER, top_session_id TEXT, top_score REAL, duration_ms REAL, created_at INTEGER)
1511
+
1512
+ Only SELECT statements. No semicolons.
1513
+
1514
+ Examples:
1515
+ SELECT id, title, project, date FROM sessions WHERE date = '2026-03-11' ORDER BY indexed_at DESC
1516
+ SELECT project, COUNT(*) as sessions FROM sessions GROUP BY project ORDER BY sessions DESC
1517
+ SELECT id, title, date FROM sessions WHERE project = 'qrec' ORDER BY date DESC LIMIT 10`,inputSchema:{type:"object",properties:{sql:{type:"string",description:"A read-only SELECT SQL query"}},required:["sql"]}}]});Pc();Mc();Ac();var Qn=require("path"),Lc=require("os"),rt=require("fs"),eg={},Sr=(0,Qn.join)((0,Lc.homedir)(),".qrec","qrec.pid"),tg=(0,Qn.join)((0,Lc.homedir)(),".qrec");function zw(){(0,rt.mkdirSync)(tg,{recursive:!0})}function rg(){if(!(0,rt.existsSync)(Sr))return!1;let e=parseInt((0,rt.readFileSync)(Sr,"utf-8").trim(),10);if(isNaN(e))return!1;try{return process.kill(e,0),!0}catch{try{(0,rt.unlinkSync)(Sr)}catch{}return!1}}function ea(){if(!(0,rt.existsSync)(Sr))return null;let e=parseInt((0,rt.readFileSync)(Sr,"utf-8").trim(),10);return isNaN(e)?null:e}async function qc(){if(rg()){let a=ea();console.log(`[daemon] qrec server already running (PID ${a})`);return}zw();let e=(0,Qn.join)(tg,"qrec.log"),t=typeof eg.dir=="string"?["bun","run",(0,Qn.join)(eg.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)(Sr,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 Fc(){if(!rg()){console.log("[daemon] No running qrec server found.");return}let e=ea();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)(Sr)}catch{}console.log("[daemon] qrec server stopped.")}var Eh=require("path"),Sc=require("os"),Jr=require("fs"),[,,Bk,..._t]=process.argv,Gk=(0,Eh.join)((0,Sc.homedir)(),".qrec","qrec.log"),Ih=(0,Eh.join)((0,Sc.homedir)(),".qrec");function yR(e=20){if(!(0,Jr.existsSync)(Gk))return[];try{return(0,Jr.readFileSync)(Gk,"utf-8").split(`
1518
+ `).filter(n=>n.length>0).slice(-e)}catch{return[]}}function Th(){let e=process.platform==="darwin"?"open":"xdg-open";try{Bun.spawnSync([e,"http://localhost:3030"])}catch{}}async function _R(){switch(Bk){case"--version":case"-v":console.log("qrec 0.2.4"),process.exit(0);case"onboard":{let e=_t.includes("--no-open");await qc(),e||Th();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}
1519
+ `);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 Fc(),(0,Jr.existsSync)(Ih)||(console.log("[teardown] ~/.qrec/ not found, nothing to remove."),process.exit(0)),e||(process.stdout.write(`[teardown] Remove ${Ih} (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,Jr.rmSync)(Ih,{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,Sc.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=Hn();try{await Qi(o,e,{force:t,sessions:r,seed:n})}finally{o.close(),await Dc()}process.exit(0)}case"serve":{let e=_t.includes("--daemon"),t=_t.includes("--no-open");e?(await qc(),t||Th()):(t||setTimeout(Th,1e3),await Promise.resolve().then(()=>(gg(),Ow)));break}case"stop":{await Fc();break}case"mcp":{let e=_t.includes("--http"),{runMcpServer:t}=await Promise.resolve().then(()=>(Jk(),Vk));await t(e);break}case"status":{let e=Hn();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=ea(),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=yR(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: ${Bk}`),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)}}_R().catch(e=>{console.error("Fatal error:",e),process.exit(1)});