@dvquys/qrec 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/scripts/qrec.cjs +1383 -24
package/plugin/scripts/qrec.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
"use strict";var
|
|
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(`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS chunks (
|
|
4
4
|
id TEXT PRIMARY KEY,
|
|
5
5
|
session_id TEXT NOT NULL,
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
INSERT INTO chunks_fts(chunks_fts, rowid, session_id, text) VALUES ('delete', old.rowid, old.session_id, old.text);
|
|
63
63
|
INSERT INTO chunks_fts(rowid, session_id, text) VALUES (new.rowid, new.session_id, new.text);
|
|
64
64
|
END;
|
|
65
|
-
`)}var jc,Oh,jh,Nh,Qi,Nc,
|
|
66
|
-
Then set BREW_PREFIX if Homebrew is in a non-standard location.`);jc.Database.setCustomSQLite(e)}
|
|
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+`
|
|
67
67
|
|
|
68
68
|
`+i.text:i.text;if(a.length<=3600)n||(o=i.pos),n=a;else if(n){r.push({text:n.trim(),pos:o});let s=n.slice(-Rh),c=o+n.length-s.length;n=s+`
|
|
69
69
|
|
|
70
|
-
`+i.text,o=c}else{let s=
|
|
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(`
|
|
71
71
|
|
|
72
72
|
`,o);if(i>n+3600*.5)o=i;else{let a=e.lastIndexOf(`
|
|
73
|
-
`,o);a>n+3600*.5&&(o=a)}r.push({text:e.slice(n,o).trim(),pos:t+n}),n=Math.max(n+1,o-Rh)}return r}var Rh,Zh=h(()=>{"use strict";Rh=Math.floor(540)});var ze,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:()=>
|
|
74
|
-
`).trim(),isToolResult:!1}}function
|
|
75
|
-
`).trim(),tools:r,thinking:n}}async function
|
|
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}=
|
|
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
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
|
|
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(`
|
|
79
79
|
INSERT OR REPLACE INTO sessions (id, path, project, date, title, hash, indexed_at)
|
|
80
80
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
81
81
|
`),_=e.prepare(`
|
|
@@ -84,16 +84,1375 @@ Then set BREW_PREFIX if Homebrew is in a non-standard location.`);jc.Database.se
|
|
|
84
84
|
`),x=e.prepare(`
|
|
85
85
|
INSERT OR REPLACE INTO chunks_vec (chunk_id, embedding)
|
|
86
86
|
VALUES (?, ?)
|
|
87
|
-
`),j=e.prepare("DELETE FROM chunks WHERE session_id = ?"),P=e.prepare("DELETE FROM chunks_vec WHERE chunk_id LIKE ?");for(let z=0;z<p.length;z++){let{id:k,path:$e,project:Ie,date:Me,title:$t,hash:Ct,chunkText:
|
|
88
|
-
`),n?.(z,p.length,k);let Pc=e.transaction(A=>{for(let{chunkId:_e,seq:He,pos:tt,text:
|
|
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(`
|
|
89
89
|
INSERT INTO query_audit (query, k, result_count, top_session_id, top_score, duration_ms, created_at)
|
|
90
90
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
91
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
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(
|
|
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,nr.join)((0,io.homedir)(),".qrec","qrec.log"),modelCachePath:(0,nr.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 Yr(),r=null,console.log("[server] Model ready"),await a(),ze.phase="ready",setInterval(a,pg);return}catch(d){r=String(d),console.error(`[server] Model load failed (attempt ${l}/${c}):`,d),l<c&&(console.log(`[server] Retrying in ${u/1e3}s...`),await Bun.sleep(u))}console.error("[server] Model load gave up after all retries."),ze.phase="ready"}s(),process.on("SIGTERM",()=>{console.log("[server] SIGTERM received, shutting down..."),e.close(),i.stop(),process.exit(0)}),process.on("SIGINT",()=>{console.log("[server] SIGINT received, shutting down..."),e.close(),i.stop(),process.exit(0)})}var nr,ao,io,mg,Kc,dg,pg,Pw,fg=h(()=>{"use strict";ea();na();Vc();cg();Cc();oa();Rc();lg();nr=require("path"),ao=require("fs"),io=require("os"),mg={},Kc=3030,dg=(0,nr.join)((0,io.homedir)(),".claude","projects"),pg=parseInt(process.env.QREC_INDEX_INTERVAL_MS??"60000",10),Pw=typeof mg.dir=="string"?(0,nr.join)(mg.dir,"..","ui"):(0,nr.join)(__dirname,"..","ui");jw().catch(e=>{console.error("[server] Fatal error:",e),process.exit(1)})});var ee,hg,T,Mt,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})})(hg||(hg={}));T=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Mt=e=>{switch(typeof e){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(e)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(e)?T.array:e===null?T.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?T.promise:typeof Map<"u"&&e instanceof Map?T.map:typeof Set<"u"&&e instanceof Set?T.set:typeof Date<"u"&&e instanceof Date?T.date:T.object;default:return T.unknown}}});var $,nt,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 Rw,or,Hc=h(()=>{aa();so();Rw=(e,t)=>{let r;switch(e.code){case $.invalid_type:e.received===T.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case $.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case $.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case $.invalid_union:r="Invalid input";break;case $.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case $.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case $.invalid_arguments:r="Invalid function arguments";break;case $.invalid_return_type:r="Invalid function return type";break;case $.invalid_date:r="Invalid date";break;case $.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case $.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case $.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case $.custom:r="Invalid input";break;case $.invalid_intersection_types:r="Intersection results could not be merged";break;case $.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case $.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},or=Rw});function co(){return Dw}var Dw,sa=h(()=>{Hc();Dw=or});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===or?void 0:or].filter(o=>!!o)});e.common.issues.push(n)}var ca,Re,M,tn,qe,Wc,Xc,Tr,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",Tr=e=>e.status==="valid",uo=e=>typeof Promise<"u"&&e instanceof Promise});var gg=h(()=>{});var O,vg=h(()=>{(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}))});function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}function $g(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Yw(e){return new RegExp(`^${$g(e)}$`)}function Qw(e){let t=`${_g}T${$g(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function eS(e,t){return!!((t==="v4"||!t)&&Jw.test(e)||(t==="v6"||!t)&&Gw.test(e))}function tS(e,t){if(!Lw.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function rS(e,t){return!!((t==="v4"||!t)&&Bw.test(e)||(t==="v6"||!t)&&Kw.test(e))}function nS(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}function 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 ar?new ar({...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 bg(e,t){return new dn({values:e,typeName:Z.ZodEnum,...V(t)})}var ut,yg,W,Zw,Aw,Uw,Cw,Mw,Lw,qw,Fw,Vw,Qc,Jw,Bw,Gw,Kw,Hw,Ww,_g,Xw,nn,lo,po,mo,fo,ho,on,an,go,ir,Pt,vo,ar,ot,sn,Lt,eu,cn,qt,ru,yo,_o,nu,un,ln,dn,pn,Er,xt,bt,Ft,mn,fn,$o,ua,la,hn,r1,Z,n1,o1,i1,a1,s1,c1,u1,l1,d1,p1,m1,f1,h1,g1,oS,v1,y1,_1,$1,b1,x1,k1,w1,S1,z1,I1,T1,E1,P1,O1,j1,N1,R1,D1,xg=h(()=>{aa();sa();vg();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}},yg=(e,t)=>{if(Tr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new nt(e.common.issues);return this._error=r,this._error}}};W=class{get description(){return this._def.description}_getType(t){return Mt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:Mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(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 yg(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Mt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Tr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Tr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Mt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(uo(o)?o:Promise.resolve(o));return yg(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:$.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new xt({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bt.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ar.create(this)}promise(){return Er.create(this,this._def)}or(t){return 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}},Zw=/^c[^\s-]{8,}$/i,Aw=/^[0-9a-z]+$/,Uw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Cw=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mw=/^[a-z0-9_-]{21}$/i,Lw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Fw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Gw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Kw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ww=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_g="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Xw=new RegExp(`^${_g}$`);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")Fw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"email",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qc||(Qc=new RegExp(Vw,"u")),Qc.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"emoji",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Cw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"uuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Mw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"nanoid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Zw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Aw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid2",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Uw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ulid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),w(o,{validation:"url",code:$.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"regex",code:$.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Qw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Xw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Yw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?qw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?eS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?tS(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?rS(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Hw.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ww.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64url",code:$.invalid_string,message:i.message}),n.dirty()):ee.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:$.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};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"?nS(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_finite,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};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)});ir=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qe(t.data)}};ir.create=e=>new ir({typeName:Z.ZodUnknown,...V(e)});Pt=class extends W{_parse(t){let r=this._getOrReturnCtx(t);return w(r,{code:$.invalid_type,expected:T.never,received:r.parsedType}),M}};Pt.create=e=>new Pt({typeName:Z.ZodNever,...V(e)});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)});ar=class e extends W{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==T.array)return w(r,{code:$.invalid_type,expected:T.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?$.too_big:$.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(w(r,{code:$.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(w(r,{code:$.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new ut(r,a,r.path,s)))).then(a=>Re.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ut(r,a,r.path,s)));return Re.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};ar.create=(e,t)=>new ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...V(t)});ot=class e extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==T.object){let u=this._getOrReturnCtx(t);return w(u,{code:$.invalid_type,expected:T.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ut(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Pt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:$.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ut(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(n,u)):Re.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return 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 bg(ee.objectKeys(this.shape))}};ot.create=(e,t)=>new ot({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});ot.strictCreate=(e,t)=>new ot({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});ot.lazycreate=(e,t)=>new ot({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:Z.ZodObject,...V(t)});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(),or].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(),or].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Er){let s=this;return qe(async function(...c){let u=new nt([]),l=await s._def.args.parseAsync(c,i).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let s=this;return qe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new nt([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new nt([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qt.create(t).rest(ir.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||qt.create([]).rest(ir.create()),returns:r||ir.create(),typeName:Z.ZodFunction,...V(n)})}},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=bg;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)});Er=class extends W{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==T.promise&&r.common.async===!1)return w(r,{code:$.invalid_type,expected:T.promise,received:r.parsedType}),M;let n=r.parsedType===T.promise?r.data:Promise.resolve(r.data);return qe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Er.create=(e,t)=>new Er({type:e,typeName:Z.ZodPromise,...V(t)});xt=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{w(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?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(!Tr(a))return M;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Tr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);ee.assertNever(o)}};xt.create=(e,t,r)=>new xt({schema:e,typeName:Z.ZodEffects,effect:t,...V(r)});xt.createWithPreprocess=(e,t,r)=>new xt({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...V(r)});bt=class extends W{_parse(t){return this._getType(t)===T.undefined?qe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:Z.ZodOptional,...V(t)});Ft=class extends W{_parse(t){return this._getType(t)===T.null?qe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ft.create=(e,t)=>new Ft({innerType:e,typeName:Z.ZodNullable,...V(t)});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=>(Tr(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)});r1={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={}));n1=nn.create,o1=lo.create,i1=$o.create,a1=po.create,s1=mo.create,c1=fo.create,u1=ho.create,l1=on.create,d1=an.create,p1=go.create,m1=ir.create,f1=Pt.create,h1=vo.create,g1=ar.create,oS=ot.create,v1=ot.strictCreate,y1=sn.create,_1=eu.create,$1=cn.create,b1=qt.create,x1=ru.create,k1=yo.create,w1=_o.create,S1=nu.create,z1=un.create,I1=ln.create,T1=dn.create,E1=pn.create,P1=Er.create,O1=xt.create,j1=bt.create,N1=Ft.create,R1=xt.createWithPreprocess,D1=la.create});var ou=h(()=>{sa();Yc();gg();so();xg();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 kg,Ot,Pr,da,gn=h(()=>{kg=Object.freeze({status:"aborted"});Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},da={}});var b={};Et(b,{BIGINT_FORMAT_RANGES:()=>fu,Class:()=>au,NUMBER_FORMAT_RANGES:()=>mu,aborted:()=>lr,allowsEval:()=>uu,assert:()=>dS,assertEqual:()=>sS,assertIs:()=>uS,assertNever:()=>lS,assertNotEqual:()=>cS,assignProp:()=>cr,base64ToUint8Array:()=>Og,base64urlToUint8Array:()=>xS,cached:()=>yn,captureStackTrace:()=>ma,cleanEnum:()=>bS,cleanRegex:()=>wo,clone:()=>Fe,cloneDef:()=>mS,createTransparentProxy:()=>_S,defineLazy:()=>J,esc:()=>pa,escapeRegex:()=>lt,extend:()=>Ig,finalizeIssue:()=>We,floatSafeRemainder:()=>su,getElementAtPath:()=>fS,getEnumValues:()=>ko,getLengthableOrigin:()=>Io,getParsedType:()=>yS,getSizableOrigin:()=>zo,hexToUint8Array:()=>wS,isObject:()=>Or,isPlainObject:()=>ur,issue:()=>_n,joinValues:()=>U,jsonStringifyReplacer:()=>vn,merge:()=>$S,mergeDefs:()=>Vt,normalizeParams:()=>S,nullish:()=>sr,numKeys:()=>vS,objectClone:()=>pS,omit:()=>zg,optionalKeys:()=>pu,parsedType:()=>L,partial:()=>Eg,pick:()=>Sg,prefixIssues:()=>it,primitiveTypes:()=>du,promiseAllObject:()=>hS,propertyKeyTypes:()=>So,randomString:()=>gS,required:()=>Pg,safeExtend:()=>Tg,shallowClone:()=>lu,slugify:()=>cu,stringifyPrimitive:()=>C,uint8ArrayToBase64:()=>jg,uint8ArrayToBase64url:()=>kS,uint8ArrayToHex:()=>SS,unwrapMessage:()=>xo});function sS(e){return e}function cS(e){return e}function uS(e){}function lS(e){throw new Error("Unexpected value in exhaustive check")}function dS(e){}function 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 sr(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!==wg)return n===void 0&&(n=wg,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function pS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function cr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Vt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function mS(e){return Vt(e._zod.def)}function fS(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hS(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function gS(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function pa(e){return JSON.stringify(e)}function cu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Or(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ur(e){if(Or(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Or(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function lu(e){return ur(e)?{...e}:Array.isArray(e)?[...e]:e}function vS(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function lt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function _S(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function C(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function pu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Sg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Vt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return cr(this,"shape",a),a},checks:[]});return Fe(e,i)}function zg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Vt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return cr(this,"shape",a),a},checks:[]});return Fe(e,i)}function Ig(e,t){if(!ur(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Vt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return cr(this,"shape",i),i}});return Fe(e,o)}function Tg(e,t){if(!ur(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Vt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return cr(this,"shape",n),n}});return Fe(e,r)}function $S(e,t){let r=Vt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return cr(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function Eg(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Vt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return cr(this,"shape",c),c},checks:[]});return Fe(t,a)}function Pg(e,t,r){let n=Vt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return cr(this,"shape",i),i}});return Fe(t,n)}function lr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function it(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function 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 bS(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Og(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function jg(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function xS(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Og(t+r)}function kS(e){return jg(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wS(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function SS(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var wg,ma,uu,yS,So,du,mu,fu,au,N=h(()=>{wg=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}});yS=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},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 Ng,fa,To,hu=h(()=>{gn();N();Ng=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fa=f("$ZodError",Ng),To=f("$ZodError",Ng,{Parent:Error})});var Eo,Po,Oo,jo,No,$n,Ro,Do,Rg,Dg,Zg,Ag,Ug,Cg,Mg,Lg,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),Rg=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Eo(e)(t,r,o)},Dg=e=>(t,r,n)=>Eo(e)(t,r,n),Zg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,r,o)},Ag=e=>async(t,r,n)=>Oo(e)(t,r,n),Ug=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return No(e)(t,r,o)},Cg=e=>(t,r,n)=>No(e)(t,r,n),Mg=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ro(e)(t,r,o)},Lg=e=>async(t,r,n)=>Ro(e)(t,r,n)});var dt={};Et(dt,{base64:()=>ju,base64url:()=>va,bigint:()=>Uu,boolean:()=>Mu,browserEmail:()=>RS,cidrv4:()=>Pu,cidrv6:()=>Ou,cuid:()=>vu,cuid2:()=>yu,date:()=>Ru,datetime:()=>Zu,domain:()=>AS,duration:()=>ku,e164:()=>Nu,email:()=>Su,emoji:()=>zu,extendedDuration:()=>IS,guid:()=>wu,hex:()=>US,hostname:()=>ZS,html5Email:()=>OS,idnEmail:()=>NS,integer:()=>Cu,ipv4:()=>Iu,ipv6:()=>Tu,ksuid:()=>bu,lowercase:()=>Fu,mac:()=>Eu,md5_base64:()=>MS,md5_base64url:()=>LS,md5_hex:()=>CS,nanoid:()=>xu,null:()=>Lu,number:()=>ya,rfc5322Email:()=>jS,sha1_base64:()=>FS,sha1_base64url:()=>VS,sha1_hex:()=>qS,sha256_base64:()=>BS,sha256_base64url:()=>GS,sha256_hex:()=>JS,sha384_base64:()=>HS,sha384_base64url:()=>WS,sha384_hex:()=>KS,sha512_base64:()=>YS,sha512_base64url:()=>QS,sha512_hex:()=>XS,string:()=>Au,time:()=>Du,ulid:()=>_u,undefined:()=>qu,unicodeEmail:()=>qg,uppercase:()=>Vu,uuid:()=>jr,uuid4:()=>TS,uuid6:()=>ES,uuid7:()=>PS,xid:()=>$u});function zu(){return new RegExp(DS,"u")}function Vg(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Du(e){return new RegExp(`^${Vg(e)}$`)}function Zu(e){let t=Vg({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Fg}T(?:${n})$`)}function 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,IS,wu,jr,TS,ES,PS,Su,OS,jS,qg,NS,RS,DS,Iu,Tu,Eu,Pu,Ou,ju,va,ZS,AS,Nu,Fg,Ru,Au,Uu,Cu,ya,Mu,Lu,qu,Fu,Vu,US,CS,MS,LS,qS,FS,VS,JS,BS,GS,KS,HS,WS,XS,YS,QS,_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)?)?)$/,IS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,TS=jr(4),ES=jr(6),PS=jr(7),Su=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,OS=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jS=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,qg=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,NS=qg,RS=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,DS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Iu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Tu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Eu=e=>{let t=lt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Pu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ou=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ju=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,va=/^[A-Za-z0-9_-]*$/,ZS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,AS=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Nu=/^\+[1-9]\d{6,14}$/,Fg="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ru=new RegExp(`^${Fg}$`);Au=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Uu=/^-?\d+n?$/,Cu=/^-?\d+$/,ya=/^-?\d+(?:\.\d+)?$/,Mu=/^(?:true|false)$/i,Lu=/^null$/i,qu=/^undefined$/i,Fu=/^[^A-Z]*$/,Vu=/^[^a-z]*$/,US=/^[0-9a-fA-F]*$/;CS=/^[0-9a-fA-F]{32}$/,MS=Zo(22,"=="),LS=Ao(22),qS=/^[0-9a-fA-F]{40}$/,FS=Zo(27,"="),VS=Ao(27),JS=/^[0-9a-fA-F]{64}$/,BS=Zo(43,"="),GS=Ao(43),KS=/^[0-9a-fA-F]{96}$/,HS=Zo(64,""),WS=Ao(64),XS=/^[0-9a-fA-F]{128}$/,YS=Zo(86,"=="),QS=Ao(86)});function Jg(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues))}var le,Bg,Ju,Bu,Gg,Kg,Hg,Wg,Xg,Yg,Qg,ev,tv,Uo,rv,nv,ov,iv,av,sv,cv,uv,lv,$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=[])}),Bg={number:"number",bigint:"bigint",object:"date"},Ju=f("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=Bg[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bu=f("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);let r=Bg[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gg=f("$ZodCheckMultipleOf",(e,t)=>{le.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):su(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kg=f("$ZodCheckNumberFormat",(e,t)=>{le.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=mu[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Cu)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Hg=f("$ZodCheckBigIntFormat",(e,t)=>{le.init(e,t);let[r,n]=fu[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Wg=f("$ZodCheckMaxSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:zo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xg=f("$ZodCheckMinSize",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:zo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Yg=f("$ZodCheckSizeEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin: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})}}),Qg=f("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Io(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ev=f("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Io(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tv=f("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=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=()=>{})}),rv=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})}}),nv=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fu),Uo.init(e,t)}),ov=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vu),Uo.init(e,t)}),iv=f("$ZodCheckIncludes",(e,t)=>{le.init(e,t);let r=lt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),av=f("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`^${lt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),sv=f("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`.*${lt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});cv=f("$ZodCheckProperty",(e,t)=>{le.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Jg(o,r,t.property));Jg(n,r,t.property)}}),uv=f("$ZodCheckMimeType",(e,t)=>{le.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),lv=f("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var 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(`
|
|
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>
|
|
95
|
+
<html lang="en">
|
|
96
|
+
<head>
|
|
97
|
+
<meta charset="UTF-8">
|
|
98
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
99
|
+
<title>qrec</title>
|
|
100
|
+
<script src="https://cdn.jsdelivr.net/npm/marked@13/marked.min.js"></script>
|
|
101
|
+
<style>
|
|
102
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
103
|
+
|
|
104
|
+
:root {
|
|
105
|
+
--bg: #ffffff;
|
|
106
|
+
--bg2: #f8fafc;
|
|
107
|
+
--bg3: #f1f5f9;
|
|
108
|
+
--border: #e2e8f0;
|
|
109
|
+
--text: #0f172a;
|
|
110
|
+
--text-muted: #64748b;
|
|
111
|
+
--accent: #0062a8;
|
|
112
|
+
--accent-hover: #004d84;
|
|
113
|
+
--accent-light: #e0f0ff;
|
|
114
|
+
--accent-border: #b3d9f5;
|
|
115
|
+
--green: #059669;
|
|
116
|
+
--green-bg: #ecfdf5;
|
|
117
|
+
--green-border: #a7f3d0;
|
|
118
|
+
--yellow: #d97706;
|
|
119
|
+
--yellow-bg: #fffbeb;
|
|
120
|
+
--red: #dc2626;
|
|
121
|
+
--mono: 'Menlo', 'Consolas', monospace;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
body {
|
|
125
|
+
background: var(--bg);
|
|
126
|
+
color: var(--text);
|
|
127
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
128
|
+
font-size: 14px;
|
|
129
|
+
line-height: 1.6;
|
|
130
|
+
min-height: 100vh;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* \u2500\u2500 Header / Nav \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
134
|
+
header {
|
|
135
|
+
border-bottom: 1px solid var(--border);
|
|
136
|
+
padding: 14px 24px;
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: 12px;
|
|
140
|
+
background: var(--bg);
|
|
141
|
+
position: sticky;
|
|
142
|
+
top: 0;
|
|
143
|
+
z-index: 10;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.logo {
|
|
147
|
+
width: 28px; height: 28px;
|
|
148
|
+
background: var(--accent);
|
|
149
|
+
border-radius: 6px;
|
|
150
|
+
display: flex; align-items: center; justify-content: center;
|
|
151
|
+
font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
header h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
|
|
155
|
+
|
|
156
|
+
nav { margin-left: auto; display: flex; gap: 4px; }
|
|
157
|
+
|
|
158
|
+
nav button {
|
|
159
|
+
color: var(--text-muted);
|
|
160
|
+
background: none;
|
|
161
|
+
border: none;
|
|
162
|
+
font-family: inherit;
|
|
163
|
+
font-size: 13px;
|
|
164
|
+
font-weight: 500;
|
|
165
|
+
padding: 5px 10px;
|
|
166
|
+
border-radius: 6px;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
transition: background 0.1s, color 0.1s;
|
|
169
|
+
}
|
|
170
|
+
nav button:hover { background: var(--bg3); color: var(--text); }
|
|
171
|
+
nav button.active { background: var(--bg3); color: var(--text); }
|
|
172
|
+
|
|
173
|
+
/* \u2500\u2500 Tab panels \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
174
|
+
.tab-panel { display: none; }
|
|
175
|
+
.tab-panel.active { display: block; }
|
|
176
|
+
|
|
177
|
+
main {
|
|
178
|
+
max-width: 900px;
|
|
179
|
+
margin: 0 auto;
|
|
180
|
+
padding: 40px 24px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* \u2500\u2500 Spinner / shared \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
184
|
+
.spinner {
|
|
185
|
+
display: inline-block; width: 18px; height: 18px;
|
|
186
|
+
border: 2px solid var(--border); border-top-color: var(--accent);
|
|
187
|
+
border-radius: 50%; animation: spin 0.7s linear infinite;
|
|
188
|
+
}
|
|
189
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
190
|
+
|
|
191
|
+
.loading-state { text-align: center; color: var(--text-muted); padding: 80px 0; }
|
|
192
|
+
.empty-state { text-align: center; color: var(--text-muted); padding: 48px 0; font-size: 15px; }
|
|
193
|
+
.error-state { text-align: center; color: var(--red); padding: 48px 0; }
|
|
194
|
+
|
|
195
|
+
/* \u2500\u2500 Dashboard \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
196
|
+
.onboarding-wrap { display: none; }
|
|
197
|
+
.dashboard-wrap { display: none; }
|
|
198
|
+
|
|
199
|
+
.onboarding-wrap h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 6px; }
|
|
200
|
+
.onboarding-wrap .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 36px; }
|
|
201
|
+
|
|
202
|
+
.steps { display: flex; flex-direction: column; gap: 12px; }
|
|
203
|
+
.step {
|
|
204
|
+
display: flex; align-items: flex-start; gap: 16px;
|
|
205
|
+
padding: 18px 20px; border: 1px solid var(--border);
|
|
206
|
+
border-radius: 10px; background: var(--bg2); transition: border-color 0.15s;
|
|
207
|
+
}
|
|
208
|
+
.step.done { background: var(--green-bg); border-color: var(--green-border); }
|
|
209
|
+
.step.active { border-color: var(--accent); background: var(--accent-light); }
|
|
210
|
+
|
|
211
|
+
.step-icon {
|
|
212
|
+
width: 32px; height: 32px; border-radius: 50%;
|
|
213
|
+
display: flex; align-items: center; justify-content: center;
|
|
214
|
+
font-size: 15px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
|
|
215
|
+
background: var(--bg3); color: var(--text-muted); border: 2px solid var(--border);
|
|
216
|
+
}
|
|
217
|
+
.step.done .step-icon { background: var(--green); color: white; border-color: var(--green); }
|
|
218
|
+
.step.active .step-icon { background: var(--accent); color: white; border-color: var(--accent); }
|
|
219
|
+
.step-body { flex: 1; }
|
|
220
|
+
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
|
|
221
|
+
.step.done .step-title { color: var(--green); }
|
|
222
|
+
.step.active .step-title { color: var(--accent); }
|
|
223
|
+
.step-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
|
|
224
|
+
|
|
225
|
+
.progress-wrap { margin-top: 12px; }
|
|
226
|
+
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
|
|
227
|
+
.progress-label strong { color: var(--text); }
|
|
228
|
+
.progress-track { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
|
|
229
|
+
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
|
|
230
|
+
.progress-fill.indeterminate { width: 40% !important; animation: indeterminate 1.4s ease-in-out infinite; }
|
|
231
|
+
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
|
|
232
|
+
|
|
233
|
+
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
|
|
234
|
+
.dashboard-header h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
|
|
235
|
+
|
|
236
|
+
.status-pill {
|
|
237
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
238
|
+
background: var(--green-bg); border: 1px solid var(--green-border);
|
|
239
|
+
color: var(--green); font-size: 12px; font-weight: 600;
|
|
240
|
+
padding: 3px 10px; border-radius: 20px;
|
|
241
|
+
}
|
|
242
|
+
.status-dot {
|
|
243
|
+
width: 6px; height: 6px; background: var(--green); border-radius: 50%;
|
|
244
|
+
animation: pulse 2s infinite;
|
|
245
|
+
}
|
|
246
|
+
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
247
|
+
|
|
248
|
+
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
|
|
249
|
+
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
|
|
250
|
+
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
|
|
251
|
+
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
|
|
252
|
+
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
|
|
253
|
+
|
|
254
|
+
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 28px; }
|
|
255
|
+
.info-row {
|
|
256
|
+
background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
|
|
257
|
+
padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
258
|
+
}
|
|
259
|
+
.info-key { font-size: 13px; color: var(--text-muted); font-weight: 500; }
|
|
260
|
+
.info-val { font-size: 13px; font-weight: 600; text-align: right; }
|
|
261
|
+
.provider-badge {
|
|
262
|
+
background: var(--accent-light); color: var(--accent);
|
|
263
|
+
padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
|
|
264
|
+
font-family: var(--mono);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.actions { display: flex; gap: 10px; }
|
|
268
|
+
.action-btn {
|
|
269
|
+
display: inline-flex; align-items: center; gap: 8px;
|
|
270
|
+
padding: 10px 18px; border-radius: 8px; font-family: inherit;
|
|
271
|
+
font-size: 14px; font-weight: 500; text-decoration: none;
|
|
272
|
+
transition: background 0.15s; cursor: pointer; border: 1px solid transparent;
|
|
273
|
+
}
|
|
274
|
+
.action-btn.primary { background: var(--accent); color: white; }
|
|
275
|
+
.action-btn.primary:hover { background: var(--accent-hover); }
|
|
276
|
+
.action-btn.secondary { background: var(--bg2); color: var(--text); border-color: var(--border); }
|
|
277
|
+
.action-btn.secondary:hover { background: var(--bg3); }
|
|
278
|
+
|
|
279
|
+
.last-updated { font-size: 12px; color: var(--text-muted); margin-top: 16px; text-align: right; }
|
|
280
|
+
|
|
281
|
+
/* Activity feed on dashboard */
|
|
282
|
+
.activity-feed { margin-top: 32px; }
|
|
283
|
+
.activity-feed h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px; }
|
|
284
|
+
.activity-list { display: flex; flex-direction: column; gap: 4px; }
|
|
285
|
+
.activity-item {
|
|
286
|
+
display: flex; align-items: center; gap: 10px;
|
|
287
|
+
padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--text-muted);
|
|
288
|
+
}
|
|
289
|
+
.activity-item:hover { background: var(--bg2); }
|
|
290
|
+
.activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
|
|
291
|
+
.activity-dot.daemon_started { background: var(--accent); }
|
|
292
|
+
.activity-dot.index_complete { background: var(--green); }
|
|
293
|
+
.activity-dot.index_started { background: var(--yellow); }
|
|
294
|
+
.activity-dot.session_indexed { background: var(--border); }
|
|
295
|
+
.activity-ts { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
|
|
296
|
+
|
|
297
|
+
/* \u2500\u2500 Search tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
298
|
+
#tab-search main { max-width: 860px; }
|
|
299
|
+
|
|
300
|
+
.search-bar { display: flex; gap: 10px; margin-bottom: 28px; }
|
|
301
|
+
.search-bar input[type="text"] {
|
|
302
|
+
flex: 1; background: var(--bg); border: 1px solid var(--border);
|
|
303
|
+
border-radius: 8px; padding: 10px 14px; color: var(--text);
|
|
304
|
+
font-family: inherit; font-size: 14px; outline: none; transition: border-color 0.15s;
|
|
305
|
+
}
|
|
306
|
+
.search-bar input[type="text"]:focus { border-color: var(--accent); }
|
|
307
|
+
.search-bar input[type="text"]::placeholder { color: var(--text-muted); }
|
|
308
|
+
.k-input {
|
|
309
|
+
width: 72px; background: var(--bg); border: 1px solid var(--border);
|
|
310
|
+
border-radius: 8px; padding: 10px; color: var(--text);
|
|
311
|
+
font-family: inherit; font-size: 14px; outline: none; text-align: center;
|
|
312
|
+
}
|
|
313
|
+
.search-bar button {
|
|
314
|
+
background: var(--accent); color: white; border: none; border-radius: 8px;
|
|
315
|
+
padding: 10px 20px; font-family: inherit; font-size: 14px; font-weight: 500;
|
|
316
|
+
cursor: pointer; transition: background 0.15s; white-space: nowrap;
|
|
317
|
+
}
|
|
318
|
+
.search-bar button:hover { background: var(--accent-hover); }
|
|
319
|
+
.search-bar button:disabled { opacity: 0.5; cursor: default; }
|
|
320
|
+
|
|
321
|
+
.latency-bar { display: flex; gap: 16px; margin-bottom: 20px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
|
|
322
|
+
.latency-bar span { display: flex; align-items: center; gap: 4px; }
|
|
323
|
+
.latency-bar strong { color: var(--text); }
|
|
324
|
+
|
|
325
|
+
.results { display: flex; flex-direction: column; gap: 12px; }
|
|
326
|
+
.card {
|
|
327
|
+
background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
|
|
328
|
+
padding: 16px 20px; transition: border-color 0.15s, background 0.15s;
|
|
329
|
+
}
|
|
330
|
+
.card:hover { border-color: var(--accent); background: var(--bg); }
|
|
331
|
+
.card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; cursor: pointer; }
|
|
332
|
+
.card-meta { flex: 1; min-width: 0; }
|
|
333
|
+
.card-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
|
|
334
|
+
.card-subtitle { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
335
|
+
.tag { background: var(--bg3); color: #475569; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
|
|
336
|
+
.score { color: var(--green); font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
337
|
+
.preview {
|
|
338
|
+
font-size: 13px; color: var(--text-muted); line-height: 1.5;
|
|
339
|
+
overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
|
|
340
|
+
cursor: pointer;
|
|
341
|
+
}
|
|
342
|
+
.expanded .preview { -webkit-line-clamp: unset; display: block; }
|
|
343
|
+
.expanded-body { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
|
|
344
|
+
.expanded .expanded-body { display: block; }
|
|
345
|
+
.card-actions { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
|
|
346
|
+
.view-btn {
|
|
347
|
+
font-family: inherit; font-size: 12px; padding: 5px 12px; border-radius: 6px;
|
|
348
|
+
cursor: pointer; border: 1px solid var(--accent-border); background: var(--accent-light);
|
|
349
|
+
color: var(--accent); font-weight: 500; transition: background 0.1s;
|
|
350
|
+
}
|
|
351
|
+
.view-btn:hover { background: var(--accent); color: white; }
|
|
352
|
+
|
|
353
|
+
/* \u2500\u2500 Activity tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
354
|
+
.activity-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
|
|
355
|
+
.activity-toolbar h2 { font-size: 16px; font-weight: 600; }
|
|
356
|
+
.badge { background: var(--bg3); color: var(--text-muted); padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; }
|
|
357
|
+
|
|
358
|
+
.activity-table { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
|
|
359
|
+
.activity-table thead { background: var(--bg3); }
|
|
360
|
+
.activity-table th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
|
|
361
|
+
.activity-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
|
|
362
|
+
.activity-table tr:last-child td { border-bottom: none; }
|
|
363
|
+
.activity-table tr:hover td { background: rgba(0,98,168,0.03); }
|
|
364
|
+
.type-badge {
|
|
365
|
+
display: inline-block; padding: 2px 8px; border-radius: 4px;
|
|
366
|
+
font-size: 11px; font-weight: 600; font-family: var(--mono);
|
|
367
|
+
}
|
|
368
|
+
.type-badge.daemon_started { background: var(--accent-light); color: var(--accent); }
|
|
369
|
+
.type-badge.index_started { background: var(--yellow-bg); color: var(--yellow); }
|
|
370
|
+
.type-badge.session_indexed { background: var(--bg3); color: var(--text-muted); }
|
|
371
|
+
.type-badge.index_complete { background: var(--green-bg); color: var(--green); }
|
|
372
|
+
|
|
373
|
+
/* \u2500\u2500 Debug tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
374
|
+
.debug-sections { display: flex; flex-direction: column; gap: 24px; }
|
|
375
|
+
.section { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
|
|
376
|
+
.section-header {
|
|
377
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
378
|
+
padding: 11px 16px; background: var(--bg3); border-bottom: 1px solid var(--border);
|
|
379
|
+
}
|
|
380
|
+
.section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
|
|
381
|
+
.section-actions { display: flex; gap: 8px; align-items: center; }
|
|
382
|
+
.meta-line { font-size: 11px; color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
|
|
383
|
+
|
|
384
|
+
.btn {
|
|
385
|
+
font-family: inherit; font-size: 12px; padding: 4px 10px; border-radius: 5px;
|
|
386
|
+
cursor: pointer; border: 1px solid var(--border); background: var(--bg2);
|
|
387
|
+
color: var(--text-muted); transition: background 0.1s;
|
|
388
|
+
}
|
|
389
|
+
.btn:hover { background: var(--bg); color: var(--text); }
|
|
390
|
+
|
|
391
|
+
.log-body {
|
|
392
|
+
background: var(--bg2); padding: 14px 16px;
|
|
393
|
+
font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: var(--text);
|
|
394
|
+
height: 340px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
|
|
395
|
+
}
|
|
396
|
+
.log-empty { color: var(--text-muted); font-style: italic; }
|
|
397
|
+
.log-line { display: block; }
|
|
398
|
+
.log-line:hover { background: var(--bg3); border-radius: 3px; }
|
|
399
|
+
.log-err { color: var(--red); }
|
|
400
|
+
.log-warn { color: var(--yellow); }
|
|
401
|
+
.log-ok { color: var(--green); }
|
|
402
|
+
|
|
403
|
+
.stats-strip { display: flex; background: var(--bg2); }
|
|
404
|
+
.stat-item { flex: 1; padding: 14px 16px; border-right: 1px solid var(--border); }
|
|
405
|
+
.stat-item:last-child { border-right: none; }
|
|
406
|
+
.stat-item .label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
|
|
407
|
+
.stat-item .value { font-size: 22px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
|
|
408
|
+
|
|
409
|
+
.config-table { width: 100%; border-collapse: collapse; }
|
|
410
|
+
.config-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
|
|
411
|
+
.config-table td { padding: 10px 16px; vertical-align: top; }
|
|
412
|
+
.config-table td:first-child { width: 200px; font-size: 12px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
|
|
413
|
+
.config-table td:last-child { font-family: var(--mono); font-size: 12px; word-break: break-all; }
|
|
414
|
+
|
|
415
|
+
.tool-grid { display: flex; flex-direction: column; background: var(--bg2); }
|
|
416
|
+
.tool-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 12px; }
|
|
417
|
+
.tool-row:last-child { border-bottom: none; }
|
|
418
|
+
.tool-desc { font-size: 13px; }
|
|
419
|
+
.tool-desc small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }
|
|
420
|
+
|
|
421
|
+
/* \u2500\u2500 Sessions tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
422
|
+
.sessions-toolbar {
|
|
423
|
+
display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
|
|
424
|
+
}
|
|
425
|
+
.sessions-toolbar h2 { font-size: 16px; font-weight: 600; }
|
|
426
|
+
.sessions-filter {
|
|
427
|
+
flex: 1; min-width: 160px; background: var(--bg); border: 1px solid var(--border);
|
|
428
|
+
border-radius: 8px; padding: 7px 12px; color: var(--text);
|
|
429
|
+
font-family: inherit; font-size: 13px; outline: none; transition: border-color 0.15s;
|
|
430
|
+
}
|
|
431
|
+
.sessions-filter:focus { border-color: var(--accent); }
|
|
432
|
+
.sessions-grid { display: flex; flex-direction: column; gap: 8px; }
|
|
433
|
+
.session-card {
|
|
434
|
+
background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
|
|
435
|
+
padding: 14px 18px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
|
|
436
|
+
display: flex; align-items: center; gap: 12px;
|
|
437
|
+
}
|
|
438
|
+
.session-card:hover { border-color: var(--accent); background: var(--bg); }
|
|
439
|
+
.session-card-body { flex: 1; min-width: 0; }
|
|
440
|
+
.session-card-title {
|
|
441
|
+
font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden;
|
|
442
|
+
text-overflow: ellipsis; margin-bottom: 5px;
|
|
443
|
+
}
|
|
444
|
+
.session-card-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
|
|
445
|
+
.session-id { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
|
|
446
|
+
.session-card-arrow { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }
|
|
447
|
+
|
|
448
|
+
/* \u2500\u2500 Session detail \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
449
|
+
.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
|
|
450
|
+
.back-btn {
|
|
451
|
+
background: none; border: 1px solid var(--border); border-radius: 6px;
|
|
452
|
+
padding: 5px 12px; font-family: inherit; font-size: 13px; color: var(--text-muted);
|
|
453
|
+
cursor: pointer; transition: background 0.15s; flex-shrink: 0;
|
|
454
|
+
}
|
|
455
|
+
.back-btn:hover { background: var(--bg3); color: var(--text); }
|
|
456
|
+
.detail-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
457
|
+
.detail-meta { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
|
|
458
|
+
.turns { display: flex; flex-direction: column; gap: 12px; }
|
|
459
|
+
.turn {
|
|
460
|
+
border-radius: 8px; padding: 14px 18px;
|
|
461
|
+
border: 1px solid var(--border); border-left-width: 3px;
|
|
462
|
+
}
|
|
463
|
+
.turn.user { border-left-color: var(--accent); background: var(--bg2); }
|
|
464
|
+
.turn.assistant { border-left-color: var(--green); background: var(--bg2); }
|
|
465
|
+
.turn-role {
|
|
466
|
+
font-size: 11px; font-weight: 700; text-transform: uppercase;
|
|
467
|
+
letter-spacing: 0.08em; margin-bottom: 8px;
|
|
468
|
+
}
|
|
469
|
+
.turn.user .turn-role { color: var(--accent); }
|
|
470
|
+
.turn.assistant .turn-role { color: var(--green); }
|
|
471
|
+
.turn-text { font-size: 13px; line-height: 1.65; }
|
|
472
|
+
.turn-text > *:last-child { margin-bottom: 0; }
|
|
473
|
+
.turn-text p { margin-bottom: 8px; }
|
|
474
|
+
.turn-text h1, .turn-text h2, .turn-text h3, .turn-text h4 {
|
|
475
|
+
font-weight: 700; letter-spacing: -0.02em; margin: 14px 0 6px;
|
|
476
|
+
}
|
|
477
|
+
.turn-text h1 { font-size: 16px; }
|
|
478
|
+
.turn-text h2 { font-size: 14px; }
|
|
479
|
+
.turn-text h3 { font-size: 13px; }
|
|
480
|
+
.turn-text h4 { font-size: 13px; color: var(--text-muted); }
|
|
481
|
+
.turn-text ul, .turn-text ol { padding-left: 20px; margin-bottom: 8px; }
|
|
482
|
+
.turn-text li { margin-bottom: 3px; }
|
|
483
|
+
.turn-text blockquote {
|
|
484
|
+
border-left: 3px solid var(--border); margin: 8px 0;
|
|
485
|
+
padding: 4px 12px; color: var(--text-muted); font-style: italic;
|
|
486
|
+
}
|
|
487
|
+
.turn-text hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
|
|
488
|
+
.turn-text a { color: var(--accent); text-decoration: none; }
|
|
489
|
+
.turn-text a:hover { text-decoration: underline; }
|
|
490
|
+
.turn-text code {
|
|
491
|
+
font-family: var(--mono); font-size: 12px;
|
|
492
|
+
background: var(--bg3); padding: 1px 5px; border-radius: 3px;
|
|
493
|
+
}
|
|
494
|
+
.turn-text pre {
|
|
495
|
+
background: var(--bg3); border-radius: 6px; padding: 10px 12px;
|
|
496
|
+
margin: 8px 0; overflow-x: auto; font-size: 12px; font-family: var(--mono); line-height: 1.5;
|
|
497
|
+
}
|
|
498
|
+
.turn-text pre code { background: none; padding: 0; }
|
|
499
|
+
/* Thinking block */
|
|
500
|
+
.agent-thinking {
|
|
501
|
+
margin-top: 10px;
|
|
502
|
+
border: 1px solid #c4b5fd; border-radius: 6px; overflow: hidden;
|
|
503
|
+
}
|
|
504
|
+
.agent-thinking > summary {
|
|
505
|
+
padding: 7px 12px; font-size: 12px; cursor: pointer;
|
|
506
|
+
background: #f5f3ff; user-select: none;
|
|
507
|
+
list-style: none; display: flex; align-items: center; gap: 6px;
|
|
508
|
+
color: #7c3aed; font-weight: 500;
|
|
509
|
+
}
|
|
510
|
+
.agent-thinking > summary::-webkit-details-marker { display: none; }
|
|
511
|
+
.agent-thinking > summary::before {
|
|
512
|
+
content: '\u25B6'; font-size: 9px; transition: transform 0.15s; flex-shrink: 0; color: #7c3aed;
|
|
513
|
+
}
|
|
514
|
+
.agent-thinking[open] > summary::before { transform: rotate(90deg); }
|
|
515
|
+
.agent-thinking-body {
|
|
516
|
+
padding: 10px 14px; font-size: 12px; line-height: 1.65;
|
|
517
|
+
background: #faf5ff; color: #6d28d9; font-style: italic;
|
|
518
|
+
white-space: pre-wrap; word-break: break-word; max-height: 400px; overflow-y: auto;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/* Agent actions collapsible wrapper */
|
|
522
|
+
.agent-actions {
|
|
523
|
+
margin-top: 10px;
|
|
524
|
+
border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
|
|
525
|
+
}
|
|
526
|
+
.agent-actions > summary {
|
|
527
|
+
padding: 7px 12px; font-size: 12px; cursor: pointer;
|
|
528
|
+
background: var(--bg3); user-select: none;
|
|
529
|
+
list-style: none; display: flex; align-items: center; gap: 6px;
|
|
530
|
+
color: var(--text-muted); font-weight: 500;
|
|
531
|
+
}
|
|
532
|
+
.agent-actions > summary::-webkit-details-marker { display: none; }
|
|
533
|
+
.agent-actions > summary::before {
|
|
534
|
+
content: '\u25B6'; font-size: 9px; transition: transform 0.15s; flex-shrink: 0; color: var(--text-muted);
|
|
535
|
+
}
|
|
536
|
+
.agent-actions[open] > summary::before { transform: rotate(90deg); }
|
|
537
|
+
.agent-actions-body {
|
|
538
|
+
display: flex; flex-direction: column; gap: 1px;
|
|
539
|
+
background: var(--border);
|
|
540
|
+
}
|
|
541
|
+
.tool-detail { overflow: hidden; }
|
|
542
|
+
.tool-detail summary {
|
|
543
|
+
padding: 7px 12px; font-size: 12px; font-family: var(--mono);
|
|
544
|
+
cursor: pointer; background: var(--bg2); user-select: none;
|
|
545
|
+
list-style: none; display: flex; align-items: center; gap: 6px;
|
|
546
|
+
color: var(--text-muted);
|
|
547
|
+
}
|
|
548
|
+
.tool-detail summary::-webkit-details-marker { display: none; }
|
|
549
|
+
.tool-detail summary::before {
|
|
550
|
+
content: '\u25B6'; font-size: 9px; transition: transform 0.15s; flex-shrink: 0; color: var(--text-muted);
|
|
551
|
+
}
|
|
552
|
+
.tool-detail[open] summary::before { transform: rotate(90deg); }
|
|
553
|
+
.tool-detail .tool-content {
|
|
554
|
+
padding: 10px 12px; font-size: 12px; font-family: var(--mono);
|
|
555
|
+
background: var(--bg2); white-space: pre-wrap; word-break: break-all;
|
|
556
|
+
max-height: 300px; overflow-y: auto; color: var(--text-muted);
|
|
557
|
+
border-top: 1px solid var(--border);
|
|
558
|
+
}
|
|
559
|
+
.turn-ts { font-size: 11px; color: var(--text-muted); margin-top: 10px; font-family: var(--mono); }
|
|
560
|
+
|
|
561
|
+
/* \u2500\u2500 Mobile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
562
|
+
@media (max-width: 600px) {
|
|
563
|
+
header { padding: 10px 14px; gap: 8px; }
|
|
564
|
+
header h1 { font-size: 14px; }
|
|
565
|
+
nav { gap: 2px; overflow-x: auto; flex-shrink: 1; }
|
|
566
|
+
nav button { font-size: 11px; padding: 5px 7px; white-space: nowrap; }
|
|
567
|
+
main { padding: 16px 12px; max-width: 100%; }
|
|
568
|
+
.stats-grid { grid-template-columns: 1fr 1fr; }
|
|
569
|
+
.info-grid { grid-template-columns: 1fr; }
|
|
570
|
+
.actions { flex-wrap: wrap; }
|
|
571
|
+
.search-bar { flex-wrap: wrap; }
|
|
572
|
+
.search-bar .k-input { width: 60px; }
|
|
573
|
+
.turn-text pre { overflow-x: auto; }
|
|
574
|
+
.detail-title { font-size: 15px; }
|
|
575
|
+
.stat-value { font-size: 22px; }
|
|
576
|
+
.stats-strip { flex-wrap: wrap; }
|
|
577
|
+
.stat-item { min-width: 50%; border-bottom: 1px solid var(--border); }
|
|
578
|
+
.sessions-toolbar { flex-direction: column; align-items: flex-start; }
|
|
579
|
+
.sessions-filter { width: 100%; }
|
|
580
|
+
.detail-header { gap: 8px; }
|
|
581
|
+
}
|
|
582
|
+
</style>
|
|
583
|
+
</head>
|
|
584
|
+
<body>
|
|
585
|
+
<header>
|
|
586
|
+
<div class="logo">q</div>
|
|
587
|
+
<h1>qrec</h1>
|
|
588
|
+
<nav>
|
|
589
|
+
<button id="nav-dashboard" onclick="showTab('dashboard')">Dashboard</button>
|
|
590
|
+
<button id="nav-search" onclick="showTab('search')">Search</button>
|
|
591
|
+
<button id="nav-sessions" onclick="showTab('sessions')">Sessions</button>
|
|
592
|
+
<button id="nav-activity" onclick="showTab('activity')">Activity</button>
|
|
593
|
+
<button id="nav-debug" onclick="showTab('debug')">Debug</button>
|
|
594
|
+
</nav>
|
|
595
|
+
</header>
|
|
596
|
+
|
|
597
|
+
<!-- \u2500\u2500 Dashboard tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
598
|
+
<div id="tab-dashboard" class="tab-panel">
|
|
599
|
+
<main>
|
|
600
|
+
<div id="db-loading" class="loading-state"><span class="spinner"></span></div>
|
|
601
|
+
<div id="db-error" class="error-state" style="display:none;"></div>
|
|
602
|
+
|
|
603
|
+
<div class="onboarding-wrap" id="onboarding">
|
|
604
|
+
<h2>Welcome to qrec</h2>
|
|
605
|
+
<p class="subtitle">Complete the steps below to set up your session recall engine.</p>
|
|
606
|
+
<div class="steps" id="steps"></div>
|
|
607
|
+
</div>
|
|
608
|
+
|
|
609
|
+
<div class="dashboard-wrap" id="dashboard">
|
|
610
|
+
<div class="dashboard-header">
|
|
611
|
+
<h2>Dashboard</h2>
|
|
612
|
+
<div style="display:flex;align-items:center;gap:10px;">
|
|
613
|
+
<span class="status-pill"><span class="status-dot"></span>Running</span>
|
|
614
|
+
<button class="action-btn secondary" onclick="loadDashboard()" style="padding:6px 12px;font-size:12px;">\u21BB Refresh</button>
|
|
615
|
+
</div>
|
|
616
|
+
</div>
|
|
617
|
+
|
|
618
|
+
<div class="stats-grid">
|
|
619
|
+
<div class="stat-card">
|
|
620
|
+
<div class="stat-label">Sessions</div>
|
|
621
|
+
<div class="stat-value" id="stat-sessions">\u2014</div>
|
|
622
|
+
<div class="stat-sub">indexed</div>
|
|
623
|
+
</div>
|
|
624
|
+
<div class="stat-card">
|
|
625
|
+
<div class="stat-label">Chunks</div>
|
|
626
|
+
<div class="stat-value" id="stat-chunks">\u2014</div>
|
|
627
|
+
<div class="stat-sub">searchable units</div>
|
|
628
|
+
</div>
|
|
629
|
+
<div class="stat-card">
|
|
630
|
+
<div class="stat-label">Searches</div>
|
|
631
|
+
<div class="stat-value" id="stat-searches">\u2014</div>
|
|
632
|
+
<div class="stat-sub">queries run</div>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
|
|
636
|
+
<div class="info-grid">
|
|
637
|
+
<div class="info-row">
|
|
638
|
+
<span class="info-key">Embed provider</span>
|
|
639
|
+
<span class="info-val"><span class="provider-badge" id="info-provider">\u2014</span></span>
|
|
640
|
+
</div>
|
|
641
|
+
<div class="info-row">
|
|
642
|
+
<span class="info-key">Last indexed</span>
|
|
643
|
+
<span class="info-val" id="info-last-indexed">\u2014</span>
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
|
|
647
|
+
<div class="actions">
|
|
648
|
+
<button class="action-btn primary" onclick="showTab('search')">Search sessions \u2192</button>
|
|
649
|
+
<button class="action-btn secondary" onclick="showTab('sessions')">Browse sessions</button>
|
|
650
|
+
<button class="action-btn secondary" onclick="showTab('activity')">Activity log</button>
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
<div class="activity-feed" id="db-activity-feed">
|
|
654
|
+
<h3>Recent activity</h3>
|
|
655
|
+
<div class="activity-list" id="db-activity-list"></div>
|
|
656
|
+
</div>
|
|
657
|
+
|
|
658
|
+
<div class="last-updated" id="db-last-updated"></div>
|
|
659
|
+
</div>
|
|
660
|
+
</main>
|
|
661
|
+
</div>
|
|
662
|
+
|
|
663
|
+
<!-- \u2500\u2500 Search tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
664
|
+
<div id="tab-search" class="tab-panel">
|
|
665
|
+
<main style="max-width:860px;">
|
|
666
|
+
<div class="search-bar">
|
|
667
|
+
<input type="text" id="query" placeholder="Search sessions\u2026">
|
|
668
|
+
<input type="number" id="k" class="k-input" value="10" min="1" max="50" title="Results (k)">
|
|
669
|
+
<button id="search-btn" onclick="doSearch()">Search</button>
|
|
670
|
+
</div>
|
|
671
|
+
<div id="latency-bar" class="latency-bar" style="display:none;"></div>
|
|
672
|
+
<div id="results" class="results"></div>
|
|
673
|
+
</main>
|
|
674
|
+
</div>
|
|
675
|
+
|
|
676
|
+
<!-- \u2500\u2500 Sessions tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
677
|
+
<div id="tab-sessions" class="tab-panel">
|
|
678
|
+
<main>
|
|
679
|
+
<div class="sessions-toolbar">
|
|
680
|
+
<h2>Sessions</h2>
|
|
681
|
+
<span class="badge" id="sessions-count">\u2014</span>
|
|
682
|
+
<input type="text" class="sessions-filter" id="sessions-filter" placeholder="Filter by title or project\u2026" oninput="filterSessions()">
|
|
683
|
+
</div>
|
|
684
|
+
<div id="sessions-content">
|
|
685
|
+
<div class="loading-state"><span class="spinner"></span></div>
|
|
686
|
+
</div>
|
|
687
|
+
</main>
|
|
688
|
+
</div>
|
|
689
|
+
|
|
690
|
+
<!-- \u2500\u2500 Session detail \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
691
|
+
<div id="tab-session-detail" class="tab-panel">
|
|
692
|
+
<main style="max-width:860px;">
|
|
693
|
+
<div id="detail-loading" class="loading-state"><span class="spinner"></span></div>
|
|
694
|
+
<div id="detail-error" class="error-state" style="display:none;"></div>
|
|
695
|
+
<div id="detail-content" style="display:none;">
|
|
696
|
+
<div class="detail-header">
|
|
697
|
+
<button class="back-btn" id="detail-back-btn" onclick="goBack()">\u2190 Back</button>
|
|
698
|
+
<div class="detail-title" id="detail-title"></div>
|
|
699
|
+
</div>
|
|
700
|
+
<div class="detail-meta" id="detail-meta"></div>
|
|
701
|
+
<div class="turns" id="detail-turns"></div>
|
|
702
|
+
</div>
|
|
703
|
+
</main>
|
|
704
|
+
</div>
|
|
705
|
+
|
|
706
|
+
<!-- \u2500\u2500 Activity tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
707
|
+
<div id="tab-activity" class="tab-panel">
|
|
708
|
+
<main>
|
|
709
|
+
<div class="activity-toolbar">
|
|
710
|
+
<h2>Activity Log</h2>
|
|
711
|
+
<span class="badge" id="activity-count">\u2014</span>
|
|
712
|
+
</div>
|
|
713
|
+
<div id="activity-content">
|
|
714
|
+
<div class="empty-state"><span class="spinner"></span></div>
|
|
715
|
+
</div>
|
|
716
|
+
</main>
|
|
717
|
+
</div>
|
|
718
|
+
|
|
719
|
+
<!-- \u2500\u2500 Debug tab \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->
|
|
720
|
+
<div id="tab-debug" class="tab-panel">
|
|
721
|
+
<main>
|
|
722
|
+
<div class="debug-sections">
|
|
723
|
+
|
|
724
|
+
<div class="section">
|
|
725
|
+
<div class="section-header">
|
|
726
|
+
<span class="section-title">Live stats</span>
|
|
727
|
+
<span class="meta-line" id="dbg-stats-meta">Loading\u2026</span>
|
|
728
|
+
</div>
|
|
729
|
+
<div class="stats-strip">
|
|
730
|
+
<div class="stat-item"><div class="label">Sessions</div><div class="value" id="dbg-sessions">\u2014</div></div>
|
|
731
|
+
<div class="stat-item"><div class="label">Chunks</div><div class="value" id="dbg-chunks">\u2014</div></div>
|
|
732
|
+
<div class="stat-item"><div class="label">Searches</div><div class="value" id="dbg-searches">\u2014</div></div>
|
|
733
|
+
<div class="stat-item"><div class="label">Provider</div><div class="value" id="dbg-provider" style="font-size:13px;font-family:'Menlo',monospace;">\u2014</div></div>
|
|
734
|
+
</div>
|
|
735
|
+
</div>
|
|
736
|
+
|
|
737
|
+
<div class="section">
|
|
738
|
+
<div class="section-header">
|
|
739
|
+
<span class="section-title">Server log</span>
|
|
740
|
+
<div class="section-actions">
|
|
741
|
+
<span class="meta-line" id="dbg-log-meta">Loading\u2026</span>
|
|
742
|
+
<button class="btn" onclick="fetchLog()">Refresh</button>
|
|
743
|
+
<button class="btn" id="autoscroll-btn" onclick="toggleAutoscroll()">Autoscroll: on</button>
|
|
744
|
+
</div>
|
|
745
|
+
</div>
|
|
746
|
+
<div class="log-body" id="dbg-log-body">
|
|
747
|
+
<span class="log-empty">Loading log\u2026</span>
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
751
|
+
<div class="section">
|
|
752
|
+
<div class="section-header"><span class="section-title">Configuration</span></div>
|
|
753
|
+
<table class="config-table" id="dbg-config-table">
|
|
754
|
+
<tr><td colspan="2" style="padding:20px;color:var(--text-muted);font-size:13px;"><span class="spinner"></span> Loading\u2026</td></tr>
|
|
755
|
+
</table>
|
|
756
|
+
</div>
|
|
757
|
+
|
|
758
|
+
<div class="section">
|
|
759
|
+
<div class="section-header"><span class="section-title">Test tools</span></div>
|
|
760
|
+
<div class="tool-grid">
|
|
761
|
+
<div class="tool-row">
|
|
762
|
+
<div class="tool-desc">
|
|
763
|
+
Health check
|
|
764
|
+
<small>GET /health \u2014 verifies the server is responding.</small>
|
|
765
|
+
</div>
|
|
766
|
+
<button class="btn" onclick="runHealth()">Run</button>
|
|
767
|
+
</div>
|
|
768
|
+
<div class="tool-row">
|
|
769
|
+
<div class="tool-desc">
|
|
770
|
+
Test search
|
|
771
|
+
<small>POST /search \u2014 sends a sample query and shows raw JSON response.</small>
|
|
772
|
+
</div>
|
|
773
|
+
<button class="btn" onclick="runSearch()">Run</button>
|
|
774
|
+
</div>
|
|
775
|
+
</div>
|
|
776
|
+
<div id="tool-output" style="display:none;padding:14px 16px;background:var(--bg2);border-top:1px solid var(--border);">
|
|
777
|
+
<pre id="tool-pre" style="font-family:'Menlo',monospace;font-size:11.5px;white-space:pre-wrap;word-break:break-all;color:var(--text);max-height:200px;overflow:auto;"></pre>
|
|
778
|
+
</div>
|
|
779
|
+
</div>
|
|
780
|
+
|
|
781
|
+
</div>
|
|
782
|
+
</main>
|
|
783
|
+
</div>
|
|
784
|
+
|
|
785
|
+
<script>
|
|
786
|
+
// \u2500\u2500 Tab routing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
787
|
+
|
|
788
|
+
let _detailOrigin = 'sessions'; // tracks where session detail was opened from
|
|
789
|
+
|
|
790
|
+
function navigate(hash) {
|
|
791
|
+
if (!hash) hash = 'dashboard';
|
|
792
|
+
if (hash.startsWith('session/')) {
|
|
793
|
+
const id = hash.slice('session/'.length);
|
|
794
|
+
openSessionDetail(id);
|
|
795
|
+
history.replaceState(null, '', '#' + hash);
|
|
796
|
+
} else {
|
|
797
|
+
showTab(hash);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function showTab(name) {
|
|
802
|
+
document.querySelectorAll('.tab-panel').forEach(p => p.classList.remove('active'));
|
|
803
|
+
document.querySelectorAll('nav button').forEach(b => b.classList.remove('active'));
|
|
804
|
+
const panel = document.getElementById('tab-' + name);
|
|
805
|
+
if (panel) panel.classList.add('active');
|
|
806
|
+
const btn = document.getElementById('nav-' + name);
|
|
807
|
+
if (btn) btn.classList.add('active');
|
|
808
|
+
history.replaceState(null, '', '#' + name);
|
|
809
|
+
onTabActivated(name);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function onTabActivated(name) {
|
|
813
|
+
if (name === 'dashboard') loadDashboard();
|
|
814
|
+
if (name === 'activity') loadActivity();
|
|
815
|
+
if (name === 'sessions') loadSessions();
|
|
816
|
+
if (name === 'debug') { fetchStats(); fetchLog(); fetchConfig(); }
|
|
817
|
+
if (name === 'search') document.getElementById('query')?.focus();
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// Initial tab from URL path or hash
|
|
821
|
+
const initHash = location.hash.slice(1) || 'dashboard';
|
|
822
|
+
navigate(initHash);
|
|
823
|
+
window.addEventListener('hashchange', () => navigate(location.hash.slice(1) || 'dashboard'));
|
|
824
|
+
|
|
825
|
+
// \u2500\u2500 Shared polling \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
826
|
+
|
|
827
|
+
setInterval(() => {
|
|
828
|
+
const active = document.querySelector('.tab-panel.active')?.id?.replace('tab-', '');
|
|
829
|
+
if (active === 'dashboard') loadDashboard();
|
|
830
|
+
if (active === 'activity') loadActivity();
|
|
831
|
+
if (active === 'sessions') loadSessions();
|
|
832
|
+
if (active === 'debug') { fetchStats(); fetchLog(); }
|
|
833
|
+
}, 5000);
|
|
834
|
+
|
|
835
|
+
// \u2500\u2500 Utilities \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
836
|
+
|
|
837
|
+
function escHtml(s) {
|
|
838
|
+
return String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function formatRelative(ts) {
|
|
842
|
+
const diff = Math.floor((Date.now() - ts) / 1000);
|
|
843
|
+
if (diff < 60) return 'just now';
|
|
844
|
+
if (diff < 3600) return Math.floor(diff / 60) + 'm ago';
|
|
845
|
+
if (diff < 86400) return Math.floor(diff / 3600) + 'h ago';
|
|
846
|
+
return Math.floor(diff / 86400) + 'd ago';
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
function formatDate(ts) {
|
|
850
|
+
return new Date(ts).toLocaleString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/** Render markdown to HTML using marked, falling back to plain text. */
|
|
854
|
+
function renderText(text) {
|
|
855
|
+
if (!text) return '';
|
|
856
|
+
if (typeof marked !== 'undefined') {
|
|
857
|
+
return marked.parse(text, { breaks: true, gfm: true });
|
|
858
|
+
}
|
|
859
|
+
// Fallback: escape and preserve line breaks
|
|
860
|
+
return '<p>' + escHtml(text).replace(/\\n{2,}/g, '</p><p>').replace(/\\n/g, '<br>') + '</p>';
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// \u2500\u2500 Dashboard \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
864
|
+
|
|
865
|
+
async function loadDashboard() {
|
|
866
|
+
try {
|
|
867
|
+
const [statusRes, actRes] = await Promise.all([
|
|
868
|
+
fetch('/status'),
|
|
869
|
+
fetch('/activity/entries?limit=20'),
|
|
870
|
+
]);
|
|
871
|
+
if (!statusRes.ok) throw new Error(\`HTTP \${statusRes.status}\`);
|
|
872
|
+
const data = await statusRes.json();
|
|
873
|
+
const { entries: actEntries } = actRes.ok ? await actRes.json() : { entries: [] };
|
|
874
|
+
|
|
875
|
+
document.getElementById('db-loading').style.display = 'none';
|
|
876
|
+
document.getElementById('db-error').style.display = 'none';
|
|
877
|
+
|
|
878
|
+
const isReady = data.phase === 'ready' && data.sessions > 0;
|
|
879
|
+
if (isReady) {
|
|
880
|
+
document.getElementById('onboarding').style.display = 'none';
|
|
881
|
+
showDashboardPanel(data, actEntries);
|
|
882
|
+
} else {
|
|
883
|
+
document.getElementById('dashboard').style.display = 'none';
|
|
884
|
+
showOnboarding(data);
|
|
885
|
+
}
|
|
886
|
+
} catch (err) {
|
|
887
|
+
document.getElementById('db-loading').style.display = 'none';
|
|
888
|
+
const el = document.getElementById('db-error');
|
|
889
|
+
el.style.display = '';
|
|
890
|
+
el.textContent = 'Could not connect to qrec server: ' + String(err);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function showOnboarding(data) {
|
|
895
|
+
const phase = data.phase ?? 'ready';
|
|
896
|
+
const dl = data.modelDownload ?? { percent: 0, downloadedMB: 0, totalMB: null };
|
|
897
|
+
const idx = data.indexing ?? { indexed: 0, total: 0, current: '' };
|
|
898
|
+
|
|
899
|
+
const modelDone = ['indexing', 'ready'].includes(phase);
|
|
900
|
+
const indexDone = phase === 'ready' && data.sessions > 0;
|
|
901
|
+
const indexActive = phase === 'indexing';
|
|
902
|
+
const searchDone = data.searches > 0;
|
|
903
|
+
|
|
904
|
+
const steps = [
|
|
905
|
+
{
|
|
906
|
+
state: 'done',
|
|
907
|
+
title: 'Server is running',
|
|
908
|
+
desc: 'The qrec HTTP server is up and accepting requests.',
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
state: modelDone ? 'done' : 'active',
|
|
912
|
+
title: modelDone ? 'Embedding model ready'
|
|
913
|
+
: phase === 'model_download' ? 'Downloading embedding model\u2026'
|
|
914
|
+
: 'Loading embedding model\u2026',
|
|
915
|
+
desc: modelDone ? \`\${escHtml(data.embedProvider)} provider loaded.\`
|
|
916
|
+
: phase === 'model_download'
|
|
917
|
+
? \`\${dl.downloadedMB} MB\${dl.totalMB ? ' / ' + dl.totalMB + ' MB' : ''} downloaded\`
|
|
918
|
+
: 'Loading model into memory\u2026',
|
|
919
|
+
progress: !modelDone ? {
|
|
920
|
+
percent: phase === 'model_download' ? dl.percent : null,
|
|
921
|
+
label: phase === 'model_download'
|
|
922
|
+
? \`\${dl.percent}%\${dl.totalMB ? ' \u2014 ' + dl.downloadedMB + ' / ' + dl.totalMB + ' MB' : ''}\`
|
|
923
|
+
: 'Loading\u2026',
|
|
924
|
+
} : null,
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
state: indexDone ? 'done' : indexActive ? 'active' : 'pending',
|
|
928
|
+
title: indexDone
|
|
929
|
+
? \`Sessions indexed (\${data.sessions.toLocaleString()})\`
|
|
930
|
+
: indexActive
|
|
931
|
+
? \`Indexing sessions\u2026 (\${idx.indexed}\${idx.total ? ' / ' + idx.total : ''})\`
|
|
932
|
+
: 'Indexing sessions',
|
|
933
|
+
desc: indexDone
|
|
934
|
+
? \`\${data.chunks.toLocaleString()} chunks ready to search.\`
|
|
935
|
+
: indexActive
|
|
936
|
+
? (idx.current ? \`Current: \${idx.current}\` : 'Scanning your Claude Code session history\u2026')
|
|
937
|
+
: 'Will start automatically after model loads.',
|
|
938
|
+
progress: indexActive ? {
|
|
939
|
+
percent: idx.total > 0 ? Math.round((idx.indexed / idx.total) * 100) : null,
|
|
940
|
+
label: idx.total > 0 ? \`\${idx.indexed} / \${idx.total} sessions\` : \`\${idx.indexed} sessions indexed\u2026\`,
|
|
941
|
+
} : null,
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
state: searchDone ? 'done' : (indexDone ? 'active' : 'pending'),
|
|
945
|
+
title: searchDone ? 'First search complete' : 'Run your first search',
|
|
946
|
+
desc: searchDone
|
|
947
|
+
? 'qrec is fully set up and working.'
|
|
948
|
+
: 'Open the search tab and try a query \u2014 or use the MCP tool in Claude.',
|
|
949
|
+
link: (!searchDone && indexDone) ? { label: 'Go to search \u2192', tab: 'search' } : null,
|
|
950
|
+
},
|
|
951
|
+
];
|
|
952
|
+
|
|
953
|
+
const stepsEl = document.getElementById('steps');
|
|
954
|
+
stepsEl.innerHTML = '';
|
|
955
|
+
steps.forEach((s, i) => {
|
|
956
|
+
const div = document.createElement('div');
|
|
957
|
+
div.className = 'step' + (s.state === 'done' ? ' done' : s.state === 'active' ? ' active' : '');
|
|
958
|
+
|
|
959
|
+
const iconHtml = s.state === 'done' ? '\u2713'
|
|
960
|
+
: s.state === 'active' ? \`<span class="spinner" style="width:14px;height:14px;border-width:2px;"></span>\`
|
|
961
|
+
: String(i + 1);
|
|
962
|
+
|
|
963
|
+
const progressHtml = s.progress ? \`
|
|
964
|
+
<div class="progress-wrap">
|
|
965
|
+
<div class="progress-label">
|
|
966
|
+
<span>\${escHtml(s.progress.label)}</span>
|
|
967
|
+
\${s.progress.percent != null ? \`<strong>\${s.progress.percent}%</strong>\` : ''}
|
|
968
|
+
</div>
|
|
969
|
+
<div class="progress-track">
|
|
970
|
+
<div class="progress-fill \${s.progress.percent == null ? 'indeterminate' : ''}"
|
|
971
|
+
style="width:\${s.progress.percent ?? 40}%"></div>
|
|
972
|
+
</div>
|
|
973
|
+
</div>\` : '';
|
|
974
|
+
|
|
975
|
+
const linkHtml = s.link
|
|
976
|
+
? \`<div style="margin-top:10px;"><button class="action-btn primary" style="display:inline-flex;" onclick="showTab('\${s.link.tab}')">\${s.link.label}</button></div>\`
|
|
977
|
+
: '';
|
|
978
|
+
|
|
979
|
+
div.innerHTML = \`
|
|
980
|
+
<div class="step-icon">\${iconHtml}</div>
|
|
981
|
+
<div class="step-body">
|
|
982
|
+
<div class="step-title">\${escHtml(s.title)}</div>
|
|
983
|
+
<div class="step-desc">\${escHtml(s.desc)}</div>
|
|
984
|
+
\${progressHtml}\${linkHtml}
|
|
985
|
+
</div>
|
|
986
|
+
\`;
|
|
987
|
+
stepsEl.appendChild(div);
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
document.getElementById('onboarding').style.display = 'block';
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function showDashboardPanel(data, actEntries) {
|
|
994
|
+
document.getElementById('stat-sessions').textContent = data.sessions.toLocaleString();
|
|
995
|
+
document.getElementById('stat-chunks').textContent = data.chunks.toLocaleString();
|
|
996
|
+
document.getElementById('stat-searches').textContent = data.searches.toLocaleString();
|
|
997
|
+
document.getElementById('info-provider').textContent = data.embedProvider;
|
|
998
|
+
document.getElementById('info-last-indexed').textContent =
|
|
999
|
+
data.lastIndexedAt ? formatRelative(data.lastIndexedAt) : '\u2014';
|
|
1000
|
+
document.getElementById('db-last-updated').textContent = 'Last updated ' + new Date().toLocaleTimeString();
|
|
1001
|
+
|
|
1002
|
+
// Activity feed
|
|
1003
|
+
const listEl = document.getElementById('db-activity-list');
|
|
1004
|
+
if (actEntries && actEntries.length > 0) {
|
|
1005
|
+
listEl.innerHTML = actEntries.slice(0, 8).map(e => {
|
|
1006
|
+
const label = activityLabel(e);
|
|
1007
|
+
return \`<div class="activity-item">
|
|
1008
|
+
<div class="activity-dot \${escHtml(e.type)}"></div>
|
|
1009
|
+
<span>\${escHtml(label)}</span>
|
|
1010
|
+
<span class="activity-ts">\${formatRelative(e.ts)}</span>
|
|
1011
|
+
</div>\`;
|
|
1012
|
+
}).join('');
|
|
1013
|
+
document.getElementById('db-activity-feed').style.display = '';
|
|
1014
|
+
} else {
|
|
1015
|
+
document.getElementById('db-activity-feed').style.display = 'none';
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
document.getElementById('dashboard').style.display = 'block';
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
function activityLabel(e) {
|
|
1022
|
+
switch (e.type) {
|
|
1023
|
+
case 'daemon_started': return 'Daemon started';
|
|
1024
|
+
case 'index_started': return 'Index scan started';
|
|
1025
|
+
case 'session_indexed': return \`Indexed session \${e.data?.sessionId ?? ''}\`;
|
|
1026
|
+
case 'index_complete': {
|
|
1027
|
+
const n = e.data?.newSessions ?? 0;
|
|
1028
|
+
const ms = e.data?.durationMs ? \` (\${Math.round(e.data.durationMs)}ms)\` : '';
|
|
1029
|
+
return \`Index complete \u2014 \${n} new session\${n === 1 ? '' : 's'}\${ms}\`;
|
|
1030
|
+
}
|
|
1031
|
+
default: return String(e.type);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// \u2500\u2500 Search \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1036
|
+
|
|
1037
|
+
document.getElementById('query').addEventListener('keydown', e => {
|
|
1038
|
+
if (e.key === 'Enter') doSearch();
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
async function doSearch() {
|
|
1042
|
+
const query = document.getElementById('query').value.trim();
|
|
1043
|
+
if (!query) return;
|
|
1044
|
+
const k = parseInt(document.getElementById('k').value, 10) || 10;
|
|
1045
|
+
|
|
1046
|
+
const btn = document.getElementById('search-btn');
|
|
1047
|
+
const resultsEl = document.getElementById('results');
|
|
1048
|
+
const latencyEl = document.getElementById('latency-bar');
|
|
1049
|
+
btn.disabled = true;
|
|
1050
|
+
btn.innerHTML = '<span class="spinner"></span>';
|
|
1051
|
+
resultsEl.innerHTML = '';
|
|
1052
|
+
latencyEl.style.display = 'none';
|
|
1053
|
+
|
|
1054
|
+
try {
|
|
1055
|
+
const res = await fetch('/search', {
|
|
1056
|
+
method: 'POST',
|
|
1057
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1058
|
+
body: JSON.stringify({ query, k }),
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
if (!res.ok) {
|
|
1062
|
+
const err = await res.json().catch(() => ({ error: res.statusText }));
|
|
1063
|
+
resultsEl.innerHTML = \`<div class="error-state">Error: \${escHtml(err.error ?? 'Search failed')}</div>\`;
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
const { results } = await res.json();
|
|
1068
|
+
if (!results || results.length === 0) {
|
|
1069
|
+
resultsEl.innerHTML = '<div class="empty-state">No results found.</div>';
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const lat = results[0].latency;
|
|
1074
|
+
latencyEl.style.display = 'flex';
|
|
1075
|
+
latencyEl.innerHTML = \`
|
|
1076
|
+
<span>BM25 <strong>\${lat.bm25Ms.toFixed(1)}ms</strong></span>
|
|
1077
|
+
<span>Embed <strong>\${lat.embedMs.toFixed(1)}ms</strong></span>
|
|
1078
|
+
<span>KNN <strong>\${lat.knnMs.toFixed(1)}ms</strong></span>
|
|
1079
|
+
<span>Fusion <strong>\${lat.fusionMs.toFixed(1)}ms</strong></span>
|
|
1080
|
+
<span>Total <strong>\${lat.totalMs.toFixed(1)}ms</strong></span>
|
|
1081
|
+
<span>\${results.length} results</span>
|
|
1082
|
+
\`;
|
|
1083
|
+
|
|
1084
|
+
resultsEl.innerHTML = results.map((r, i) => \`
|
|
1085
|
+
<div class="card" data-session="\${escHtml(r.session_id)}" data-idx="\${i}">
|
|
1086
|
+
<div class="card-header" onclick="toggleCard(this.closest('.card'))">
|
|
1087
|
+
<div class="card-meta">
|
|
1088
|
+
<div class="card-title">\${escHtml(r.title || r.session_id)}</div>
|
|
1089
|
+
<div class="card-subtitle">
|
|
1090
|
+
<span class="tag">\${escHtml(r.project)}</span>
|
|
1091
|
+
<span class="tag">\${escHtml(r.date)}</span>
|
|
1092
|
+
<span class="tag">\${escHtml(r.session_id)}</span>
|
|
1093
|
+
</div>
|
|
1094
|
+
</div>
|
|
1095
|
+
<div class="score">\${r.score.toFixed(4)}</div>
|
|
1096
|
+
</div>
|
|
1097
|
+
<div class="preview" onclick="toggleCard(this.closest('.card'))">\${escHtml(r.preview)}</div>
|
|
1098
|
+
<div class="card-actions">
|
|
1099
|
+
<button class="view-btn" onclick="openFromSearch('\${escHtml(r.session_id)}')">View session \u2192</button>
|
|
1100
|
+
</div>
|
|
1101
|
+
</div>
|
|
1102
|
+
\`).join('');
|
|
1103
|
+
} catch (err) {
|
|
1104
|
+
resultsEl.innerHTML = \`<div class="error-state">Error: \${escHtml(String(err))}</div>\`;
|
|
1105
|
+
} finally {
|
|
1106
|
+
btn.disabled = false;
|
|
1107
|
+
btn.textContent = 'Search';
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
function toggleCard(card) {
|
|
1112
|
+
card.classList.toggle('expanded');
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
function openFromSearch(sessionId) {
|
|
1116
|
+
_detailOrigin = 'search';
|
|
1117
|
+
navigate('session/' + sessionId);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// \u2500\u2500 Sessions list \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1121
|
+
|
|
1122
|
+
let _allSessions = [];
|
|
1123
|
+
|
|
1124
|
+
async function loadSessions() {
|
|
1125
|
+
const content = document.getElementById('sessions-content');
|
|
1126
|
+
try {
|
|
1127
|
+
const res = await fetch('/sessions');
|
|
1128
|
+
if (!res.ok) throw new Error(\`HTTP \${res.status}\`);
|
|
1129
|
+
const { sessions, total } = await res.json();
|
|
1130
|
+
|
|
1131
|
+
_allSessions = sessions;
|
|
1132
|
+
document.getElementById('sessions-count').textContent = String(total);
|
|
1133
|
+
renderSessionsList(sessions);
|
|
1134
|
+
} catch (err) {
|
|
1135
|
+
content.innerHTML = \`<div class="error-state">Failed to load sessions: \${escHtml(String(err))}</div>\`;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function filterSessions() {
|
|
1140
|
+
const q = document.getElementById('sessions-filter').value.toLowerCase();
|
|
1141
|
+
if (!q) {
|
|
1142
|
+
renderSessionsList(_allSessions);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
const filtered = _allSessions.filter(s =>
|
|
1146
|
+
(s.title ?? '').toLowerCase().includes(q) || (s.project ?? '').toLowerCase().includes(q)
|
|
1147
|
+
);
|
|
1148
|
+
renderSessionsList(filtered);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
function renderSessionsList(sessions) {
|
|
1152
|
+
const content = document.getElementById('sessions-content');
|
|
1153
|
+
if (!sessions || sessions.length === 0) {
|
|
1154
|
+
content.innerHTML = '<div class="empty-state">No sessions found.</div>';
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
content.innerHTML = \`<div class="sessions-grid">\${sessions.map(s => \`
|
|
1158
|
+
<div class="session-card" onclick="openSession('\${escHtml(s.id)}')">
|
|
1159
|
+
<div class="session-card-body">
|
|
1160
|
+
<div class="session-card-title">\${escHtml(s.title || '(untitled)')}</div>
|
|
1161
|
+
<div class="session-card-meta">
|
|
1162
|
+
<span class="tag">\${escHtml(s.project || '\u2014')}</span>
|
|
1163
|
+
<span class="tag">\${escHtml(s.date || '\u2014')}</span>
|
|
1164
|
+
<span class="session-id">\${escHtml(s.id)}</span>
|
|
1165
|
+
</div>
|
|
1166
|
+
</div>
|
|
1167
|
+
<div class="session-card-arrow">\u203A</div>
|
|
1168
|
+
</div>
|
|
1169
|
+
\`).join('')}</div>\`;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
function openSession(id) {
|
|
1173
|
+
_detailOrigin = 'sessions';
|
|
1174
|
+
navigate('session/' + id);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
// \u2500\u2500 Session detail \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1178
|
+
|
|
1179
|
+
function openSessionDetail(id) {
|
|
1180
|
+
document.querySelectorAll('.tab-panel').forEach(p => p.classList.remove('active'));
|
|
1181
|
+
document.querySelectorAll('nav button').forEach(b => b.classList.remove('active'));
|
|
1182
|
+
document.getElementById('tab-session-detail').classList.add('active');
|
|
1183
|
+
// Highlight the sessions nav button as parent context
|
|
1184
|
+
document.getElementById('nav-sessions').classList.add('active');
|
|
1185
|
+
|
|
1186
|
+
document.getElementById('detail-loading').style.display = '';
|
|
1187
|
+
document.getElementById('detail-error').style.display = 'none';
|
|
1188
|
+
document.getElementById('detail-content').style.display = 'none';
|
|
1189
|
+
|
|
1190
|
+
// Update back button label based on origin
|
|
1191
|
+
const backBtn = document.getElementById('detail-back-btn');
|
|
1192
|
+
backBtn.textContent = _detailOrigin === 'search' ? '\u2190 Search Results' : '\u2190 Sessions';
|
|
1193
|
+
|
|
1194
|
+
loadSessionDetail(id);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
async function loadSessionDetail(id) {
|
|
1198
|
+
try {
|
|
1199
|
+
const res = await fetch('/sessions/' + id);
|
|
1200
|
+
if (!res.ok) {
|
|
1201
|
+
const err = await res.json().catch(() => ({ error: res.statusText }));
|
|
1202
|
+
document.getElementById('detail-loading').style.display = 'none';
|
|
1203
|
+
const errEl = document.getElementById('detail-error');
|
|
1204
|
+
errEl.style.display = '';
|
|
1205
|
+
errEl.textContent = 'Error: ' + (err.error ?? 'Failed to load session');
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
const session = await res.json();
|
|
1210
|
+
document.getElementById('detail-loading').style.display = 'none';
|
|
1211
|
+
|
|
1212
|
+
document.getElementById('detail-title').textContent = session.title || '(untitled)';
|
|
1213
|
+
document.getElementById('detail-meta').innerHTML = \`
|
|
1214
|
+
<span class="tag">\${escHtml(session.project || '\u2014')}</span>
|
|
1215
|
+
<span class="tag">\${escHtml(session.date || '\u2014')}</span>
|
|
1216
|
+
<span class="tag" style="font-family:var(--mono);font-size:11px;">\${escHtml(session.id)}</span>
|
|
1217
|
+
<span class="tag">\${session.turns ? session.turns.length + ' turns' : ''}</span>
|
|
1218
|
+
\`;
|
|
1219
|
+
|
|
1220
|
+
const turnsEl = document.getElementById('detail-turns');
|
|
1221
|
+
if (!session.turns || session.turns.length === 0) {
|
|
1222
|
+
turnsEl.innerHTML = '<div class="empty-state">No turns found in this session.</div>';
|
|
1223
|
+
} else {
|
|
1224
|
+
turnsEl.innerHTML = groupTurns(session.turns).map(g => renderGroup(g)).join('');
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
document.getElementById('detail-content').style.display = '';
|
|
1228
|
+
} catch (err) {
|
|
1229
|
+
document.getElementById('detail-loading').style.display = 'none';
|
|
1230
|
+
const errEl = document.getElementById('detail-error');
|
|
1231
|
+
errEl.style.display = '';
|
|
1232
|
+
errEl.textContent = 'Error: ' + String(err);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/** Group flat turn list: consecutive assistant turns \u2192 one agent group. */
|
|
1237
|
+
function groupTurns(turns) {
|
|
1238
|
+
const groups = [];
|
|
1239
|
+
let i = 0;
|
|
1240
|
+
while (i < turns.length) {
|
|
1241
|
+
if (turns[i].role === 'user') {
|
|
1242
|
+
groups.push({ type: 'user', turn: turns[i] });
|
|
1243
|
+
i++;
|
|
1244
|
+
} else {
|
|
1245
|
+
const agentTurns = [];
|
|
1246
|
+
while (i < turns.length && turns[i].role === 'assistant') {
|
|
1247
|
+
agentTurns.push(turns[i]);
|
|
1248
|
+
i++;
|
|
1249
|
+
}
|
|
1250
|
+
groups.push({ type: 'agent', turns: agentTurns });
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
return groups;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
function renderGroup(group) {
|
|
1257
|
+
if (group.type === 'user') {
|
|
1258
|
+
const t = group.turn;
|
|
1259
|
+
const tsHtml = t.timestamp
|
|
1260
|
+
? \`<div class="turn-ts">\${escHtml(new Date(t.timestamp).toLocaleString())}</div>\`
|
|
1261
|
+
: '';
|
|
1262
|
+
return \`
|
|
1263
|
+
<div class="turn user">
|
|
1264
|
+
<div class="turn-role">User</div>
|
|
1265
|
+
<div class="turn-text">\${renderText(t.text)}</div>
|
|
1266
|
+
\${tsHtml}
|
|
1267
|
+
</div>\`;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
// Agent group: collect all tools, thinking, and text across consecutive turns
|
|
1271
|
+
const allTools = group.turns.flatMap(t => t.tools ?? []);
|
|
1272
|
+
const allThinking = group.turns.flatMap(t => t.thinking ?? []);
|
|
1273
|
+
const texts = group.turns.map(t => t.text).filter(Boolean);
|
|
1274
|
+
const lastTs = group.turns.map(t => t.timestamp).filter(Boolean).at(-1);
|
|
1275
|
+
|
|
1276
|
+
const textHtml = texts.length
|
|
1277
|
+
? \`<div class="turn-text">\${texts.map(renderText).join('<hr style="border:none;border-top:1px solid var(--border);margin:10px 0;">')}</div>\`
|
|
1278
|
+
: '';
|
|
1279
|
+
|
|
1280
|
+
const thinkingHtml = allThinking.length
|
|
1281
|
+
? \`<details class="agent-thinking">
|
|
1282
|
+
<summary>Thinking (\${allThinking.length})</summary>
|
|
1283
|
+
<div class="agent-thinking-body">\${allThinking.map(t => escHtml(t)).join('\\n\\n---\\n\\n')}</div>
|
|
1284
|
+
</details>\`
|
|
1285
|
+
: '';
|
|
1286
|
+
|
|
1287
|
+
const actionsHtml = allTools.length
|
|
1288
|
+
? \`<details class="agent-actions">
|
|
1289
|
+
<summary>\${allTools.length} tool call\${allTools.length === 1 ? '' : 's'}</summary>
|
|
1290
|
+
<div class="agent-actions-body">
|
|
1291
|
+
\${allTools.map(tool => \`
|
|
1292
|
+
<details class="tool-detail">
|
|
1293
|
+
<summary>\${escHtml(tool)}</summary>
|
|
1294
|
+
<div class="tool-content">\${escHtml(tool)}</div>
|
|
1295
|
+
</details>\`).join('')}
|
|
1296
|
+
</div>
|
|
1297
|
+
</details>\`
|
|
1298
|
+
: '';
|
|
1299
|
+
|
|
1300
|
+
const tsHtml = lastTs
|
|
1301
|
+
? \`<div class="turn-ts">\${escHtml(new Date(lastTs).toLocaleString())}</div>\`
|
|
1302
|
+
: '';
|
|
1303
|
+
|
|
1304
|
+
return \`
|
|
1305
|
+
<div class="turn assistant">
|
|
1306
|
+
<div class="turn-role">Agent</div>
|
|
1307
|
+
\${textHtml}
|
|
1308
|
+
\${thinkingHtml}
|
|
1309
|
+
\${actionsHtml}
|
|
1310
|
+
\${tsHtml}
|
|
1311
|
+
</div>\`;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
function goBack() {
|
|
1315
|
+
if (_detailOrigin === 'search') {
|
|
1316
|
+
showTab('search');
|
|
1317
|
+
} else {
|
|
1318
|
+
showTab('sessions');
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// \u2500\u2500 Activity \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1323
|
+
|
|
1324
|
+
async function loadActivity() {
|
|
1325
|
+
try {
|
|
1326
|
+
const res = await fetch('/activity/entries?limit=200');
|
|
1327
|
+
if (!res.ok) throw new Error(\`HTTP \${res.status}\`);
|
|
1328
|
+
const { entries } = await res.json();
|
|
1329
|
+
|
|
1330
|
+
document.getElementById('activity-count').textContent = String(entries.length);
|
|
1331
|
+
const content = document.getElementById('activity-content');
|
|
1332
|
+
|
|
1333
|
+
if (entries.length === 0) {
|
|
1334
|
+
content.innerHTML = '<div class="empty-state">No activity yet. Start the daemon and run a search.</div>';
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
const rows = entries.map(e => \`
|
|
1339
|
+
<tr>
|
|
1340
|
+
<td>\${formatDate(e.ts)}</td>
|
|
1341
|
+
<td><span class="type-badge \${escHtml(e.type)}">\${escHtml(e.type)}</span></td>
|
|
1342
|
+
<td style="color:var(--text-muted);font-size:12px;">\${escHtml(e.data ? JSON.stringify(e.data) : '')}</td>
|
|
1343
|
+
</tr>
|
|
1344
|
+
\`).join('');
|
|
1345
|
+
|
|
1346
|
+
content.innerHTML = \`
|
|
1347
|
+
<table class="activity-table">
|
|
1348
|
+
<thead><tr><th>Time</th><th>Event</th><th>Data</th></tr></thead>
|
|
1349
|
+
<tbody>\${rows}</tbody>
|
|
1350
|
+
</table>
|
|
1351
|
+
\`;
|
|
1352
|
+
} catch (err) {
|
|
1353
|
+
document.getElementById('activity-content').innerHTML =
|
|
1354
|
+
\`<div class="error-state">Failed to load activity: \${escHtml(String(err))}</div>\`;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// \u2500\u2500 Debug \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1359
|
+
|
|
1360
|
+
let autoscroll = true;
|
|
1361
|
+
|
|
1362
|
+
function toggleAutoscroll() {
|
|
1363
|
+
autoscroll = !autoscroll;
|
|
1364
|
+
document.getElementById('autoscroll-btn').textContent = 'Autoscroll: ' + (autoscroll ? 'on' : 'off');
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
async function fetchStats() {
|
|
1368
|
+
try {
|
|
1369
|
+
const res = await fetch('/status');
|
|
1370
|
+
if (!res.ok) throw new Error(\`HTTP \${res.status}\`);
|
|
1371
|
+
const d = await res.json();
|
|
1372
|
+
document.getElementById('dbg-sessions').textContent = d.sessions.toLocaleString();
|
|
1373
|
+
document.getElementById('dbg-chunks').textContent = d.chunks.toLocaleString();
|
|
1374
|
+
document.getElementById('dbg-searches').textContent = d.searches.toLocaleString();
|
|
1375
|
+
document.getElementById('dbg-provider').textContent = d.embedProvider;
|
|
1376
|
+
document.getElementById('dbg-stats-meta').textContent = 'Updated ' + new Date().toLocaleTimeString();
|
|
1377
|
+
} catch (err) {
|
|
1378
|
+
document.getElementById('dbg-stats-meta').textContent = 'Error: ' + err.message;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
async function fetchLog() {
|
|
1383
|
+
try {
|
|
1384
|
+
const res = await fetch('/debug/log?lines=200');
|
|
1385
|
+
if (!res.ok) throw new Error(\`HTTP \${res.status}\`);
|
|
1386
|
+
const { lines } = await res.json();
|
|
1387
|
+
const body = document.getElementById('dbg-log-body');
|
|
1388
|
+
if (!lines || lines.length === 0) {
|
|
1389
|
+
body.innerHTML = '<span class="log-empty">No log entries.</span>';
|
|
1390
|
+
document.getElementById('dbg-log-meta').textContent = 'Empty';
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
body.innerHTML = lines.map(l => {
|
|
1394
|
+
const cls = /error|fatal|err/i.test(l) ? 'log-err'
|
|
1395
|
+
: /warn/i.test(l) ? 'log-warn'
|
|
1396
|
+
: /ready|success|done/i.test(l) ? 'log-ok'
|
|
1397
|
+
: '';
|
|
1398
|
+
return \`<span class="log-line \${cls}">\${escHtml(l)}</span>\`;
|
|
1399
|
+
}).join('\\n');
|
|
1400
|
+
if (autoscroll) body.scrollTop = body.scrollHeight;
|
|
1401
|
+
document.getElementById('dbg-log-meta').textContent =
|
|
1402
|
+
\`\${lines.length} lines \xB7 \${new Date().toLocaleTimeString()}\`;
|
|
1403
|
+
} catch (err) {
|
|
1404
|
+
document.getElementById('dbg-log-meta').textContent = 'Error: ' + err.message;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
async function fetchConfig() {
|
|
1409
|
+
try {
|
|
1410
|
+
const res = await fetch('/debug/config');
|
|
1411
|
+
if (!res.ok) throw new Error(\`HTTP \${res.status}\`);
|
|
1412
|
+
const cfg = await res.json();
|
|
1413
|
+
const rows = Object.entries(cfg).map(([k, v]) => {
|
|
1414
|
+
const display = v === null ? '<span style="color:var(--text-muted)">\u2014</span>' : escHtml(String(v));
|
|
1415
|
+
return \`<tr><td>\${escHtml(k)}</td><td>\${display}</td></tr>\`;
|
|
1416
|
+
}).join('');
|
|
1417
|
+
document.getElementById('dbg-config-table').innerHTML = rows;
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
document.getElementById('dbg-config-table').innerHTML =
|
|
1420
|
+
\`<tr><td colspan="2" style="padding:16px;color:var(--red)">Failed: \${escHtml(String(err))}</td></tr>\`;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
async function runHealth() {
|
|
1425
|
+
showToolOutput('Fetching /health\u2026');
|
|
1426
|
+
try {
|
|
1427
|
+
const res = await fetch('/health');
|
|
1428
|
+
showToolOutput(JSON.stringify(await res.json(), null, 2));
|
|
1429
|
+
} catch (err) { showToolOutput('Error: ' + err); }
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
async function runSearch() {
|
|
1433
|
+
showToolOutput('Sending test query\u2026');
|
|
1434
|
+
try {
|
|
1435
|
+
const res = await fetch('/search', {
|
|
1436
|
+
method: 'POST',
|
|
1437
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1438
|
+
body: JSON.stringify({ query: 'test query', k: 3 }),
|
|
1439
|
+
});
|
|
1440
|
+
const data = await res.json();
|
|
1441
|
+
if (data.results) data.results = data.results.map(r => ({ ...r, preview: r.preview?.slice(0, 80) + '\u2026' }));
|
|
1442
|
+
showToolOutput(JSON.stringify(data, null, 2));
|
|
1443
|
+
} catch (err) { showToolOutput('Error: ' + err); }
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
function showToolOutput(text) {
|
|
1447
|
+
document.getElementById('tool-output').style.display = '';
|
|
1448
|
+
document.getElementById('tool-pre').textContent = text;
|
|
1449
|
+
}
|
|
1450
|
+
</script>
|
|
1451
|
+
</body>
|
|
1452
|
+
</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(`
|
|
95
1454
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
96
|
-
`))}}});var pv,Ku=h(()=>{pv={major:4,minor:3,patch:6}});function wv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function e0(e){if(!va.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return wv(r)}function t0(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function mv(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function 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 Sv(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=pu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function zv(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(m=>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 fv(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!lr(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>We(a,n,Se())))}),t)}function hv(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>We(a,n,Se())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}function Hu(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ur(e)&&ur(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Hu(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Hu(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function gv(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),lr(e))return e;let a=Hu(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}function xa(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}function vv(e,t,r,n,o,i,a){e.issues.length&&(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 yv(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function _v(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function $v(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function bv(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function 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 xv(e){return e.value=Object.freeze(e.value),e}function kv(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(_n(o))}}var F,Nr,se,Wu,Xu,Yu,Qu,el,tl,rl,nl,ol,il,al,sl,cl,ul,ll,dl,pl,ml,fl,hl,gl,vl,yl,_l,$l,Ia,bl,Co,Ta,xl,kl,wl,Sl,zl,Il,Tl,El,Pl,Ol,Iv,Tv,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=pv;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=lr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,m=d._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new Ot;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=lr(a,p)))});else{if(a.issues.length===p)continue;u||(u=lr(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(lr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new Ot;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new Ot;return c.then(u=>o(u,n,s))}return o(c,n,s)}}J(e,"~standard",()=>({validate:o=>{try{let i=$n(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Do(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Nr=f("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Au(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),se=f("$ZodStringFormat",(e,t)=>{Uo.init(e,t),Nr.init(e,t)}),Wu=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wu),se.init(e,t)}),Xu=f("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=jr(n))}else t.pattern??(t.pattern=jr());se.init(e,t)}),Yu=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Su),se.init(e,t)}),Qu=f("$ZodURL",(e,t)=>{se.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),el=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zu()),se.init(e,t)}),tl=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xu),se.init(e,t)}),rl=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=vu),se.init(e,t)}),nl=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yu),se.init(e,t)}),ol=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_u),se.init(e,t)}),il=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$u),se.init(e,t)}),al=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bu),se.init(e,t)}),sl=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zu(t)),se.init(e,t)}),cl=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ru),se.init(e,t)}),ul=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Du(t)),se.init(e,t)}),ll=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ku),se.init(e,t)}),dl=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Iu),se.init(e,t),e._zod.bag.format="ipv4"}),pl=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tu),se.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ml=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Eu(t.delimiter)),se.init(e,t),e._zod.bag.format="mac"}),fl=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pu),se.init(e,t)}),hl=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ou),se.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});gl=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ju),se.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{wv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});vl=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=va),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{e0(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yl=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nu),se.init(e,t)});_l=f("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=r=>{t0(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),$l=f("$ZodCustomStringFormat",(e,t)=>{se.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),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)=>{Kg.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)=>{Hg.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=>mv(u,r,a))):mv(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});Iv=f("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=yn(()=>Sv(t));J(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Or,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let m=d[p],g=m._zod.optout==="optional",y=m._zod.run({value:u[p],issues:[]},c);y instanceof Promise?l.push(y.then(_=>za(_,s,p,u,g))):za(y,s,p,u,g)}return i?zv(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Tv=f("$ZodObjectJIT",(e,t)=>{Iv.init(e,t);let r=e._zod.parse,n=yn(()=>Sv(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(`
|
|
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(`
|
|
97
1456
|
if (${z}.issues.length) {
|
|
98
1457
|
if (${k} in input) {
|
|
99
1458
|
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
@@ -127,18 +1486,18 @@ Then set BREW_PREFIX if Homebrew is in a non-standard location.`);jc.Database.se
|
|
|
127
1486
|
newResult[${k}] = ${z}.value;
|
|
128
1487
|
}
|
|
129
1488
|
|
|
130
|
-
`)}m.write("payload.value = newResult;"),m.write("return payload;");let j=m.compile();return(P,z)=>j(p,P,z)},i,a=Or,s=!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?zv([],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=>fv(c,o,e,i)):fv(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=>hv(c,o,e,i)):hv(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(!Or(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Rl=f("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>gv(r,c,u)):gv(r,i,a)}});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(!ur(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...it(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...it(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&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])=>{vv(l,d,r,a,o,e,n)})):vv(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});Al=f("$ZodSet",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>yv(c,r))):yv(s,r)}return i.length?Promise.all(i).then(()=>r):r}});Ul=f("$ZodEnum",(e,t)=>{F.init(e,t);let r=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 Pr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Ot;return r.value=o,r}});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=>$v(i,t)):$v(o,t)}});Jl=f("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Bl=f("$ZodNonOptional",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bv(i,e)):bv(o,e)}});Gl=f("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Kl=f("$ZodCatch",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>We(a,n,Se()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>We(i,n,Se()))},input:r.value}),r.issues=[]),r)}}),Hl=f("$ZodNaN",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Wl=f("$ZodPipe",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>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(xv):xv(o)}});Yl=f("$ZodTemplateLiteral",(e,t)=>{F.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||du.has(typeof n))r.push(lt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ql=f("$ZodFunction",(e,t)=>(F.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?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=>kv(i,r,n,e));kv(o,r,n,e)}})});var Ev=h(()=>{N()});var Pv=h(()=>{N()});var Ov=h(()=>{N()});var jv=h(()=>{N()});var Nv=h(()=>{N()});var Rv=h(()=>{N()});var Dv=h(()=>{N()});var Zv=h(()=>{N()});function od(){return{localeError:n0()}}var n0,id=h(()=>{N();n0=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=L(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${C(o.values[0])}`:`Invalid option: expected one of ${U(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${U(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}}});var Av=h(()=>{N()});var Uv=h(()=>{N()});var Cv=h(()=>{N()});var Mv=h(()=>{N()});var Lv=h(()=>{N()});var qv=h(()=>{N()});var Fv=h(()=>{N()});var Vv=h(()=>{N()});var Jv=h(()=>{N()});var Bv=h(()=>{N()});var Gv=h(()=>{N()});var Kv=h(()=>{N()});var Hv=h(()=>{N()});var Wv=h(()=>{N()});var ad=h(()=>{N()});var Xv=h(()=>{ad()});var Yv=h(()=>{N()});var Qv=h(()=>{N()});var ey=h(()=>{N()});var ty=h(()=>{N()});var ry=h(()=>{N()});var ny=h(()=>{N()});var oy=h(()=>{N()});var iy=h(()=>{N()});var ay=h(()=>{N()});var sy=h(()=>{N()});var cy=h(()=>{N()});var uy=h(()=>{N()});var ly=h(()=>{N()});var dy=h(()=>{N()});var py=h(()=>{N()});var my=h(()=>{N()});var sd=h(()=>{N()});var fy=h(()=>{sd()});var hy=h(()=>{N()});var gy=h(()=>{N()});var vy=h(()=>{N()});var yy=h(()=>{N()});var _y=h(()=>{N()});var $y=h(()=>{N()});var Oa=h(()=>{Ev();Pv();Ov();jv();Nv();Rv();Dv();Zv();id();Av();Uv();Cv();Mv();Lv();qv();Fv();Vv();Jv();Bv();Gv();Kv();Hv();Wv();Xv();ad();Yv();Qv();ey();ty();ry();ny();oy();iy();ay();sy();cy();uy();ly();dy();py();my();fy();sd();hy();gy();vy();yy();_y();$y()});function ld(){return new ud}var by,ud,Ve,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)}};(by=globalThis).__zod_globalRegistry??(by.__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 Rr(e,t){return new Gg({check:"multiple_of",...S(t),value:e})}function Dr(e,t){return new Wg({check:"max_size",...S(t),maximum:e})}function Gt(e,t){return new Xg({check:"min_size",...S(t),minimum:e})}function bn(e,t){return new Yg({check:"size_equals",...S(t),size:e})}function xn(e,t){return new Qg({check:"max_length",...S(t),maximum:e})}function dr(e,t){return new ev({check:"min_length",...S(t),minimum:e})}function kn(e,t){return new tv({check:"length_equals",...S(t),length:e})}function Jo(e,t){return new rv({check:"string_format",format:"regex",...S(t),pattern:e})}function Bo(e){return new nv({check:"string_format",format:"lowercase",...S(e)})}function Go(e){return new ov({check:"string_format",format:"uppercase",...S(e)})}function Ko(e,t){return new iv({check:"string_format",format:"includes",...S(t),includes:e})}function Ho(e,t){return new av({check:"string_format",format:"starts_with",...S(t),prefix:e})}function Wo(e,t){return new sv({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Md(e,t,r){return new cv({check:"property",property:e,schema:t,...S(r)})}function Xo(e,t){return new uv({check:"mime_type",mime:e,...S(t)})}function jt(e){return new lv({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 xy(e,t,r){return new e({type:"array",element:t,...S(r)})}function Ld(e,t){return new e({type:"file",...S(t)})}function qd(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Fd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function Vd(e){let t=s0(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_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 s0(e,t){let r=new le({check:"custom",...S(t)});return r._zod.check=e,r}function Jd(e){let t=new le({check:"describe"});return t._zod.onattach=[r=>{let n=Ve.get(r)??{};Ve.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Bd(e){let t=new le({check:"meta"});return t._zod.onattach=[r=>{let n=Ve.get(r)??{};Ve.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Gd(e,t){let r=S(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=e.Codec??Lo,c=e.Boolean??Co,u=e.String??Nr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function 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 ky=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>
|
|
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>
|
|
131
1490
|
|
|
132
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function 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 wy,ri,ni=h(()=>{qo();wy=(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 c0,Sy,zy,Iy,Ty,Ey,Py,Oy,jy,Ny,Ry,Dy,Zy,Ay,Uy,Cy,My,Ly,qy,Fy,Vy,Jy,By,Gy,Ky,Hy,Kd,Wy,Xy,Yy,Qy,e_,t_,r_,n_,o_,i_,a_,Hd,s_,Sn=h(()=>{ni();N();c0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Sy=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=c0[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zy=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Iy=(e,t,r,n)=>{r.type="boolean"},Ty=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ey=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Py=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Oy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Ny=(e,t,r,n)=>{r.not={}},Ry=(e,t,r,n)=>{},Dy=(e,t,r,n)=>{},Zy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Ay=(e,t,r,n)=>{let o=e._zod.def,i=ko(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Uy=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Cy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},My=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Ly=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},qy=(e,t,r,n)=>{r.type="boolean"},Fy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Jy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},By=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Gy=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ky=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},Hy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Kd=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Wy=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},Xy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,m)=>fe(p,t,{...n,path:[...n.path,a,m]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Yy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Qy=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},e_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},t_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},r_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},n_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},o_=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},i_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},a_=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Hd=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},s_=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o}});var c_=h(()=>{Sn();ni()});var u_=h(()=>{});var be=h(()=>{gn();gu();hu();nd();$a();Ku();N();_a();Oa();qo();Gu();ky();ni();Sn();c_();u_()});var Xd=h(()=>{be()});var rs=h(()=>{be();N();Xd()});var d_=h(()=>{be()});var Yd=h(()=>{be();rs()});var p_=h(()=>{be();rs()});var Qd=h(()=>{be();Xd();rs();d_();be();Sn();Oa();Yd();Yd();p_()});var ep=h(()=>{Qd();Qd()});function zn(e){return!!e._zod}function pr(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 h_(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:()=>Dr,mime:()=>Xo,minLength:()=>dr,minSize:()=>Gt,multipleOf:()=>Rr,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 Zr={};Et(Zr,{ZodISODate:()=>np,ZodISODateTime:()=>tp,ZodISODuration:()=>sp,ZodISOTime:()=>ip,date:()=>op,datetime:()=>rp,duration:()=>cp,time:()=>ap});function rp(e){return md(tp,e)}function op(e){return fd(np,e)}function ap(e){return hd(ip,e)}function cp(e){return gd(sp,e)}var tp,np,ip,sp,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 g_,AA,st,up=h(()=>{be();be();N();g_=(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}}})},AA=f("ZodError",g_),st=f("ZodError",g_,{Parent:Error})});var v_,y_,__,$_,b_,x_,k_,w_,S_,z_,I_,T_,lp=h(()=>{be();up();v_=Eo(st),y_=Oo(st),__=No(st),$_=Ro(st),b_=Rg(st),x_=Dg(st),k_=Zg(st),w_=Ag(st),S_=Ug(st),z_=Cg(st),I_=Mg(st),T_=Lg(st)});var ii={};Et(ii,{ZodAny:()=>N_,ZodArray:()=>A_,ZodBase64:()=>Sp,ZodBase64URL:()=>zp,ZodBigInt:()=>fs,ZodBigIntFormat:()=>Ep,ZodBoolean:()=>ms,ZodCIDRv4:()=>kp,ZodCIDRv6:()=>wp,ZodCUID:()=>gp,ZodCUID2:()=>vp,ZodCatch:()=>n$,ZodCodec:()=>Zp,ZodCustom:()=>_s,ZodCustomStringFormat:()=>ci,ZodDate:()=>Op,ZodDefault:()=>X_,ZodDiscriminatedUnion:()=>C_,ZodE164:()=>Ip,ZodEmail:()=>mp,ZodEmoji:()=>fp,ZodEnum:()=>si,ZodExactOptional:()=>K_,ZodFile:()=>B_,ZodFunction:()=>p$,ZodGUID:()=>ss,ZodIPv4:()=>bp,ZodIPv6:()=>xp,ZodIntersection:()=>M_,ZodJWT:()=>Tp,ZodKSUID:()=>$p,ZodLazy:()=>u$,ZodLiteral:()=>J_,ZodMAC:()=>E_,ZodMap:()=>F_,ZodNaN:()=>i$,ZodNanoID:()=>hp,ZodNever:()=>D_,ZodNonOptional:()=>Rp,ZodNull:()=>j_,ZodNullable:()=>W_,ZodNumber:()=>ps,ZodNumberFormat:()=>In,ZodObject:()=>hs,ZodOptional:()=>Np,ZodPipe:()=>Dp,ZodPrefault:()=>Q_,ZodPromise:()=>d$,ZodReadonly:()=>a$,ZodRecord:()=>ys,ZodSet:()=>V_,ZodString:()=>ls,ZodStringFormat:()=>de,ZodSuccess:()=>r$,ZodSymbol:()=>P_,ZodTemplateLiteral:()=>c$,ZodTransform:()=>G_,ZodTuple:()=>L_,ZodType:()=>B,ZodULID:()=>yp,ZodURL:()=>ds,ZodUUID:()=>Kt,ZodUndefined:()=>O_,ZodUnion:()=>gs,ZodUnknown:()=>R_,ZodVoid:()=>Z_,ZodXID:()=>_p,ZodXor:()=>U_,_ZodString:()=>pp,_default:()=>Y_,_function:()=>zz,any:()=>cz,array:()=>Y,base64:()=>J0,base64url:()=>B0,bigint:()=>nz,boolean:()=>ke,catch:()=>o$,check:()=>Iz,cidrv4:()=>F0,cidrv6:()=>V0,codec:()=>kz,cuid:()=>D0,cuid2:()=>Z0,custom:()=>Ap,date:()=>lz,describe:()=>Tz,discriminatedUnion:()=>vs,e164:()=>G0,email:()=>S0,emoji:()=>N0,enum:()=>Ze,exactOptional:()=>H_,file:()=>_z,float32:()=>Q0,float64:()=>ez,function:()=>zz,guid:()=>z0,hash:()=>Y0,hex:()=>X0,hostname:()=>W0,httpUrl:()=>j0,instanceof:()=>Pz,int:()=>dp,int32:()=>tz,int64:()=>oz,intersection:()=>li,ipv4:()=>M0,ipv6:()=>q0,json:()=>jz,jwt:()=>K0,keyof:()=>dz,ksuid:()=>C0,lazy:()=>l$,literal:()=>R,looseObject:()=>De,looseRecord:()=>hz,mac:()=>L0,map:()=>gz,meta:()=>Ez,nan:()=>xz,nanoid:()=>R0,nativeEnum:()=>yz,never:()=>Pp,nonoptional:()=>t$,null:()=>ui,nullable:()=>cs,nullish:()=>$z,number:()=>ae,object:()=>E,optional:()=>ge,partialRecord:()=>fz,pipe:()=>us,prefault:()=>e$,preprocess:()=>$s,promise:()=>Sz,readonly:()=>s$,record:()=>he,refine:()=>m$,set:()=>vz,strictObject:()=>pz,string:()=>v,stringFormat:()=>H0,stringbool:()=>Oz,success:()=>bz,superRefine:()=>f$,symbol:()=>az,templateLiteral:()=>wz,transform:()=>jp,tuple:()=>q_,uint32:()=>rz,uint64:()=>iz,ulid:()=>A0,undefined:()=>sz,union:()=>ce,unknown:()=>pe,url:()=>O0,uuid:()=>I0,uuidv4:()=>T0,uuidv6:()=>E0,uuidv7:()=>P0,void:()=>uz,xid:()=>U0,xor:()=>mz});function v(e){return dd(ls,e)}function S0(e){return ja(mp,e)}function z0(e){return Fo(ss,e)}function I0(e){return Na(Kt,e)}function T0(e){return Ra(Kt,e)}function E0(e){return Da(Kt,e)}function P0(e){return Za(Kt,e)}function O0(e){return Vo(ds,e)}function j0(e){return Vo(ds,{protocol:/^https?$/,hostname:dt.domain,...b.normalizeParams(e)})}function N0(e){return Aa(fp,e)}function R0(e){return Ua(hp,e)}function D0(e){return Ca(gp,e)}function Z0(e){return Ma(vp,e)}function A0(e){return La(yp,e)}function U0(e){return qa(_p,e)}function C0(e){return Fa($p,e)}function M0(e){return Va(bp,e)}function L0(e){return pd(E_,e)}function q0(e){return Ja(xp,e)}function F0(e){return Ba(kp,e)}function V0(e){return Ga(wp,e)}function J0(e){return Ka(Sp,e)}function B0(e){return Ha(zp,e)}function G0(e){return Wa(Ip,e)}function K0(e){return Xa(Tp,e)}function H0(e,t,r={}){return wn(ci,e,t,r)}function W0(e){return wn(ci,"hostname",dt.hostname,e)}function X0(e){return wn(ci,"hex",dt.hex,e)}function Y0(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=dt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return wn(ci,n,o,t)}function ae(e){return vd(ps,e)}function dp(e){return yd(In,e)}function Q0(e){return _d(In,e)}function ez(e){return $d(In,e)}function tz(e){return bd(In,e)}function rz(e){return xd(In,e)}function ke(e){return kd(ms,e)}function nz(e){return wd(fs,e)}function oz(e){return Sd(Ep,e)}function iz(e){return zd(Ep,e)}function az(e){return Id(P_,e)}function sz(e){return Td(O_,e)}function ui(e){return Ed(j_,e)}function cz(){return Pd(N_)}function pe(){return Od(R_)}function Pp(e){return jd(D_,e)}function uz(e){return Nd(Z_,e)}function lz(e){return Rd(Op,e)}function Y(e,t){return xy(A_,e,t)}function dz(e){let t=e._zod.def.shape;return Ze(Object.keys(t))}function E(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new hs(r)}function pz(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 mz(e,t){return new U_({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}function vs(e,t,r){return new C_({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}function li(e,t){return new M_({type:"intersection",left:e,right:t})}function q_(e,t,r){let n=t instanceof F,o=n?r:t,i=n?t:null;return new L_({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}function he(e,t,r){return new ys({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function fz(e,t,r){let n=Fe(e);return n._zod.values=void 0,new ys({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function hz(e,t,r){return new ys({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}function gz(e,t,r){return new F_({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}function vz(e,t){return new V_({type:"set",valueType:e,...b.normalizeParams(t)})}function Ze(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new si({type:"enum",entries:r,...b.normalizeParams(t)})}function yz(e,t){return new si({type:"enum",entries:e,...b.normalizeParams(t)})}function R(e,t){return new J_({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}function _z(e){return Ld(B_,e)}function jp(e){return new G_({type:"transform",transform:e})}function ge(e){return new Np({type:"optional",innerType:e})}function H_(e){return new K_({type:"optional",innerType:e})}function cs(e){return new W_({type:"nullable",innerType:e})}function $z(e){return ge(cs(e))}function Y_(e,t){return new X_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function e$(e,t){return new Q_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}function t$(e,t){return new Rp({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}function bz(e){return new r$({type:"success",innerType:e})}function o$(e,t){return new n$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function xz(e){return Dd(i$,e)}function us(e,t){return new Dp({type:"pipe",in:e,out:t})}function kz(e,t,r){return new Zp({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function s$(e){return new a$({type:"readonly",innerType:e})}function wz(e,t){return new c$({type:"template_literal",parts:e,...b.normalizeParams(t)})}function l$(e){return new u$({type:"lazy",getter:e})}function Sz(e){return new d$({type:"promise",innerType:e})}function zz(e){return new p$({type:"function",input:Array.isArray(e?.input)?q_(e?.input):e?.input??Y(pe()),output:e?.output??pe()})}function Iz(e){let t=new le({check:"custom"});return t._zod.check=e,t}function Ap(e,t){return qd(_s,e??(()=>!0),t)}function m$(e,t={}){return Fd(_s,e,t)}function f$(e){return Vd(e)}function Pz(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 jz(e){let t=l$(()=>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,E_,xp,kp,wp,Sp,zp,Ip,Tp,ci,ps,In,ms,fs,Ep,P_,O_,j_,N_,R_,D_,Z_,Op,A_,hs,gs,U_,C_,M_,L_,ys,F_,V_,si,J_,B_,G_,Np,K_,W_,X_,Q_,Rp,r$,n$,i$,Dp,Zp,a$,c$,u$,d$,p$,_s,Tz,Ez,Oz,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=wy(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>v_(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>__(e,r,n),e.parseAsync=async(r,n)=>y_(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>$_(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>b_(e,r,n),e.decode=(r,n)=>x_(e,r,n),e.encodeAsync=async(r,n)=>k_(e,r,n),e.decodeAsync=async(r,n)=>w_(e,r,n),e.safeEncode=(r,n)=>S_(e,r,n),e.safeDecode=(r,n)=>z_(e,r,n),e.safeEncodeAsync=async(r,n)=>I_(e,r,n),e.safeDecodeAsync=async(r,n)=>T_(e,r,n),e.refine=(r,n)=>e.check(m$(r,n)),e.superRefine=r=>e.check(f$(r)),e.overwrite=r=>e.check(jt(r)),e.optional=()=>ge(e),e.exactOptional=()=>H_(e),e.nullable=()=>cs(e),e.nullish=()=>ge(cs(e)),e.nonoptional=r=>t$(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=>Y_(e,r),e.prefault=r=>e$(e,r),e.catch=r=>o$(e,r),e.pipe=r=>us(e,r),e.readonly=()=>s$(e),e.describe=r=>{let n=e.clone();return Ve.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ve.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ve.get(e);let n=e.clone();return Ve.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),pp=f("_ZodString",(e,t)=>{Nr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Sy(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(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(dr(...n)),e.max=(...n)=>e.check(xn(...n)),e.length=(...n)=>e.check(kn(...n)),e.nonempty=(...n)=>e.check(dr(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)=>{Nr.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)});E_=f("ZodMAC",(e,t)=>{ml.init(e,t),de.init(e,t)});xp=f("ZodIPv6",(e,t)=>{pl.init(e,t),de.init(e,t)});kp=f("ZodCIDRv4",(e,t)=>{fl.init(e,t),de.init(e,t)});wp=f("ZodCIDRv6",(e,t)=>{hl.init(e,t),de.init(e,t)});Sp=f("ZodBase64",(e,t)=>{gl.init(e,t),de.init(e,t)});zp=f("ZodBase64URL",(e,t)=>{vl.init(e,t),de.init(e,t)});Ip=f("ZodE164",(e,t)=>{yl.init(e,t),de.init(e,t)});Tp=f("ZodJWT",(e,t)=>{_l.init(e,t),de.init(e,t)});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)=>zy(e,n,o,i),e.gt=(n,o)=>e.check(Bt(n,o)),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.lt=(n,o)=>e.check(Jt(n,o)),e.lte=(n,o)=>e.check(at(n,o)),e.max=(n,o)=>e.check(at(n,o)),e.int=n=>e.check(dp(n)),e.safe=n=>e.check(dp(n)),e.positive=n=>e.check(Bt(0,n)),e.nonnegative=n=>e.check(Je(0,n)),e.negative=n=>e.check(Jt(0,n)),e.nonpositive=n=>e.check(at(0,n)),e.multipleOf=(n,o)=>e.check(Rr(n,o)),e.step=(n,o)=>e.check(Rr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});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)=>Iy(e,r,n,o)});fs=f("ZodBigInt",(e,t)=>{Ta.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ty(e,n,o,i),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.gt=(n,o)=>e.check(Bt(n,o)),e.gte=(n,o)=>e.check(Je(n,o)),e.min=(n,o)=>e.check(Je(n,o)),e.lt=(n,o)=>e.check(Jt(n,o)),e.lte=(n,o)=>e.check(at(n,o)),e.max=(n,o)=>e.check(at(n,o)),e.positive=n=>e.check(Bt(BigInt(0),n)),e.negative=n=>e.check(Jt(BigInt(0),n)),e.nonpositive=n=>e.check(at(BigInt(0),n)),e.nonnegative=n=>e.check(Je(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Rr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Ep=f("ZodBigIntFormat",(e,t)=>{xl.init(e,t),fs.init(e,t)});P_=f("ZodSymbol",(e,t)=>{kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ey(e,r,n,o)});O_=f("ZodUndefined",(e,t)=>{wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oy(e,r,n,o)});j_=f("ZodNull",(e,t)=>{Sl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Py(e,r,n,o)});N_=f("ZodAny",(e,t)=>{zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o)});R_=f("ZodUnknown",(e,t)=>{Il.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dy(e,r,n,o)});D_=f("ZodNever",(e,t)=>{Tl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ny(e,r,n,o)});Z_=f("ZodVoid",(e,t)=>{El.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jy(e,r,n,o)});Op=f("ZodDate",(e,t)=>{Pl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Zy(e,n,o,i),e.min=(n,o)=>e.check(Je(n,o)),e.max=(n,o)=>e.check(at(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});A_=f("ZodArray",(e,t)=>{Ol.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ky(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(dr(r,n)),e.nonempty=r=>e.check(dr(1,r)),e.max=(r,n)=>e.check(xn(r,n)),e.length=(r,n)=>e.check(kn(r,n)),e.unwrap=()=>e.element});hs=f("ZodObject",(e,t)=>{Tv.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hy(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ze(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pe()}),e.loose=()=>e.clone({...e._zod.def,catchall:pe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Pp()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>b.extend(e,r),e.safeExtend=r=>b.safeExtend(e,r),e.merge=r=>b.merge(e,r),e.pick=r=>b.pick(e,r),e.omit=r=>b.omit(e,r),e.partial=(...r)=>b.partial(Np,e,r[0]),e.required=(...r)=>b.required(Rp,e,r[0])});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});U_=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});C_=f("ZodDiscriminatedUnion",(e,t)=>{gs.init(e,t),Nl.init(e,t)});M_=f("ZodIntersection",(e,t)=>{Rl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wy(e,r,n,o)});L_=f("ZodTuple",(e,t)=>{Ea.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xy(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});ys=f("ZodRecord",(e,t)=>{Dl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yy(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});F_=f("ZodMap",(e,t)=>{Zl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>By(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Dr(...r)),e.size=(...r)=>e.check(bn(...r))});V_=f("ZodSet",(e,t)=>{Al.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gy(e,r,n,o),e.min=(...r)=>e.check(Gt(...r)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(...r)=>e.check(Dr(...r)),e.size=(...r)=>e.check(bn(...r))});si=f("ZodEnum",(e,t)=>{Ul.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ay(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new 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})}});J_=f("ZodLiteral",(e,t)=>{Cl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uy(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});B_=f("ZodFile",(e,t)=>{Ml.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ly(e,r,n,o),e.min=(r,n)=>e.check(Gt(r,n)),e.max=(r,n)=>e.check(Dr(r,n)),e.mime=(r,n)=>e.check(Xo(Array.isArray(r)?r:[r],n))});G_=f("ZodTransform",(e,t)=>{Ll.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jy(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(b.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Np=f("ZodOptional",(e,t)=>{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});K_=f("ZodExactOptional",(e,t)=>{ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});W_=f("ZodNullable",(e,t)=>{Fl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});X_=f("ZodDefault",(e,t)=>{Vl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>t_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});Q_=f("ZodPrefault",(e,t)=>{Jl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>r_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Rp=f("ZodNonOptional",(e,t)=>{Bl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>e_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});r$=f("ZodSuccess",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});n$=f("ZodCatch",(e,t)=>{Kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>n_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});i$=f("ZodNaN",(e,t)=>{Hl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cy(e,r,n,o)});Dp=f("ZodPipe",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>o_(e,r,n,o),e.in=t.in,e.out=t.out});Zp=f("ZodCodec",(e,t)=>{Dp.init(e,t),Lo.init(e,t)});a$=f("ZodReadonly",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>i_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});c$=f("ZodTemplateLiteral",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>My(e,r,n,o)});u$=f("ZodLazy",(e,t)=>{td.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>s_(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});d$=f("ZodPromise",(e,t)=>{ed.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>a_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});p$=f("ZodFunction",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vy(e,r,n,o)});_s=f("ZodCustom",(e,t)=>{rd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fy(e,r,n,o)});Tz=Jd,Ez=Bd;Oz=(...e)=>Gd({Codec:Zp,Boolean:ms,String:ls},...e)});var h$,g$=h(()=>{be();be();h$||(h$={})});var JA,v$=h(()=>{qo();as();oi();ai();JA={...ii,...is,iso:Zr}});var y$=h(()=>{be();ai()});var Up=h(()=>{be();ai();as();up();lp();g$();be();id();be();Sn();v$();Oa();oi();oi();y$();Se(od())});var Cp=h(()=>{Up();Up()});var _$=h(()=>{Cp();Cp()});var Lp,$$,mr,xs,Te,b$,x$,lU,Zz,Az,qp,ct,di,k$,Ee,pt,mt,Pe,ks,w$,Fp,S$,z$,Vp,pi,te,Jp,I$,T$,dU,ws,Uz,Ss,Cz,mi,Tn,E$,Mz,Lz,qz,Fz,Vz,Jz,Bp,Bz,Gz,Gp,zs,Kz,Hz,Is,Wz,fi,hi,Xz,gi,En,Yz,vi,Ts,Es,Ps,pU,Os,js,Ns,P$,O$,j$,Kp,N$,yi,Pn,R$,Qz,eI,tI,rI,nI,Hp,oI,iI,aI,sI,cI,uI,lI,dI,pI,mI,fI,hI,gI,vI,yI,_I,Wp,Xp,Yp,$I,bI,xI,Qp,kI,wI,SI,zI,II,D$,em,TI,Rs,mU,EI,_i,PI,fU,$i,OI,tm,jI,NI,RI,DI,ZI,AI,UI,bs,CI,MI,LI,bi,rm,qI,FI,VI,JI,BI,GI,KI,HI,WI,XI,YI,QI,eT,tT,rT,nT,oT,iT,On,aT,sT,cT,uT,lT,dT,pT,nm,mT,hU,gU,vU,yU,_U,$U,G,Mp,jn=h(()=>{_$();Lp="2025-11-25",$$=[Lp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mr="io.modelcontextprotocol/related-task",xs="2.0",Te=Ap(e=>e!==null&&(typeof e=="object"||typeof e=="function")),b$=ce([v(),ae().int()]),x$=v(),lU=De({ttl:ce([ae(),ui()]).optional(),pollInterval:ae().optional()}),Zz=E({ttl:ae().optional()}),Az=E({taskId:v()}),qp=De({progressToken:b$.optional(),[mr]:Az.optional()}),ct=E({_meta:qp.optional()}),di=ct.extend({task:Zz.optional()}),k$=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()]),w$=E({jsonrpc:R(xs),id:ks,...Ee.shape}).strict(),Fp=e=>w$.safeParse(e).success,S$=E({jsonrpc:R(xs),...mt.shape}).strict(),z$=e=>S$.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(),I$=e=>Jp.safeParse(e).success,T$=ce([w$,S$,Vp,Jp]),dU=ce([Vp,Jp]),ws=Pe.strict(),Uz=pt.extend({requestId:ks.optional(),reason:v().optional()}),Ss=mt.extend({method:R("notifications/cancelled"),params:Uz}),Cz=E({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Ze(["light","dark"]).optional()}),mi=E({icons:Y(Cz).optional()}),Tn=E({name:v(),title:v().optional()}),E$=Tn.extend({...Tn.shape,...mi.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Mz=li(E({applyDefaults:ke().optional()}),he(v(),pe())),Lz=$s(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,li(E({form:Mz.optional(),url:Te.optional()}),he(v(),pe()).optional())),qz=De({list:Te.optional(),cancel:Te.optional(),requests:De({sampling:De({createMessage:Te.optional()}).optional(),elicitation:De({create:Te.optional()}).optional()}).optional()}),Fz=De({list:Te.optional(),cancel:Te.optional(),requests:De({tools:De({call:Te.optional()}).optional()}).optional()}),Vz=E({experimental:he(v(),Te).optional(),sampling:E({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:Lz.optional(),roots:E({listChanged:ke().optional()}).optional(),tasks:qz.optional()}),Jz=ct.extend({protocolVersion:v(),capabilities:Vz,clientInfo:E$}),Bp=Ee.extend({method:R("initialize"),params:Jz}),Bz=E({experimental:he(v(),Te).optional(),logging:Te.optional(),completions:Te.optional(),prompts:E({listChanged:ke().optional()}).optional(),resources:E({subscribe:ke().optional(),listChanged:ke().optional()}).optional(),tools:E({listChanged:ke().optional()}).optional(),tasks:Fz.optional()}),Gz=Pe.extend({protocolVersion:v(),capabilities:Bz,serverInfo:E$,instructions:v().optional()}),Gp=mt.extend({method:R("notifications/initialized"),params:pt.optional()}),zs=Ee.extend({method:R("ping"),params:ct.optional()}),Kz=E({progress:ae(),total:ge(ae()),message:ge(v())}),Hz=E({...pt.shape,...Kz.shape,progressToken:b$}),Is=mt.extend({method:R("notifications/progress"),params:Hz}),Wz=ct.extend({cursor:x$.optional()}),fi=Ee.extend({params:Wz.optional()}),hi=Pe.extend({nextCursor:x$.optional()}),Xz=Ze(["working","input_required","completed","failed","cancelled"]),gi=E({taskId:v(),status:Xz,ttl:ce([ae(),ui()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:ge(ae()),statusMessage:ge(v())}),En=Pe.extend({task:gi}),Yz=pt.merge(gi),vi=mt.extend({method:R("notifications/tasks/status"),params:Yz}),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()})}),pU=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()})}),P$=Pe.merge(gi),O$=E({uri:v(),mimeType:ge(v()),_meta:he(v(),pe()).optional()}),j$=O$.extend({text:v()}),Kp=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),N$=O$.extend({blob:Kp}),yi=Ze(["user","assistant"]),Pn=E({audience:Y(yi).optional(),priority:ae().min(0).max(1).optional(),lastModified:Zr.datetime({offset:!0}).optional()}),R$=E({...Tn.shape,...mi.shape,uri:v(),description:ge(v()),mimeType:ge(v()),annotations:Pn.optional(),_meta:ge(De({}))}),Qz=E({...Tn.shape,...mi.shape,uriTemplate:v(),description:ge(v()),mimeType:ge(v()),annotations:Pn.optional(),_meta:ge(De({}))}),eI=fi.extend({method:R("resources/list")}),tI=hi.extend({resources:Y(R$)}),rI=fi.extend({method:R("resources/templates/list")}),nI=hi.extend({resourceTemplates:Y(Qz)}),Hp=ct.extend({uri:v()}),oI=Hp,iI=Ee.extend({method:R("resources/read"),params:oI}),aI=Pe.extend({contents:Y(ce([j$,N$]))}),sI=mt.extend({method:R("notifications/resources/list_changed"),params:pt.optional()}),cI=Hp,uI=Ee.extend({method:R("resources/subscribe"),params:cI}),lI=Hp,dI=Ee.extend({method:R("resources/unsubscribe"),params:lI}),pI=pt.extend({uri:v()}),mI=mt.extend({method:R("notifications/resources/updated"),params:pI}),fI=E({name:v(),description:ge(v()),required:ge(ke())}),hI=E({...Tn.shape,...mi.shape,description:ge(v()),arguments:ge(Y(fI)),_meta:ge(De({}))}),gI=fi.extend({method:R("prompts/list")}),vI=hi.extend({prompts:Y(hI)}),yI=ct.extend({name:v(),arguments:he(v(),v()).optional()}),_I=Ee.extend({method:R("prompts/get"),params:yI}),Wp=E({type:R("text"),text:v(),annotations: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()}),$I=E({type:R("tool_use"),name:v(),id:v(),input:he(v(),pe()),_meta:he(v(),pe()).optional()}),bI=E({type:R("resource"),resource:ce([j$,N$]),annotations:Pn.optional(),_meta:he(v(),pe()).optional()}),xI=R$.extend({type:R("resource_link")}),Qp=ce([Wp,Xp,Yp,xI,bI]),kI=E({role:yi,content:Qp}),wI=Pe.extend({description:v().optional(),messages:Y(kI)}),SI=mt.extend({method:R("notifications/prompts/list_changed"),params:pt.optional()}),zI=E({title:v().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),II=E({taskSupport:Ze(["required","optional","forbidden"]).optional()}),D$=E({...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:zI.optional(),execution:II.optional(),_meta:he(v(),pe()).optional()}),em=fi.extend({method:R("tools/list")}),TI=hi.extend({tools:Y(D$)}),Rs=Pe.extend({content:Y(Qp).default([]),structuredContent:he(v(),pe()).optional(),isError:ke().optional()}),mU=Rs.or(Pe.extend({toolResult:pe()})),EI=di.extend({name:v(),arguments:he(v(),pe()).optional()}),_i=Ee.extend({method:R("tools/call"),params:EI}),PI=mt.extend({method:R("notifications/tools/list_changed"),params:pt.optional()}),fU=E({autoRefresh:ke().default(!0),debounceMs:ae().int().nonnegative().default(300)}),$i=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),OI=ct.extend({level:$i}),tm=Ee.extend({method:R("logging/setLevel"),params:OI}),jI=pt.extend({level:$i,logger:v().optional(),data:pe()}),NI=mt.extend({method:R("notifications/message"),params:jI}),RI=E({name:v().optional()}),DI=E({hints:Y(RI).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),ZI=E({mode:Ze(["auto","required","none"]).optional()}),AI=E({type:R("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(Qp).default([]),structuredContent:E({}).loose().optional(),isError:ke().optional(),_meta:he(v(),pe()).optional()}),UI=vs("type",[Wp,Xp,Yp]),bs=vs("type",[Wp,Xp,Yp,$I,AI]),CI=E({role:yi,content:ce([bs,Y(bs)]),_meta:he(v(),pe()).optional()}),MI=di.extend({messages:Y(CI),modelPreferences:DI.optional(),systemPrompt:v().optional(),includeContext:Ze(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:Y(v()).optional(),metadata:Te.optional(),tools:Y(D$).optional(),toolChoice:ZI.optional()}),LI=Ee.extend({method:R("sampling/createMessage"),params:MI}),bi=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens"]).or(v())),role:yi,content:UI}),rm=Pe.extend({model:v(),stopReason:ge(Ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:yi,content:ce([bs,Y(bs)])}),qI=E({type:R("boolean"),title:v().optional(),description:v().optional(),default:ke().optional()}),FI=E({type:R("string"),title:v().optional(),description:v().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ze(["email","uri","date","date-time"]).optional(),default:v().optional()}),VI=E({type:Ze(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),JI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),BI=E({type:R("string"),title:v().optional(),description:v().optional(),oneOf:Y(E({const:v(),title:v()})),default:v().optional()}),GI=E({type:R("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),KI=ce([JI,BI]),HI=E({type:R("array"),title:v().optional(),description:v().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:E({type:R("string"),enum:Y(v())}),default:Y(v()).optional()}),WI=E({type:R("array"),title:v().optional(),description:v().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:E({anyOf:Y(E({const:v(),title:v()}))}),default:Y(v()).optional()}),XI=ce([HI,WI]),YI=ce([GI,KI,XI]),QI=ce([YI,qI,FI,VI]),eT=di.extend({mode:R("form").optional(),message:v(),requestedSchema:E({type:R("object"),properties:he(v(),QI),required:Y(v()).optional()})}),tT=di.extend({mode:R("url"),message:v(),elicitationId:v(),url:v().url()}),rT=ce([eT,tT]),nT=Ee.extend({method:R("elicitation/create"),params:rT}),oT=pt.extend({elicitationId:v()}),iT=mt.extend({method:R("notifications/elicitation/complete"),params:oT}),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())}),aT=E({type:R("ref/resource"),uri:v()}),sT=E({type:R("ref/prompt"),name:v()}),cT=ct.extend({ref:ce([sT,aT]),argument:E({name:v(),value:v()}),context:E({arguments:he(v(),v()).optional()}).optional()}),uT=Ee.extend({method:R("completion/complete"),params:cT}),lT=Pe.extend({completion:De({values:Y(v()).max(100),total:ge(ae().int()),hasMore:ge(ke())})}),dT=E({uri:v().startsWith("file://"),name:v().optional(),_meta:he(v(),pe()).optional()}),pT=Ee.extend({method:R("roots/list"),params:ct.optional()}),nm=Pe.extend({roots:Y(dT)}),mT=mt.extend({method:R("notifications/roots/list_changed"),params:pt.optional()}),hU=ce([zs,Bp,uT,tm,_I,gI,eI,rI,iI,uI,dI,_i,em,Ts,Ps,Os,Ns]),gU=ce([Ss,Is,Gp,mT,vi]),vU=ce([ws,bi,rm,On,nm,Es,js,En]),yU=ce([zs,LI,nT,pT,Ts,Ps,Os,Ns]),_U=ce([Ss,Is,NI,mI,sI,PI,SI,vi,iT]),$U=ce([ws,Gz,lT,wI,vI,tI,nI,aI,Rs,TI,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 fr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Z$=h(()=>{});var Ds=h(()=>{});var om=h(()=>{Ds()});var hr=h(()=>{});var Zs=h(()=>{});var ft=h(()=>{Zs()});var im=h(()=>{bo();hr();we()});var am=h(()=>{hr()});var sm=h(()=>{});var As=h(()=>{we()});var cm=h(()=>{we()});var um=h(()=>{hr()});var lm=h(()=>{we()});var dm=h(()=>{we();ft()});var pm=h(()=>{});var mm=h(()=>{we()});var fm=h(()=>{});var eC,Us=h(()=>{hr();eC=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(()=>{hr()});var bm=h(()=>{we()});var xm=h(()=>{we();ft()});var km=h(()=>{we()});var wm=h(()=>{we()});var Sm=h(()=>{hr();we()});var zm=h(()=>{we()});var Im=h(()=>{ft()});var Tm=h(()=>{ft()});var Em=h(()=>{we()});var Pm=h(()=>{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 A$=h(()=>{});var Om=h(()=>{we();om();ft()});var U$=h(()=>{Ds();om();hr();Zs();we();A$();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=h_(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Nm(e,t){let r=pr(e,t);if(!r.success)throw r.error;return r.data}var C$=h(()=>{ep();os();U$()});function M$(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function L$(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];M$(a)&&M$(i)?r[o]={...a,...i}:r[o]=i}return r}var _T,Ls,q$=h(()=>{os();jn();Z$();C$();_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(!fr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(fr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[mr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(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(fr(o.status))throw new G(te.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new G(te.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof G?o:new G(te.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),G.fromError(te.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),pi(i)||I$(i)?this._onresponse(i):Fp(i)?this._onrequest(i,a):z$(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=G.fromError(te.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[mr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:te.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=k$(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new G(te.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:te.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),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},fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new G(te.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new G(te.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof G?a:new G(te.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=j=>{l(j)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(j){d(j);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[mr]:c}});let g=j=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(j)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let P=j instanceof G?j:new G(te.RequestTimeout,String(j));l(P)};this._responseHandlers.set(p,j=>{if(!n?.signal?.aborted){if(j instanceof Error)return l(j);try{let P=pr(r,j.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let y=n?.timeout??_T,_=()=>g(G.fromError(te.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let x=c?.taskId;if(x){let j=P=>{let z=this._responseHandlers.get(p);z?z(P):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,j),this._enqueueTaskMessage(x,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(p),l(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(j=>{this._cleanupTimeout(p),l(j)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},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},P$,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[mr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[mr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=jm(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Nm(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=jm(t);this._notificationHandlers.set(n,o=>{let i=Nm(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Fp(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new G(te.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new G(te.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new G(te.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new G(te.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=vi.parse({method:"notifications/tasks/status",params:s});await this.notification(c),fr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new G(te.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(fr(s.status))throw new G(te.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=vi.parse({method:"notifications/tasks/status",params:c});await this.notification(u),fr(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 Ar=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=Ar;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 Ar&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=ht;ie.nil=new ht("");function F$(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Dm(r,t[n]),r.push(e[++n]);return new ht(r)}ie._=F$;var Rm=new ht("+");function V$(e,...t){let r=[wi(e[0])],n=0;for(;n<t.length;)r.push(Rm),Dm(r,t[n]),r.push(Rm,wi(e[++n]));return $T(r),new ht(r)}ie.str=V$;function Dm(e,t){t instanceof ht?e.push(...t._items):t instanceof Ar?e.push(t):e.push(kT(t))}ie.addCodeArg=Dm;function $T(e){let t=1;for(;t<e.length-1;){if(e[t]===Rm){let r=bT(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bT(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Ar||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Ar))return`"${e}${t.slice(1)}`}function xT(e,t){return t.emptyStr()?e:e.emptyStr()?t:V$`${e}${t}`}ie.strConcat=xT;function kT(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wi(Array.isArray(e)?e.join(","):e)}function wT(e){return new ht(wi(e))}ie.stringify=wT;function wi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=wi;function ST(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new ht(`.${e}`):F$`[${e}]`}ie.getProperty=ST;function zT(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=zT;function IT(e){return new ht(e.toString())}ie.regexpCode=IT});var Um=I(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.ValueScope=Ye.ValueScopeName=Ye.Scope=Ye.varKinds=Ye.UsedValueState=void 0;var Xe=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 TT=(0,Xe._)`\n`,Am=class extends Fs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?TT:Xe.nil}}get(){return this._scope}name(t){return new 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(),gr=Si();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return gr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return gr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return gr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return gr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return gr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return gr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return gr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return gr.Name}});var 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)||(ET(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Mr(t,r.names),{})}},Xt=class extends zi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Jm=class extends zi{},Nn=class extends Xt{};Nn.kind="else";var Ur=class e extends Xt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Nn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(J$(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Rn(this.condition,t,r),this}get names(){let t=super.names;return Gs(t,this.condition),this.else&&Mr(t,this.else.names),t}};Ur.kind="if";var Cr=class extends Xt{};Cr.kind="for";var Bm=class extends Cr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Rn(this.iteration,t,r),this}get names(){return Mr(super.names,this.iteration.names)}},Gm=class extends Cr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?wt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Gs(super.names,this.from);return Gs(t,this.to)}},Bs=class extends Cr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Rn(this.iterable,t,r),this}get names(){return Mr(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&&Mr(t,this.catch.names),this.finally&&Mr(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?`
|
|
133
|
-
`:""},this._extScope=t,this._scope=new wt.Scope({parent:t}),this._nodes=[new Jm]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Cm(t,i,n)),i}const(t,r,n){return this._def(wt.varKinds.const,t,r,n)}let(t,r,n){return this._def(wt.varKinds.let,t,r,n)}var(t,r,n){return this._def(wt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new 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 Ur(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ur(t))}else(){return this._elseNode(new Nn)}endIf(){return this._endBlockNode(Ur,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(Cr)}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 Ur))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Hm;function Mr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Gs(e,t){return t instanceof re._CodeOrName?Mr(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 ET(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function J$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Wm(e)}`}X.not=J$;var PT=B$(X.operators.AND);function OT(...e){return e.reduce(PT)}X.and=OT;var jT=B$(X.operators.OR);function NT(...e){return e.reduce(jT)}X.or=NT;function B$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${Wm(t)} ${e} ${Wm(r)}`}function Wm(e){return e instanceof re.Name?e:(0,re._)`(${e})`}});var ne=I(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var me=H(),RT=Si();function DT(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=DT;function ZT(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(H$(e,t),!W$(t,e.self.RULES.all))}Q.alwaysValidSchema=ZT;function H$(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Q$(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=H$;function W$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=W$;function AT(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=AT;function UT({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}Q.schemaRefOrVal=UT;function CT(e){return X$(decodeURIComponent(e))}Q.unescapeFragment=CT;function MT(e){return encodeURIComponent(Ym(e))}Q.escapeFragment=MT;function Ym(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Ym;function X$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=X$;function LT(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=LT;function G$({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof me.Name?(i instanceof me.Name?e(o,i,a):t(o,i,a),a):i instanceof me.Name?(t(o,a,i),i):r(i,a);return s===me.Name&&!(c instanceof me.Name)?n(o,c):c}}Q.mergeEvaluated={props:G$({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),Qm(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Y$}),items:G$({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Y$(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&Qm(e,r,t),r}Q.evaluatedPropsToName=Y$;function Qm(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=Qm;var K$={};function qT(e,t){return e.scopeValue("func",{ref:t,code:K$[t.code]||(K$[t.code]=new RT._Code(t.code))})}Q.useFunc=qT;var Xm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Xm||(Q.Type=Xm={}));function FT(e,t,r){if(e instanceof me.Name){let n=t===Xm.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+Ym(e)}Q.getErrorPath=FT;function Q$(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=Q$});var Yt=I(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var Ae=H(),VT={data:new Ae.Name("data"),valCxt:new Ae.Name("valCxt"),instancePath:new Ae.Name("instancePath"),parentData:new Ae.Name("parentData"),parentDataProperty:new Ae.Name("parentDataProperty"),rootData:new Ae.Name("rootData"),dynamicAnchors:new Ae.Name("dynamicAnchors"),vErrors:new Ae.Name("vErrors"),errors:new Ae.Name("errors"),this:new Ae.Name("this"),self:new Ae.Name("self"),scope:new Ae.Name("scope"),json:new Ae.Name("json"),jsonPos:new Ae.Name("jsonPos"),jsonLen:new Ae.Name("jsonLen"),jsonPart:new Ae.Name("jsonPart")};ef.default=VT});var 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 JT(e,t=Ue.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=rb(e,t,r);n??(a||s)?eb(i,c):tb(o,(0,oe._)`[${c}]`)}Ue.reportError=JT;function BT(e,t=Ue.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=rb(e,t,r);eb(o,s),i||a||tb(n,Ge.default.vErrors)}Ue.reportExtraError=BT;function GT(e,t){e.assign(Ge.default.errors,t),e.if((0,oe._)`${Ge.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,oe._)`${Ge.default.vErrors}.length`,t),()=>e.assign(Ge.default.vErrors,null)))}Ue.resetErrorsCount=GT;function KT({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ge.default.errors,s=>{e.const(a,(0,oe._)`${Ge.default.vErrors}[${s}]`),e.if((0,oe._)`${a}.instancePath === undefined`,()=>e.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(Ge.default.instancePath,i.errorPath))),e.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,oe._)`${a}.schema`,r),e.assign((0,oe._)`${a}.data`,n))})}Ue.extendErrors=KT;function eb(e,t){let r=e.const("err",t);e.if((0,oe._)`${Ge.default.vErrors} === null`,()=>e.assign(Ge.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${Ge.default.vErrors}.push(${r})`),e.code((0,oe._)`${Ge.default.errors}++`)}function tb(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,oe._)`new ${e.ValidationError}(${t})`):(r.assign((0,oe._)`${n}.errors`,t),r.return(!1))}var Lr={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function rb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:HT(e,t,r)}function HT(e,t,r={}){let{gen:n,it:o}=e,i=[WT(o,r),XT(e,r)];return YT(e,t,i),n.object(...i)}function WT({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Hs.getErrorPath)(t,Hs.Type.Str)}`:e;return[Ge.default.instancePath,(0,oe.strConcat)(Ge.default.instancePath,r)]}function XT({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,oe.str)`${t}/${e}`;return r&&(o=(0,oe.str)`${o}${(0,Hs.getErrorPath)(r,Hs.Type.Str)}`),[Lr.schemaPath,o]}function YT(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Lr.keyword,o],[Lr.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Lr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Lr.schema,a],[Lr.parentSchema,(0,oe._)`${l}${d}`],[Ge.default.data,i]),u&&n.push([Lr.propertyName,u])}});var ob=I(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.boolOrEmptySchema=Dn.topBoolOrEmptySchema=void 0;var QT=Oi(),eE=H(),tE=Yt(),rE={message:"boolean schema is false"};function nE(e){let{gen:t,schema:r,validateName:n}=e;r===!1?nb(e,!1):typeof r=="object"&&r.$async===!0?t.return(tE.default.data):(t.assign((0,eE._)`${n}.errors`,null),t.return(!0))}Dn.topBoolOrEmptySchema=nE;function oE(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),nb(e)):r.var(t,!0)}Dn.boolOrEmptySchema=oE;function nb(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,QT.reportError)(o,rE,void 0,t)}});var tf=I(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.getRules=Zn.isJSONType=void 0;var iE=["string","number","integer","boolean","null","object","array"],aE=new Set(iE);function sE(e){return typeof e=="string"&&aE.has(e)}Zn.isJSONType=sE;function cE(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Zn.getRules=cE});var rf=I(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.shouldUseRule=vr.shouldUseGroup=vr.schemaHasRulesForType=void 0;function uE({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&ib(e,n)}vr.schemaHasRulesForType=uE;function ib(e,t){return t.rules.some(r=>ab(e,r))}vr.shouldUseGroup=ib;function ab(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}vr.shouldUseRule=ab});var 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 lE=tf(),dE=rf(),pE=Oi(),K=H(),sb=ne(),An;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(An||(Ce.DataType=An={}));function mE(e){let t=cb(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ce.getSchemaTypes=mE;function cb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(lE.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ce.getJSONTypes=cb;function fE(e,t){let{gen:r,data:n,opts:o}=e,i=hE(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,dE.schemaHasRulesForType)(e,t[0]));if(a){let s=of(t,n,o.strictNumbers,An.Wrong);r.if(s,()=>{i.length?gE(e,t,i):af(e)})}return a}Ce.coerceAndCheckDataType=fE;var ub=new Set(["string","number","integer","boolean","null"]);function hE(e,t){return t?e.filter(r=>ub.has(r)||t==="array"&&r==="array"):[]}function gE(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,K._)`typeof ${o}`),s=n.let("coerced",(0,K._)`undefined`);i.coerceTypes==="array"&&n.if((0,K._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,K._)`${o}[0]`).assign(a,(0,K._)`typeof ${o}`).if(of(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,K._)`${s} !== undefined`);for(let u of r)(ub.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),af(e),n.endIf(),n.if((0,K._)`${s} !== undefined`,()=>{n.assign(o,s),vE(e,s)});function c(u){switch(u){case"string":n.elseIf((0,K._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,K._)`"" + ${o}`).elseIf((0,K._)`${o} === null`).assign(s,(0,K._)`""`);return;case"number":n.elseIf((0,K._)`${a} == "boolean" || ${o} === null
|
|
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
|
|
134
1493
|
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,K._)`+${o}`);return;case"integer":n.elseIf((0,K._)`${a} === "boolean" || ${o} === null
|
|
135
1494
|
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,K._)`+${o}`);return;case"boolean":n.elseIf((0,K._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,K._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,K._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,K._)`${a} === "string" || ${a} === "number"
|
|
136
|
-
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function vE({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,K._)`${t} !== undefined`,()=>e.assign((0,K._)`${t}[${r}]`,n))}function nf(e,t,r,n=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,sb.toHash)(e);if(i.array&&i.object){let a=(0,K._)`typeof ${t} != "object"`;o=i.null?a:(0,K._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=K.nil;i.number&&delete i.integer;for(let a in i)o=(0,K.and)(o,nf(a,t,r,n));return o}Ce.checkDataTypes=of;var yE={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,K._)`{type: ${e}}`:(0,K._)`{type: ${t}}`};function af(e){let t=_E(e);(0,pE.reportError)(t,yE)}Ce.reportTypeError=af;function _E(e){let{gen:t,data:r,schema:n}=e,o=(0,sb.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var db=I(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.assignDefaults=void 0;var Un=H(),$E=ne();function bE(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)lb(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>lb(e,i,o.default))}Ws.assignDefaults=bE;function lb(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,Un._)`${i}${(0,Un.getProperty)(t)}`;if(o){(0,$E.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(),yr=Yt(),xE=ne();function kE(e,t){let{gen:r,data:n,it:o}=e;r.if(uf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ve._)`${t}`},!0),e.error()})}ue.checkReportMissingProp=kE;function wE({gen:e,data:t,it:{opts:r}},n,o){return(0,ve.or)(...n.map(i=>(0,ve.and)(uf(e,t,i,r.ownProperties),(0,ve._)`${o} = ${i}`)))}ue.checkMissingProp=wE;function SE(e,t){e.setParams({missingProperty:t},!0),e.error()}ue.reportMissingProp=SE;function pb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}ue.hasPropFunc=pb;function cf(e,t,r){return(0,ve._)`${pb(e)}.call(${t}, ${r})`}ue.isOwnProperty=cf;function zE(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} !== undefined`;return n?(0,ve._)`${o} && ${cf(e,t,r)}`:o}ue.propertyInData=zE;function uf(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} === undefined`;return n?(0,ve.or)(o,(0,ve.not)(cf(e,t,r))):o}ue.noPropertyInData=uf;function mb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ue.allSchemaProperties=mb;function IE(e,t){return mb(t).filter(r=>!(0,sf.alwaysValidSchema)(e,t[r]))}ue.schemaProperties=IE;function TE({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ve._)`${e}, ${t}, ${n}${o}`:t,d=[[yr.default.instancePath,(0,ve.strConcat)(yr.default.instancePath,i)],[yr.default.parentData,a.parentData],[yr.default.parentDataProperty,a.parentDataProperty],[yr.default.rootData,yr.default.rootData]];a.opts.dynamicRef&&d.push([yr.default.dynamicAnchors,yr.default.dynamicAnchors]);let p=(0,ve._)`${l}, ${r.object(...d)}`;return c!==ve.nil?(0,ve._)`${s}.call(${c}, ${p})`:(0,ve._)`${s}(${p})`}ue.callValidateCode=TE;var EE=(0,ve._)`new RegExp`;function PE({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ve._)`${o.code==="new RegExp"?EE:(0,xE.useFunc)(e,o)}(${r}, ${n})`})}ue.usePattern=PE;function OE(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ve._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:sf.Type.Num},i),t.if((0,ve.not)(i),s)})}}ue.validateArray=OE;function jE(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,sf.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ve._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ve.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ue.validateUnion=jE});var gb=I(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;var Ke=H(),qr=Yt(),NE=gt(),RE=Oi();function DE(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=hb(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ke.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Nt.macroKeywordCode=DE;function ZE(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;UE(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=hb(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)y(),t.modifying&&fb(e),_(()=>e.error());else{let x=t.async?m():g();t.modifying&&fb(e),_(()=>AE(e,x))}}function m(){let x=n.let("ruleErrs",null);return n.try(()=>y((0,Ke._)`await `),j=>n.assign(d,!1).if((0,Ke._)`${j} instanceof ${c.ValidationError}`,()=>n.assign(x,(0,Ke._)`${j}.errors`),()=>n.throw(j))),x}function g(){let x=(0,Ke._)`${l}.errors`;return n.assign(x,null),y(Ke.nil),x}function y(x=t.async?(0,Ke._)`await `:Ke.nil){let j=c.opts.passContext?qr.default.this:qr.default.self,P=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${x}${(0,NE.callValidateCode)(e,l,j,P)}`,t.modifying)}function _(x){var j;n.if((0,Ke.not)((j=t.valid)!==null&&j!==void 0?j:d),x)}}Nt.funcKeywordCode=ZE;function fb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ke._)`${n.parentData}[${n.parentDataProperty}]`))}function AE(e,t){let{gen:r}=e;r.if((0,Ke._)`Array.isArray(${t})`,()=>{r.assign(qr.default.vErrors,(0,Ke._)`${qr.default.vErrors} === null ? ${t} : ${qr.default.vErrors}.concat(${t})`).assign(qr.default.errors,(0,Ke._)`${qr.default.vErrors}.length`),(0,RE.extendErrors)(e)},()=>e.error())}function UE({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function hb(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ke.stringify)(r)})}function CE(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Nt.validSchemaType=CE;function ME({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Nt.validateKeywordUsage=ME});var yb=I(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendSubschemaMode=_r.extendSubschemaData=_r.getSubschema=void 0;var Rt=H(),vb=ne();function LE(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Rt._)`${e.schemaPath}${(0,Rt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Rt._)`${e.schemaPath}${(0,Rt.getProperty)(t)}${(0,Rt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,vb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}_r.getSubschema=LE;function qE(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,Rt._)`${t.data}${(0,Rt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Rt.str)`${u}${(0,vb.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Rt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Rt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}_r.extendSubschemaData=qE;function FE(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}_r.extendSubschemaMode=FE});var lf=I((hL,_b)=>{"use strict";_b.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var bb=I((gL,$b)=>{"use strict";var $r=$b.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};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+"/"+VE(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 VE(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 JE=ne(),BE=lf(),GE=bb(),KE=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function HE(e,t=!0){return typeof e=="boolean"?!0:t===!0?!df(e):t?xb(e)<=t:!1}Qe.inlineRef=HE;var WE=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function df(e){for(let t in e){if(WE.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(df)||typeof r=="object"&&df(r))return!0}return!1}function xb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!KE.has(r)&&(typeof e[r]=="object"&&(0,JE.eachItem)(e[r],n=>t+=xb(n)),t===1/0))return 1/0}return t}function kb(e,t="",r){r!==!1&&(t=Cn(t));let n=e.parse(t);return wb(e,n)}Qe.getFullPath=kb;function wb(e,t){return e.serialize(t).split("#")[0]+"#"}Qe._getFullPath=wb;var XE=/#\/?$/;function Cn(e){return e?e.replace(XE,""):""}Qe.normalizeId=Cn;function YE(e,t,r){return r=Cn(r),e.resolve(t,r)}Qe.resolveUrl=YE;var QE=/^[a-z_][-a-z0-9._]*$/i;function eP(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Cn(e[r]||t),i={"":o},a=kb(n,o,!1),s={},c=new Set;return GE(e,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let y=a+p,_=i[g];typeof d[r]=="string"&&(_=x.call(this,d[r])),j.call(this,d.$anchor),j.call(this,d.$dynamicAnchor),i[p]=_;function x(P){let z=this.opts.uriResolver.resolve;if(P=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(!QE.test(P))throw new Error(`invalid anchor "${P}"`);x.call(this,`#${P}`)}}}),s;function u(d,p,m){if(p!==void 0&&!BE(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Qe.getSchemaRefs=eP});var Zi=I(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.getData=br.KeywordCxt=br.validateFunctionCode=void 0;var Eb=ob(),Sb=ji(),mf=rf(),Ys=ji(),tP=db(),Di=gb(),pf=yb(),D=H(),q=Yt(),rP=Ni(),Qt=ne(),Ri=Oi();function nP(e){if(jb(e)&&(Nb(e),Ob(e))){aP(e);return}Pb(e,()=>(0,Eb.topBoolOrEmptySchema)(e))}br.validateFunctionCode=nP;function Pb({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,D._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${zb(r,o)}`),iP(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${oP(o)}`,n.$async,()=>e.code(zb(r,o)).code(i))}function oP(e){return(0,D._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,D._)`, ${q.default.dynamicAnchors}={}`:D.nil}}={}`}function iP(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,D._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,D._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,D._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,D._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,D._)`""`),e.var(q.default.parentData,(0,D._)`undefined`),e.var(q.default.parentDataProperty,(0,D._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`{}`)})}function aP(e){let{schema:t,opts:r,gen:n}=e;Pb(e,()=>{r.$comment&&t.$comment&&Db(e),dP(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&sP(e),Rb(e),fP(e)})}function sP(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function zb(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function cP(e,t){if(jb(e)&&(Nb(e),Ob(e))){uP(e,t);return}(0,Eb.boolOrEmptySchema)(e,t)}function Ob({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function jb(e){return typeof e.schema!="boolean"}function uP(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Db(e),pP(e),mP(e);let i=n.const("_errs",q.default.errors);Rb(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function Nb(e){(0,Qt.checkUnknownRules)(e),lP(e)}function Rb(e,t){if(e.opts.jtd)return Ib(e,[],!1,t);let r=(0,Sb.getSchemaTypes)(e.schema),n=(0,Sb.coerceAndCheckDataType)(e,r);Ib(e,r,!n,t)}function lP(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Qt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dP(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Qt.checkStrictMode)(e,"default is ignored in the schema root")}function pP(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rP.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function mP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Db({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,D._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function fP(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,D._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,D._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,q.default.vErrors),i.unevaluated&&hP(e),t.return((0,D._)`${q.default.errors} === 0`))}function hP({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Ib(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Qt.schemaHasRulesButRef)(i,l))){o.block(()=>Ab(e,"$ref",l.all.$ref.definition));return}c.jtd||gP(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,mf.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Ys.checkDataType)(p.type,a,c.strictNumbers)),Tb(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Ys.reportTypeError)(e)),o.endIf()):Tb(e,p),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Tb(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,tP.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,mf.shouldUseRule)(n,i)&&Ab(e,i.keyword,i.definition,t.type)})}function gP(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(vP(e,t),e.opts.allowUnionTypes||yP(e,t),_P(e,e.dataTypes))}function vP(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Zb(e.dataTypes,r)||ff(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bP(e,t)}}function yP(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ff(e,"use allowUnionTypes to allow union type keyword")}function _P(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,mf.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>$P(t,a))&&ff(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function $P(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Zb(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bP(e,t){let r=[];for(let n of e.dataTypes)Zb(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ff(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Qt.checkStrictMode)(e,t,e.opts.strictTypes)}var 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",Ub(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 cP(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Qt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Qt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,D.Name)),!0}};br.KeywordCxt=Qs;function Ab(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 xP=/^\/(?:[^~]|~0|~1)*$/,kP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ub(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!xP.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=kP.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,D._)`${i}${(0,D.getProperty)((0,Qt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}br.getData=Ub});var 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(),wP=ec(),Fr=Yt(),zt=Ni(),Cb=ne(),SP=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=Mb.call(this,e);if(t)return t;let r=(0,zt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new St.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:wP.default,code:(0,St._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Fr.default.data,parentData:Fr.default.parentData,parentDataProperty:Fr.default.parentDataProperty,dataNames:[Fr.default.data],dataPathArr:[St.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,St.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:St.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,St._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,SP.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Fr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Fr.default.self}`,`${Fr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:y}=u;m.evaluated={props:g instanceof St.Name?void 0:g,items:y instanceof St.Name?void 0:y,dynamicProps:g instanceof St.Name,dynamicItems:y instanceof St.Name},m.source&&(m.source.evaluated=(0,St.stringify)(m.evaluated))}return e.validate=m,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}vt.compileSchema=bf;function zP(e,t,r){var n;r=(0,zt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=EP.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new Mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=IP.call(this,i)}vt.resolveRef=zP;function IP(e){return(0,zt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bf.call(this,e)}function Mb(e){for(let t of this._compilations)if(TP(t,e))return t}vt.getCompilingSchema=Mb;function TP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function EP(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||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 PP=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $f(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Cb.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!PP.has(s)&&u&&(t=(0,zt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Cb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,zt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=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 Lb=I((xL,OP)=>{OP.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var kf=I((kL,Jb)=>{"use strict";var jP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Fb=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function xf(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var NP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function qb(e){return e.length=0,!0}function RP(e,t,r){if(e.length){let n=xf(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function DP(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=RP;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=qb}else{o.push(u);continue}}return o.length&&(s===qb?r.zone=o.join(""):a?n.push(o.join("")):n.push(xf(o))),r.address=n.join(""),r}function Vb(e){if(ZP(e,":")<2)return{host:e,isIPV6:!1};let t=DP(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ZP(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function AP(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function UP(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function CP(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Fb(r)){let n=Vb(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Jb.exports={nonSimpleDomain:NP,recomposeAuthority:CP,normalizeComponentEncoding:UP,removeDotSegments:AP,isIPv4:Fb,isUUID:jP,normalizeIPv6:Vb,stringArrayToHexStripped:xf}});var Wb=I((wL,Hb)=>{"use strict";var{isUUID:MP}=kf(),LP=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,qP=["http","https","ws","wss","urn","urn:uuid"];function FP(e){return qP.indexOf(e)!==-1}function wf(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Bb(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Gb(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function VP(e){return e.secure=wf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function JP(e){if((e.port===(wf(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function BP(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(LP);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=Sf(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function GP(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=Sf(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function KP(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!MP(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function HP(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Kb={scheme:"http",domainHost:!0,parse:Bb,serialize:Gb},WP={scheme:"https",domainHost:Kb.domainHost,parse:Bb,serialize:Gb},nc={scheme:"ws",domainHost:!0,parse:VP,serialize:JP},XP={scheme:"wss",domainHost:nc.domainHost,parse:nc.parse,serialize:nc.serialize},YP={scheme:"urn",parse:BP,serialize:GP,skipNormalize:!0},QP={scheme:"urn:uuid",parse:KP,serialize:HP,skipNormalize:!0},oc={http:Kb,https:WP,ws:nc,wss:XP,urn:YP,"urn:uuid":QP};Object.setPrototypeOf(oc,null);function Sf(e){return e&&(oc[e]||oc[e.toLowerCase()])||void 0}Hb.exports={wsIsSecure:wf,SCHEMES:oc,isValidSchemeName:FP,getSchemeHandler:Sf}});var Qb=I((SL,ac)=>{"use strict";var{normalizeIPv6:eO,removeDotSegments:Ui,recomposeAuthority:tO,normalizeComponentEncoding:ic,isIPv4:rO,nonSimpleDomain:nO}=kf(),{SCHEMES:oO,getSchemeHandler:Xb}=Wb();function iO(e,t){return typeof e=="string"?e=Dt(er(e,t),t):typeof e=="object"&&(e=er(Dt(e,t),t)),e}function aO(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Yb(er(e,n),er(t,n),n,!0);return n.skipEscape=!0,Dt(o,n)}function Yb(e,t,r,n){let o={};return n||(e=er(Dt(e,r),r),t=er(Dt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=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 sO(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=Xb(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=tO(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=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 cO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function er(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(cO);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(rO(n.host)===!1){let c=eO(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Xb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&nO(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var zf={SCHEMES:oO,normalize:iO,resolve:aO,resolveComponent:Yb,equal:sO,serialize:Dt,parse:er};ac.exports=zf;ac.exports.default=zf;ac.exports.fastUri=zf});var tx=I(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var ex=Qb();ex.code='require("ajv/dist/runtime/uri").default';If.default=ex});var ux=I(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.CodeGen=je.Name=je.nil=je.stringify=je.str=je._=je.KeywordCxt=void 0;var uO=Zi();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return uO.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 lO=ec(),ax=Ai(),dO=tf(),Ci=rc(),pO=H(),Mi=Ni(),sc=ji(),Ef=ne(),rx=Lb(),mO=tx(),sx=(e,t)=>new RegExp(e,t);sx.code="new RegExp";var fO=["removeAdditional","useDefaults","coerceTypes"],hO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),gO={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},vO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nx=200;function yO(e){var t,r,n,o,i,a,s,c,u,l,d,p,m,g,y,_,x,j,P,z,k,$e,Ie,Me,$t;let Ct=e.strict,wr=(t=e.code)===null||t===void 0?void 0:t.optimize,Kr=wr===!0||wr===void 0?1:wr||0,tr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:sx,Yi=(o=e.uriResolver)!==null&&o!==void 0?o:mO.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Ct)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Ct)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ct)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Ct)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:Ct)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Kr,regExp:tr}:{optimize:Kr,regExp:tr},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:nx,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:nx,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(P=e.inlineRefs)!==null&&P!==void 0?P:!0,schemaId:(z=e.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:($e=e.validateSchema)!==null&&$e!==void 0?$e:!0,validateFormats:(Ie=e.validateFormats)!==null&&Ie!==void 0?Ie:!0,unicodeRegExp:(Me=e.unicodeRegExp)!==null&&Me!==void 0?Me:!0,int32range:($t=e.int32range)!==null&&$t!==void 0?$t:!0,uriResolver: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,...yO(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new pO.ValueScope({scope:{},prefixes:hO,es5:r,lines:n}),this.logger=wO(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,dO.getRules)(),ox.call(this,gO,t,"NOT SUPPORTED"),ox.call(this,vO,t,"DEPRECATED","warn"),this._metaOpts=xO.call(this),t.formats&&$O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&bO.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),_O.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=rx;n==="id"&&(o={...rx},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ax.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,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=ix.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=ix.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,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(zO.call(this,n,r),!r)return(0,Ef.eachItem)(n,i=>Tf.call(this,i)),this;TO.call(this,r);let o={...r,type:(0,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]=cx(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,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=lO.default;Li.MissingRefError=ax.default;je.default=Li;function ox(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function ix(e){return e=(0,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 $O(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function bO(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function xO(){let e={...this.opts};for(let t of fO)delete e[t];return e}var kO={log(){},warn(){},error(){}};function wO(e){if(e===!1)return kO;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var SO=/^[a-z_$][a-z0-9_$:-]*$/i;function zO(e,t){let{RULES:r}=this;if((0,Ef.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!SO.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Tf(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,sc.getJSONTypes)(t.type),schemaType:(0,sc.getJSONTypes)(t.schemaType)}};t.before?IO.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function IO(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function TO(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=cx(t)),e.validateSchema=this.compile(t,!0))}var EO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cx(e){return{anyOf:[e,EO]}}});var lx=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var PO={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Pf.default=PO});var fx=I(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.callRef=Vr.getValidate=void 0;var OO=Ai(),dx=gt(),et=H(),qn=Yt(),px=rc(),cc=ne(),jO={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=px.resolveRef.call(c,u,o,r);if(l===void 0)throw new OO.default(n.opts.uriResolver,o,r);if(l instanceof px.SchemaEnv)return p(l);return m(l);function d(){if(i===u)return 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=mx(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 mx(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,et._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Vr.getValidate=mx;function 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,dx.callValidateCode)(e,t,u)}`),m(t),a||o.assign(g,!0)},y=>{o.if((0,et._)`!(${y} instanceof ${i.ValidationError})`,()=>o.throw(y)),p(y),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,dx.callValidateCode)(e,t,u),()=>m(t),()=>p(t))}function p(g){let y=(0,et._)`${g}.errors`;o.assign(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)}}}Vr.callRef=uc;Vr.default=jO});var hx=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var NO=lx(),RO=fx(),DO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",NO.default,RO.default];Of.default=DO});var gx=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var lc=H(),xr=lc.operators,dc={maximum:{okStr:"<=",ok:xr.LTE,fail:xr.GT},minimum:{okStr:">=",ok:xr.GTE,fail:xr.LT},exclusiveMaximum:{okStr:"<",ok:xr.LT,fail:xr.GTE},exclusiveMinimum:{okStr:">",ok:xr.GT,fail:xr.LTE}},ZO={message:({keyword:e,schemaCode:t})=>(0,lc.str)`must be ${dc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,lc._)`{comparison: ${dc[e].okStr}, limit: ${t}}`},AO={keyword:Object.keys(dc),type:"number",schemaType:"number",$data:!0,error:ZO,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,lc._)`${r} ${dc[t].fail} ${n} || isNaN(${r})`)}};jf.default=AO});var vx=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var qi=H(),UO={message:({schemaCode:e})=>(0,qi.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,qi._)`{multipleOf: ${e}}`},CO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:UO,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,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=CO});var _x=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});function yx(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Rf.default=yx;yx.code='require("ajv/dist/runtime/ucs2length").default'});var $x=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var Jr=H(),MO=ne(),LO=_x(),qO={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Jr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Jr._)`{limit: ${e}}`},FO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:qO,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Jr.operators.GT:Jr.operators.LT,a=o.opts.unicode===!1?(0,Jr._)`${r}.length`:(0,Jr._)`${(0,MO.useFunc)(e.gen,LO.default)}(${r})`;e.fail$data((0,Jr._)`${a} ${i} ${n}`)}};Df.default=FO});var bx=I(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var VO=gt(),JO=ne(),Fn=H(),BO={message:({schemaCode:e})=>(0,Fn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Fn._)`{pattern: ${e}}`},GO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:BO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,Fn._)`new RegExp`:(0,JO.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,VO.usePattern)(e,o);e.fail$data((0,Fn._)`!${c}.test(${r})`)}}};Zf.default=GO});var xx=I(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});var Fi=H(),KO={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}}`},HO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:KO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Fi.operators.GT:Fi.operators.LT;e.fail$data((0,Fi._)`Object.keys(${r}).length ${o} ${n}`)}};Af.default=HO});var kx=I(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var Vi=gt(),Ji=H(),WO=ne(),XO={message:({params:{missingProperty:e}})=>(0,Ji.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ji._)`{missingProperty: ${e}}`},YO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:XO,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let y of r)if(m?.[y]===void 0&&!g.has(y)){let _=a.schemaEnv.baseId+a.errSchemaPath,x=`required property "${y}" is not defined at "${_}" (strictRequired)`;(0,WO.checkStrictMode)(a,x,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(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=YO});var wx=I(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var Bi=H(),QO={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}}`},ej={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:QO,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Bi.operators.GT:Bi.operators.LT;e.fail$data((0,Bi._)`${r}.length ${o} ${n}`)}};Cf.default=ej});var pc=I(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var Sx=lf();Sx.code='require("ajv/dist/runtime/equal").default';Mf.default=Sx});var zx=I(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});var Lf=ji(),Ne=H(),tj=ne(),rj=pc(),nj={message:({params:{i:e,j:t}})=>(0,Ne.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ne._)`{i: ${e}, j: ${t}}`},oj={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:nj,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Lf.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Ne._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Ne._)`${r}.length`),y=t.let("j");e.setParams({i:g,j:y}),t.assign(c,!0),t.if((0,Ne._)`${g} > 1`,()=>(d()?p:m)(g,y))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,y){let _=t.name("item"),x=(0,Lf.checkDataTypes)(u,_,s.opts.strictNumbers,Lf.DataType.Wrong),j=t.const("indices",(0,Ne._)`{}`);t.for((0,Ne._)`;${g}--;`,()=>{t.let(_,(0,Ne._)`${r}[${g}]`),t.if(x,(0,Ne._)`continue`),u.length>1&&t.if((0,Ne._)`typeof ${_} == "string"`,(0,Ne._)`${_} += "_"`),t.if((0,Ne._)`typeof ${j}[${_}] == "number"`,()=>{t.assign(y,(0,Ne._)`${j}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ne._)`${j}[${_}] = ${g}`)})}function m(g,y){let _=(0,tj.useFunc)(t,rj.default),x=t.name("outer");t.label(x).for((0,Ne._)`;${g}--;`,()=>t.for((0,Ne._)`${y} = ${g}; ${y}--;`,()=>t.if((0,Ne._)`${_}(${r}[${g}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(x)})))}}};qf.default=oj});var Ix=I(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});var Ff=H(),ij=ne(),aj=pc(),sj={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ff._)`{allowedValue: ${e}}`},cj={keyword:"const",$data:!0,error:sj,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Ff._)`!${(0,ij.useFunc)(t,aj.default)}(${r}, ${o})`):e.fail((0,Ff._)`${i} !== ${r}`)}};Vf.default=cj});var Tx=I(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var Gi=H(),uj=ne(),lj=pc(),dj={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Gi._)`{allowedValues: ${e}}`},pj={keyword:"enum",schemaType:"array",$data:!0,error:dj,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,uj.useFunc)(t,lj.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=t.const("vSchema",i);l=(0,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=pj});var Ex=I(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});var mj=gx(),fj=vx(),hj=$x(),gj=bx(),vj=xx(),yj=kx(),_j=wx(),$j=zx(),bj=Ix(),xj=Tx(),kj=[mj.default,fj.default,hj.default,gj.default,vj.default,yj.default,_j.default,$j.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},bj.default,xj.default];Bf.default=kj});var Kf=I(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.validateAdditionalItems=void 0;var Br=H(),Gf=ne(),wj={message:({params:{len:e}})=>(0,Br.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Br._)`{limit: ${e}}`},Sj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:wj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Gf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Px(e,n)}};function Px(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Br._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Br._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Gf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Br._)`${s} <= ${t.length}`);r.if((0,Br.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Gf.Type.Num},u),a.allErrors||r.if((0,Br.not)(u),()=>r.break())})}}Ki.validateAdditionalItems=Px;Ki.default=Sj});var Hf=I(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateTuple=void 0;var Ox=H(),mc=ne(),zj=gt(),Ij={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return jx(e,"additionalItems",t);r.items=!0,!(0,mc.alwaysValidSchema)(r,t)&&e.ok((0,zj.validateArray)(e))}};function jx(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=mc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,Ox._)`${i}.length`);r.forEach((d,p)=>{(0,mc.alwaysValidSchema)(s,d)||(n.if((0,Ox._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=s,g=r.length,y=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!y){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,mc.checkStrictMode)(s,_,p.strictTuples)}}}Hi.validateTuple=jx;Hi.default=Ij});var Nx=I(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var Tj=Hf(),Ej={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Tj.validateTuple)(e,"items")};Wf.default=Ej});var Dx=I(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var Rx=H(),Pj=ne(),Oj=gt(),jj=Kf(),Nj={message:({params:{len:e}})=>(0,Rx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Rx._)`{limit: ${e}}`},Rj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Nj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Pj.alwaysValidSchema)(n,t)&&(o?(0,jj.validateAdditionalItems)(e,o):e.ok((0,Oj.validateArray)(e)))}};Xf.default=Rj});var Zx=I(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});var yt=H(),fc=ne(),Dj={message:({params:{min:e,max:t}})=>t===void 0?(0,yt.str)`must contain at least ${e} valid item(s)`:(0,yt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,yt._)`{minContains: ${e}}`:(0,yt._)`{minContains: ${e}, maxContains: ${t}}`},Zj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Dj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,yt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,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=Zj});var Cx=I(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.validateSchemaDeps=Zt.validatePropertyDeps=Zt.error=void 0;var Qf=H(),Aj=ne(),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},
|
|
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},
|
|
137
1496
|
missingProperty: ${n},
|
|
138
1497
|
depsCount: ${t},
|
|
139
|
-
deps: ${r}}`};var Uj={keyword:"dependencies",type:"object",schemaType:"object",error:Zt.error,code(e){let[t,r]=Cj(e);Ax(e,t),Ux(e,r)}};function Cj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Ax(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,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=Ax;function Ux(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,Aj.alwaysValidSchema)(i,t[s])||(r.if((0,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=Ux;Zt.default=Uj});var Lx=I(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var Mx=H(),Mj=ne(),Lj={message:"property name must be valid",params:({params:e})=>(0,Mx._)`{propertyName: ${e.propertyName}}`},qj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Lj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Mj.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,Mx.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};eh.default=qj});var rh=I(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var hc=gt(),It=H(),Fj=Yt(),gc=ne(),Vj={message:"must NOT have additional properties",params:({params:e})=>(0,It._)`{additionalProperty: ${e.additionalProperty}}`},Jj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Vj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,gc.alwaysValidSchema)(a,r))return;let u=(0,hc.allSchemaProperties)(n.properties),l=(0,hc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,It._)`${i} === ${Fj.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?g(_):t.if(p(_),()=>g(_))})}function p(_){let x;if(u.length>8){let j=(0,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=Jj});var Vx=I(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var Bj=Zi(),qx=gt(),nh=ne(),Fx=rh(),Gj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Fx.default.code(new Bj.KeywordCxt(i,Fx.default,"additionalProperties"));let a=(0,qx.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=nh.mergeEvaluated.props(t,(0,nh.toHash)(a),i.props));let s=a.filter(d=>!(0,nh.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,qx.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};oh.default=Gj});var Kx=I(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var Jx=gt(),vc=H(),Bx=ne(),Gx=ne(),Kj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,Jx.allSchemaProperties)(r),c=s.filter(y=>(0,Bx.alwaysValidSchema)(i,r[y]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof vc.Name)&&(i.props=(0,Gx.evaluatedPropsToName)(t,i.props));let{props:d}=i;p();function p(){for(let y of s)u&&m(y),i.allErrors?g(y):(t.var(l,!0),g(y),t.if(l))}function m(y){for(let _ in u)new RegExp(y).test(_)&&(0,Bx.checkStrictMode)(i,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",n,_=>{t.if((0,vc._)`${(0,Jx.usePattern)(e,y)}.test(${_})`,()=>{let x=c.includes(y);x||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:Gx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,vc._)`${d}[${_}]`,!0):!x&&!i.allErrors&&t.if((0,vc.not)(l),()=>t.break())})})}}};ih.default=Kj});var Hx=I(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Hj=ne(),Wj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Hj.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ah.default=Wj});var Wx=I(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var Xj=gt(),Yj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Xj.validateUnion,error:{message:"must match a schema in anyOf"}};sh.default=Yj});var Xx=I(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var yc=H(),Qj=ne(),eN={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,yc._)`{passingSchemas: ${e.passing}}`},tN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:eN,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let p;(0,Qj.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,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=tN});var Yx=I(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});var rN=ne(),nN={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,rN.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};uh.default=nN});var tk=I(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var _c=H(),ek=ne(),oN={message:({params:e})=>(0,_c.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,_c._)`{failingKeyword: ${e.ifClause}}`},iN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:oN,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,ek.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Qx(n,"then"),i=Qx(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,_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 Qx(e,t){let r=e.schema[t];return r!==void 0&&!(0,ek.alwaysValidSchema)(e,r)}lh.default=iN});var rk=I(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var aN=ne(),sN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,aN.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};dh.default=sN});var nk=I(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var cN=Kf(),uN=Nx(),lN=Hf(),dN=Dx(),pN=Zx(),mN=Cx(),fN=Lx(),hN=rh(),gN=Vx(),vN=Kx(),yN=Hx(),_N=Wx(),$N=Xx(),bN=Yx(),xN=tk(),kN=rk();function wN(e=!1){let t=[yN.default,_N.default,$N.default,bN.default,xN.default,kN.default,fN.default,hN.default,mN.default,gN.default,vN.default];return e?t.push(uN.default,dN.default):t.push(cN.default,lN.default),t.push(pN.default),t}ph.default=wN});var ok=I(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var xe=H(),SN={message:({schemaCode:e})=>(0,xe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,xe._)`{format: ${e}}`},zN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:SN,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():m();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,xe._)`${g}[${a}]`),_=r.let("fType"),x=r.let("format");r.if((0,xe._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(_,(0,xe._)`${y}.type || "string"`).assign(x,(0,xe._)`${y}.validate`),()=>r.assign(_,(0,xe._)`"string"`).assign(x,y)),e.fail$data((0,xe.or)(j(),P()));function j(){return c.strictSchema===!1?xe.nil:(0,xe._)`${a} && !${x}`}function P(){let z=l.$async?(0,xe._)`(${y}.async ? await ${x}(${n}) : ${x}(${n}))`:(0,xe._)`${x}(${n})`,k=(0,xe._)`(typeof ${x} == "function" ? ${z} : ${x}.test(${n}))`;return(0,xe._)`${x} && ${x} !== true && ${_} === ${t} && !${k}`}}function m(){let g=d.formats[i];if(!g){j();return}if(g===!0)return;let[y,_,x]=P(g);y===t&&e.pass(z());function j(){if(c.strictSchema===!1){d.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function P(k){let $e=k instanceof RegExp?(0,xe.regexpCode)(k):c.code.formats?(0,xe._)`${c.code.formats}${(0,xe.getProperty)(i)}`:void 0,Ie=r.scopeValue("formats",{key:i,ref:k,code:$e});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,xe._)`${Ie}.validate`]:["string",k,Ie]}function z(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,xe._)`await ${x}(${n})`}return typeof _=="function"?(0,xe._)`${x}(${n})`:(0,xe._)`${x}.test(${n})`}}}};mh.default=zN});var ik=I(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});var IN=ok(),TN=[IN.default];fh.default=TN});var ak=I(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 ck=I(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});var EN=hx(),PN=Ex(),ON=nk(),jN=ik(),sk=ak(),NN=[EN.default,PN.default,(0,ON.default)(),jN.default,sk.metadataVocabulary,sk.contentVocabulary];hh.default=NN});var lk=I($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.DiscrError=void 0;var uk;(function(e){e.Tag="tag",e.Mapping="mapping"})(uk||($c.DiscrError=uk={}))});var pk=I(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});var Jn=H(),gh=lk(),dk=rc(),RN=Ai(),DN=ne(),ZN={message:({params:{discrError:e,tagName:t}})=>e===gh.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Jn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},AN={keyword:"discriminator",type:"object",schemaType:"object",error:ZN,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,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,DN.schemaHasRulesButRef)(k,i.self.RULES)){let Ie=k.$ref;if(k=dk.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ie),k instanceof dk.SchemaEnv&&(k=k.schema),k===void 0)throw new RN.default(i.opts.uriResolver,i.baseId,Ie)}let $e=(m=k?.properties)===null||m===void 0?void 0:m[s];if(typeof $e!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);_=_&&(y||x(k)),j($e,z)}if(!_)throw new Error(`discriminator: "${s}" must be required`);return g;function x({required:z}){return Array.isArray(z)&&z.includes(s)}function j(z,k){if(z.const)P(z.const,k);else if(z.enum)for(let $e of z.enum)P($e,k);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function P(z,k){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[z]=k}}}};vh.default=AN});var mk=I((m2,UN)=>{UN.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var _h=I((ye,yh)=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MissingRefError=ye.ValidationError=ye.CodeGen=ye.Name=ye.nil=ye.stringify=ye.str=ye._=ye.KeywordCxt=ye.Ajv=void 0;var CN=ux(),MN=ck(),LN=pk(),fk=mk(),qN=["/properties"],bc="http://json-schema.org/draft-07/schema",Bn=class extends CN.default{_addVocabularies(){super._addVocabularies(),MN.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(LN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(fk,qN):fk;this.addMetaSchema(t,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 FN=Zi();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return FN.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 VN=ec();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return VN.default}});var JN=Ai();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return JN.default}})});var xk=I(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.formatNames=Ut.fastFormats=Ut.fullFormats=void 0;function At(e,t){return{validate:e,compare:t}}Ut.fullFormats={date:At(yk,kh),time:At(bh(!0),wh),"date-time":At(hk(!0),$k),"iso-time":At(bh(),_k),"iso-date-time":At(hk(),bk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:XN,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:oR,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:YN,int32:{type:"number",validate:tR},int64:{type:"number",validate:rR},float:{type:"number",validate:vk},double:{type:"number",validate:vk},password:!0,binary:!0};Ut.fastFormats={...Ut.fullFormats,date:At(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kh),time:At(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,wh),"date-time":At(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,$k),"iso-time":At(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,_k),"iso-date-time":At(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bk),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ut.formatNames=Object.keys(Ut.fullFormats);function BN(e){return e%4===0&&(e%100!==0||e%400===0)}var GN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,KN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function yk(e){let t=GN.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&BN(r)?29:KN[n])}function kh(e,t){if(e&&t)return e>t?1:e<t?-1:0}var $h=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function bh(e){return function(r){let n=$h.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function wh(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function _k(e,t){if(!(e&&t))return;let r=$h.exec(e),n=$h.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var xh=/t|\s/i;function hk(e){let t=bh(e);return function(n){let o=n.split(xh);return o.length===2&&yk(o[0])&&t(o[1])}}function $k(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function bk(e,t){if(!(e&&t))return;let[r,n]=e.split(xh),[o,i]=t.split(xh),a=kh(r,o);if(a!==void 0)return a||wh(n,i)}var HN=/\/|:/,WN=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function XN(e){return HN.test(e)&&WN.test(e)}var gk=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function YN(e){return gk.lastIndex=0,gk.test(e)}var QN=-(2**31),eR=2**31-1;function tR(e){return Number.isInteger(e)&&e<=eR&&e>=QN}function rR(e){return Number.isInteger(e)}function vk(){return!0}var nR=/[^\\]\\Z/;function oR(e){if(nR.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var kk=I(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.formatLimitDefinition=void 0;var iR=_h(),Tt=H(),kr=Tt.operators,xc={formatMaximum:{okStr:"<=",ok:kr.LTE,fail:kr.GT},formatMinimum:{okStr:">=",ok:kr.GTE,fail:kr.LT},formatExclusiveMaximum:{okStr:"<",ok:kr.LT,fail:kr.GTE},formatExclusiveMinimum:{okStr:">",ok:kr.GT,fail:kr.LTE}},aR={message:({keyword:e,schemaCode:t})=>(0,Tt.str)`should be ${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:aR,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new iR.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),m=t.const("fmt",(0,Tt._)`${p}[${c.schemaCode}]`);e.fail$data((0,Tt.or)((0,Tt._)`typeof ${m} != "object"`,(0,Tt._)`${m} instanceof RegExp`,(0,Tt._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=s.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=t.scopeValue("formats",{key:p,ref:m,code:a.code.formats?(0,Tt._)`${a.code.formats}${(0,Tt.getProperty)(p)}`:void 0});e.fail$data(d(g))}function d(p){return(0,Tt._)`${p}.compare(${r}, ${n}) ${xc[o].fail} 0`}},dependencies:["format"]};var sR=e=>(e.addKeyword(Kn.formatLimitDefinition),e);Kn.default=sR});var Ik=I((Xi,zk)=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Hn=xk(),cR=kk(),Sh=H(),wk=new Sh.Name("fullFormats"),uR=new Sh.Name("fastFormats"),zh=(e,t={keywords:!0})=>{if(Array.isArray(t))return Sk(e,t,Hn.fullFormats,wk),e;let[r,n]=t.mode==="fast"?[Hn.fastFormats,uR]:[Hn.fullFormats,wk],o=t.formats||Hn.formatNames;return Sk(e,o,r,n),t.keywords&&(0,cR.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 Sk(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Sh._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}zk.exports=Xi=zh;Object.defineProperty(Xi,"__esModule",{value:!0});Xi.default=zh});function lR(){let e=new Tk.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ek.default)(e),e}var Tk,Ek,kc,Pk=h(()=>{Tk=Yn(_h(),1),Ek=Yn(Ik(),1);kc=class{constructor(t){this._ajv=t??lR()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var wc,Ok=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 jk(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Nk(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Rk=h(()=>{});var Sc,Dk=h(()=>{q$();jn();Pk();os();Ok();Rk();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=L$(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=pr(_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=pr(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=pr(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){Nk(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&jk(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:$$.includes(r)?r:Lp,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},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 dR(e){return T$.parse(JSON.parse(e))}function Zk(e){return JSON.stringify(e)+`
|
|
140
|
-
`}var zc,
|
|
141
|
-
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),
|
|
142
|
-
`).filter(n=>n.length>0).slice(-e)}catch{return[]}}async function
|
|
143
|
-
`).filter(n=>n.length>0).slice(-e)}catch{return[]}}function Eh(){let e=process.platform==="darwin"?"open":"xdg-open";try{Bun.spawnSync([e,"http://localhost:3030"])}catch{}}async function
|
|
144
|
-
`);o=_.length};for(;;){try{let s=await fetch("http://localhost:3030/status");if(s.ok){let c=await s.json();if(a(c),c.phase==="ready")break}}catch{}i++,await Bun.sleep(500)}process.exit(0)}case"teardown":{let e=_t.includes("--yes");await qc(),(0,
|
|
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.2"),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)});
|